Class: Pho::DatatypeProperty
- Inherits:
-
Object
- Object
- Pho::DatatypeProperty
- Defined in:
- lib/pho/field_predicate_map.rb
Overview
Captures information about a mapped datatype from a Field Predicate Map
Instance Attribute Summary collapse
-
#analyzer ⇒ Object
readonly
URI of the analyzer associated with this property.
-
#name ⇒ Object
readonly
Short name for the property.
-
#property_uri ⇒ Object
readonly
RDF predicate URI for the mapped property.
-
#uri ⇒ Object
readonly
URI for this mapping.
Instance Method Summary collapse
-
#initialize(uri, property_uri, name, analyzer = nil) ⇒ DatatypeProperty
constructor
A new instance of DatatypeProperty.
-
#to_rdf(ns = true) ⇒ Object
Convert this object into an RDF representation.
Constructor Details
#initialize(uri, property_uri, name, analyzer = nil) ⇒ DatatypeProperty
Returns a new instance of DatatypeProperty.
64 65 66 67 68 69 |
# File 'lib/pho/field_predicate_map.rb', line 64 def initialize(uri, property_uri, name, analyzer=nil) @uri = uri @property_uri = property_uri @name = name @analyzer = analyzer end |
Instance Attribute Details
#analyzer ⇒ Object (readonly)
URI of the analyzer associated with this property
62 63 64 |
# File 'lib/pho/field_predicate_map.rb', line 62 def analyzer @analyzer end |
#name ⇒ Object (readonly)
Short name for the property
60 61 62 |
# File 'lib/pho/field_predicate_map.rb', line 60 def name @name end |
#property_uri ⇒ Object (readonly)
RDF predicate URI for the mapped property
58 59 60 |
# File 'lib/pho/field_predicate_map.rb', line 58 def property_uri @property_uri end |
#uri ⇒ Object (readonly)
URI for this mapping
56 57 58 |
# File 'lib/pho/field_predicate_map.rb', line 56 def uri @uri end |
Instance Method Details
#to_rdf(ns = true) ⇒ Object
Convert this object into an RDF representation. Generates a simple rdf:Description, optionally including namespaces
- ns
-
include namespace declarations
73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/pho/field_predicate_map.rb', line 73 def to_rdf(ns=true) rdf = "<rdf:Description " if ns rdf << " xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" xmlns:frm=\"#{Pho::Namespaces::FRAME}\" xmlns:bf=\"#{Pho::Namespaces::CONFIG}\" " end rdf << " rdf:about=\"#{@uri}\">" rdf << " <frm:property rdf:resource=\"#{@property_uri}\"/>" rdf << " <frm:name>#{@name}</frm:name>" if @analyzer != nil rdf << " <bf:analyzer rdf:resource=\"#{@analyzer}\" />" end rdf << "</rdf:Description>" return rdf end |