rdf-rdfa 0.3.5.1 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README +84 -15
- data/VERSION +1 -1
- data/lib/rdf/rdfa.rb +5 -4
- data/lib/rdf/rdfa/expansion.rb +206 -0
- data/lib/rdf/rdfa/expansion/cc.rb +12 -0
- data/lib/rdf/rdfa/expansion/dc.rb +98 -0
- data/lib/rdf/rdfa/expansion/doap.rb +22 -0
- data/lib/rdf/rdfa/expansion/foaf.rb +32 -0
- data/lib/rdf/rdfa/expansion/gr.rb +37 -0
- data/lib/rdf/rdfa/expansion/schema.rb +312 -0
- data/lib/rdf/rdfa/expansion/sioc.rb +25 -0
- data/lib/rdf/rdfa/expansion/skos.rb +33 -0
- data/lib/rdf/rdfa/expansion/skosxl.rb +9 -0
- data/lib/rdf/rdfa/expansion/v.rb +23 -0
- data/lib/rdf/rdfa/reader.rb +244 -149
- data/lib/rdf/rdfa/writer.rb +37 -81
- data/lib/rdf/rdfa/writer/haml_templates.rb +6 -6
- metadata +37 -14
- data/lib/rdf/rdfa/patches/graph_properties.rb +0 -34
@@ -1,34 +0,0 @@
|
|
1
|
-
module RDF
|
2
|
-
class Graph
|
3
|
-
# Resource properties
|
4
|
-
#
|
5
|
-
# Properties arranged as a hash with the predicate Term as index to an array of resources or literals
|
6
|
-
#
|
7
|
-
# Example:
|
8
|
-
# graph.load(':foo a :bar; rdfs:label "An example" .', "http://example.com/")
|
9
|
-
# graph.resources(URI.new("http://example.com/subject")) =>
|
10
|
-
# {
|
11
|
-
# "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" => [<http://example.com/#bar>],
|
12
|
-
# "http://example.com/#label" => ["An example"]
|
13
|
-
# }
|
14
|
-
def properties(subject, recalc = false)
|
15
|
-
@properties ||= {}
|
16
|
-
@properties.delete(subject.to_s) if recalc
|
17
|
-
@properties[subject.to_s] ||= begin
|
18
|
-
hash = Hash.new
|
19
|
-
self.query(:subject => subject) do |statement|
|
20
|
-
pred = statement.predicate.to_s
|
21
|
-
|
22
|
-
hash[pred] ||= []
|
23
|
-
hash[pred] << statement.object
|
24
|
-
end
|
25
|
-
hash
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
# Get type(s) of subject, returns a list of symbols
|
30
|
-
def type_of(subject)
|
31
|
-
query(:subject => subject, :predicate => RDF.type).map {|st| st.object}
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|