Class: Ldpath::Transform

Inherits:
Parslet::Transform
  • Object
show all
Defined in:
lib/ldpath/transform.rb

Constant Summary collapse

Infinity =
1.0 / 0.0

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.default_prefixes ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/ldpath/transform.rb', line 5

def default_prefixes
  @default_prefixes ||= {
    "rdf"  => RDF::Vocabulary.new("http://www.w3.org/1999/02/22-rdf-syntax-ns#"),
    "rdfs" => RDF::Vocabulary.new("http://www.w3.org/2000/01/rdf-schema#"),
    "owl"  => RDF::Vocabulary.new("http://www.w3.org/2002/07/owl#"),
    "skos" => RDF::Vocabulary.new("http://www.w3.org/2004/02/skos/core#"),
    "dc"   => RDF::Vocabulary.new("http://purl.org/dc/elements/1.1/"),
    "xsd"  => RDF::Vocabulary.new("http://www.w3.org/2001/XMLSchema#"),#          (LMF base index datatypes/XML Schema)
    "lmf"  => RDF::Vocabulary.new("http://www.newmedialab.at/lmf/types/1.0/"),#    (LMF extended index datatypes)
    "fn"   => RDF::Vocabulary.new("http://www.newmedialab.at/lmf/functions/1.0/"),# (LMF index functions)
    "foaf" => RDF::Vocabulary.new("http://xmlns.com/foaf/0.1/"),
    "info" => RDF::Vocabulary.new("info:"),
    "urn" => RDF::Vocabulary.new("urn:"),
  }
end

Instance Method Details

#apply(obj, context = nil) ⇒ Object



22
23
24
25
26
# File 'lib/ldpath/transform.rb', line 22

def apply obj, context = nil
  context ||= { }
  context[:prefixes] ||= {}.merge(self.class.default_prefixes)
  super obj, context
end