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

Instance Method Details

#expandRDF::Graph

Perform vocabulary expansion on the resulting default graph.

Vocabulary expansion relies on a sub-set of OWL OWL2-PROFILES 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.

Examples:

scm-spo
{pq rdfs:subPropertyOf pw . pw rdfs:subPropertyOf p3}
   => {p1 rdfs:subPropertyOf p3}

rdprp-spo1fs7
{p1 rdfs:subPropertyOf p2 . x p1 y} => {x p2 y}

Returns:

  • (RDF::Graph)

See Also:

  • PROFILES][]


25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/rdf/microdata/expansion.rb', line 25

def expand
  repo = RDF::Repository.new
  repo << self  # Add default graph
  
  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



39
40
41
# File 'lib/rdf/microdata/expansion.rb', line 39

def rule(name, &block)
  Rule.new(name, **@options, &block)
end