Class: Ldpath::Transform

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

Constant Summary collapse

Infinity =
1.0 / 0.0

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#prefixesObject (readonly)

Returns the value of attribute prefixes.



3
4
5
# File 'lib/ldpath/transform.rb', line 3

def prefixes
  @prefixes
end

Class Method Details

.default_prefixesObject



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

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



23
24
25
26
27
28
29
# File 'lib/ldpath/transform.rb', line 23

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