Module: RDF::Microdata::Expansion
- Included in:
- Reader
- Defined in:
- lib/rdf/microdata/expansion.rb
Overview
The Expansion module performs a subset of OWL entailment rules on the base class, which implementes RDF::Readable.
Defined Under Namespace
Classes: Rule
Instance Method Summary collapse
-
#expand ⇒ RDF::Graph
Perform vocabulary expansion on the resulting default graph.
- #rule(name, &block) ⇒ Object
Instance Method Details
#expand ⇒ RDF::Graph
Perform vocabulary expansion on the resulting default graph.
Vocabulary expansion relies on a sub-set of OWL [OWL2-PROFILES](http://www.w3.org/TR/2009/REC-owl2-profiles-20091027/#Reasoning_in_OWL_2_RL_and_RDF_Graphs_using_Rules) entailment to add triples to the default graph based on rules and property/class relationships described in referenced vocabularies.
For all objects that are the target of an rdfa:usesVocabulary property, load the IRI into a repository.
Subsequently, perform OWL expansion using rules prp-spo1, prp-eqp1, and prp-eqp2 placing resulting triples into the default graph. Iterate on this step until no more triples are added.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/rdf/microdata/expansion.rb', line 25 def repo = RDF::Repository.new repo << self # Add default graph count = repo.count log_debug("expand") {"Loaded #{repo.size} triples into default graph"} repo = owl_entailment(repo) # Return graph with default graph graph = RDF::Graph.new repo.statements.each {|st| graph << st} graph end |
#rule(name, &block) ⇒ Object
40 41 42 |
# File 'lib/rdf/microdata/expansion.rb', line 40 def rule(name, &block) Rule.new(name, , block) end |