Class: Graffiti::RdfPropertyMap
- Inherits:
-
Object
- Object
- Graffiti::RdfPropertyMap
- Defined in:
- lib/graffiti/rdf_property_map.rb
Overview
Map of an internal RDF property into relational storage
Instance Attribute Summary collapse
-
#field ⇒ Object
readonly
name of the field into which the property is mapped.
-
#property ⇒ Object
readonly
expanded uriref of the mapped property.
-
#subproperty_of ⇒ Object
expanded uriref of the property which this property is a subproperty of.
-
#superproperty ⇒ Object
writeonly
Sets the attribute superproperty.
-
#table ⇒ Object
readonly
name of the table into which the property is mapped (property domain is an internal resource class mapped into this table).
-
#transitive_closure ⇒ Object
name of transitive closure table for a transitive property.
Class Method Summary collapse
-
.qualifier_field(field, type = 'subproperty') ⇒ Object
special qualifier field.
-
.qualifier_property(property, type = 'subproperty') ⇒ Object
special qualifier map.
Instance Method Summary collapse
-
#initialize(property, table, field) ⇒ RdfPropertyMap
constructor
A new instance of RdfPropertyMap.
-
#superproperty? ⇒ Boolean
set to
trueif this property has subproperties.
Constructor Details
#initialize(property, table, field) ⇒ RdfPropertyMap
Returns a new instance of RdfPropertyMap.
36 37 38 39 40 41 |
# File 'lib/graffiti/rdf_property_map.rb', line 36 def initialize(property, table, field) # fixme: support ambiguous mappings @property = property @table = table @field = field end |
Instance Attribute Details
#field ⇒ Object (readonly)
name of the field into which the property is mapped
if property range is not a literal, the field is a reference to the resource table
57 58 59 |
# File 'lib/graffiti/rdf_property_map.rb', line 57 def field @field end |
#property ⇒ Object (readonly)
expanded uriref of the mapped property
45 46 47 |
# File 'lib/graffiti/rdf_property_map.rb', line 45 def property @property end |
#subproperty_of ⇒ Object
expanded uriref of the property which this property is a subproperty of
if set, this property maps into the same table and field as its superproperty, and is qualified by an additional field named <field>_subproperty which refers to a uriref resource holding uriref of this subproperty
66 67 68 |
# File 'lib/graffiti/rdf_property_map.rb', line 66 def subproperty_of @subproperty_of end |
#superproperty=(value) ⇒ Object (writeonly)
Sets the attribute superproperty
68 69 70 |
# File 'lib/graffiti/rdf_property_map.rb', line 68 def superproperty=(value) @superproperty = value end |
#table ⇒ Object (readonly)
name of the table into which the property is mapped (property domain is an internal resource class mapped into this table)
50 51 52 |
# File 'lib/graffiti/rdf_property_map.rb', line 50 def table @table end |
#transitive_closure ⇒ Object
name of transitive closure table for a transitive property
the format of a transitive closure table is:
- 'resource' field refers to the subject resource id
- '<field>' property field and '<field>_subproperty' qualifier field (in
case of subproperty) have the same name as in the main table
- 'distance' field holds the distance from subject to object in the RDF
graph
the transitive closure table is automatically updated by a trigger on every update of the main table
89 90 91 |
# File 'lib/graffiti/rdf_property_map.rb', line 89 def transitive_closure @transitive_closure end |
Class Method Details
.qualifier_field(field, type = 'subproperty') ⇒ Object
special qualifier field
32 33 34 |
# File 'lib/graffiti/rdf_property_map.rb', line 32 def RdfPropertyMap.qualifier_field(field, type = 'subproperty') field + '_' + type end |
.qualifier_property(property, type = 'subproperty') ⇒ Object
special qualifier map
‘ ’ is added to the property name to make sure it can’t clash with any valid property uriref
26 27 28 |
# File 'lib/graffiti/rdf_property_map.rb', line 26 def RdfPropertyMap.qualifier_property(property, type = 'subproperty') property + ' ' + type end |
Instance Method Details
#superproperty? ⇒ Boolean
set to true if this property has subproperties
72 73 74 |
# File 'lib/graffiti/rdf_property_map.rb', line 72 def superproperty? @superproperty or false end |