Class: YOWL::IndividualAssociation
- Inherits:
-
LabelledDocObject
- Object
- DocObject
- LabelledDocObject
- YOWL::IndividualAssociation
- Defined in:
- lib/yowl/individual_association.rb
Instance Attribute Summary collapse
-
#domainIndividual ⇒ Object
readonly
Returns the value of attribute domainIndividual.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#property ⇒ Object
readonly
Returns the value of attribute property.
-
#rangeIndividual ⇒ Object
readonly
Returns the value of attribute rangeIndividual.
Attributes inherited from DocObject
Instance Method Summary collapse
-
#addAsGraphVizEdge(graph_, nodes_, edges_, level_) ⇒ Object
Add the current IndividualAssociation as an edge to the given GraphViz graph, but check whether the IndividualAssociation refers to a Domain and Range class in the current schema and whether the IndividualAssociation has already been added to the graph (by checking the given edges collection).
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(resource, schema, domainIndividual, rangeIndividual) ⇒ IndividualAssociation
constructor
A new instance of IndividualAssociation.
- #label ⇒ Object
Methods inherited from LabelledDocObject
#<=>, #comment, #commentOrLabel, #definition, #editorialNotes, #hasComment?, #hasDefinition?, #hasDifferentLabel?, #hasEditorialNotes?, #see_alsos, #status
Methods inherited from DocObject
#escaped_short_name, #escaped_uri, #get_literal, #hasOtherNamespace?, #hasUri?, #ns, #ontology, #repository, #short_name, #to_s, #uri
Constructor Details
#initialize(resource, schema, domainIndividual, rangeIndividual) ⇒ IndividualAssociation
Returns a new instance of IndividualAssociation.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/yowl/individual_association.rb', line 10 def initialize(resource, schema, domainIndividual, rangeIndividual) if resource.nil? raise "Problem" end super(resource, schema) @domainIndividual = domainIndividual @rangeIndividual = rangeIndividual @key = "#{@domainIndividual.uri},#{@rangeIndividual.uri},#{label}".hash #puts "Created IndividualAssociation #{@domainIndividual.uri},#{@rangeIndividual.uri}, #{uri}" end |
Instance Attribute Details
#domainIndividual ⇒ Object (readonly)
Returns the value of attribute domainIndividual.
5 6 7 |
# File 'lib/yowl/individual_association.rb', line 5 def domainIndividual @domainIndividual end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
8 9 10 |
# File 'lib/yowl/individual_association.rb', line 8 def key @key end |
#property ⇒ Object (readonly)
Returns the value of attribute property.
7 8 9 |
# File 'lib/yowl/individual_association.rb', line 7 def property @property end |
#rangeIndividual ⇒ Object (readonly)
Returns the value of attribute rangeIndividual.
6 7 8 |
# File 'lib/yowl/individual_association.rb', line 6 def rangeIndividual @rangeIndividual end |
Instance Method Details
#addAsGraphVizEdge(graph_, nodes_, edges_, level_) ⇒ Object
Add the current IndividualAssociation as an edge to the given GraphViz graph, but check whether the IndividualAssociation refers to a Domain and Range class in the current schema and whether the IndividualAssociation has already been added to the graph (by checking the given edges collection).
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/yowl/individual_association.rb', line 43 def addAsGraphVizEdge(graph_, nodes_, edges_, level_) if level_ < 1 return nodes_, edges_ end nodes_, edges_ = @domainIndividual.addAsGraphvizNode(graph_, nodes_, edges_, level_) nodes_, edges_ = @rangeIndividual.addAsGraphvizNode(graph_, nodes_, edges_, level_) if edges_.has_key?(@key) return nodes_, edges_ end domainIndividualNode = nodes_[@domainIndividual.uri] rangeIndividualNode = nodes_[@rangeIndividual.uri] # # As the level_ parameter for the two calls to addAsGraphvizNode might have caused # that one or both of these nodes are not generated, we have to check for this here. # if domainIndividualNode.nil? or rangeIndividualNode.nil? return nodes_, edges_ end = { :label => label.sub(/.*:/, ''), :tooltip => uri.to_s, :arrowhead => :open, :arrowsize => 0.5, :penwidth => 0.5 } edges_[@key] = graph_.add_edges(domainIndividualNode, rangeIndividualNode, ) return nodes_, edges_ end |
#eql?(other) ⇒ Boolean
33 34 35 |
# File 'lib/yowl/individual_association.rb', line 33 def eql?(other) @key.eql? other.key end |
#hash ⇒ Object
29 30 31 |
# File 'lib/yowl/individual_association.rb', line 29 def hash return key end |
#label ⇒ Object
25 26 27 |
# File 'lib/yowl/individual_association.rb', line 25 def label return short_name end |