Module: ActiveTriples::RDFSource::ClassMethods
- Defined in:
- lib/active_triples/rdf_source.rb
Instance Method Summary collapse
-
#apply_schema(schema, strategy = ActiveTriples::ExtensionStrategy) ⇒ Object
Apply a predicate mapping using a given strategy.
-
#from_uri(uri, vals = nil) ⇒ ActiveTriples::Entity
Adapter for a consistent interface for creating a new Resource from a URI.
-
#id_persisted?(test_id) ⇒ TrueClass, FalseClass
Test if the rdf_subject that would be generated using a specific ID is already in use in the triplestore.
-
#uri_persisted?(test_uri) ⇒ TrueClass, FalseClass
Test if the rdf_subject that would be generated using a specific URI is already in use in the triplestore.
Instance Method Details
#apply_schema(schema, strategy = ActiveTriples::ExtensionStrategy) ⇒ Object
Apply a predicate mapping using a given strategy.
566 567 568 569 570 |
# File 'lib/active_triples/rdf_source.rb', line 566 def apply_schema(schema, strategy=ActiveTriples::ExtensionStrategy) schema.properties.each do |property| strategy.apply(self, property) end end |
#from_uri(uri, vals = nil) ⇒ ActiveTriples::Entity
Adapter for a consistent interface for creating a new Resource from a URI. Similar functionality should exist in all objects which can become a Resource.
556 557 558 |
# File 'lib/active_triples/rdf_source.rb', line 556 def from_uri(uri, vals = nil) new(uri, vals) end |
#id_persisted?(test_id) ⇒ TrueClass, FalseClass
Test if the rdf_subject that would be generated using a specific ID is already in use in the triplestore.
583 584 585 586 |
# File 'lib/active_triples/rdf_source.rb', line 583 def id_persisted?(test_id) rdf_subject = self.new(test_id).rdf_subject ActiveTriples::Repositories.has_subject?(rdf_subject) end |
#uri_persisted?(test_uri) ⇒ TrueClass, FalseClass
Test if the rdf_subject that would be generated using a specific URI is already in use in the triplestore.
599 600 601 602 |
# File 'lib/active_triples/rdf_source.rb', line 599 def uri_persisted?(test_uri) rdf_subject = test_uri.kind_of?(RDF::URI) ? test_uri : RDF::URI(test_uri) ActiveTriples::Repositories.has_subject?(rdf_subject) end |