rdf_context 0.5.5 → 0.5.6
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +9 -0
- data/Rakefile +39 -0
- data/VERSION +1 -1
- data/lib/rdf_context/literal.rb +3 -1
- data/lib/rdf_context/n3_grammar.treetop +1 -1
- data/lib/rdf_context/n3parser.rb +7 -13
- data/lib/rdf_context/nokogiri_hacks.rb +1 -1
- data/lib/rdf_context/rdfaparser.rb +6 -6
- data/lib/rdf_context/rdfxmlparser.rb +9 -9
- data/lib/rdf_context/store/abstract_sql_store.rb +2 -2
- data/lib/rdf_context/triple.rb +7 -1
- data/lib/rdf_context/uriref.rb +3 -3
- data/spec/conjunctive_graph_spec.rb +1 -1
- data/spec/html4-manifest.yml +4937 -0
- data/spec/html5-manifest.yml +4937 -0
- data/spec/literal_spec.rb +1 -1
- data/spec/n3parser_spec.rb +7 -7
- data/spec/rdf_helper.rb +80 -42
- data/spec/rdfa_helper.rb +53 -20
- data/spec/rdfcore/Manifest.yml +7307 -0
- data/spec/spec_helper.rb +1 -15
- data/spec/swap_test/n3parser.yml +918 -0
- data/spec/swap_test/regression.yml +1067 -0
- data/spec/turtle/manifest-bad.yml +962 -0
- data/spec/turtle/manifest.yml +962 -0
- data/spec/uriref_spec.rb +22 -9
- data/spec/xhtml-manifest.yml +4349 -0
- data/test/rdf_tests/xml-literal-mixed.nt +1 -1
- data/test/rdf_tests/xml-literal-mixed.rdf +0 -1
- metadata +51 -10
- data/spec/swap_helper.rb +0 -136
@@ -3,4 +3,4 @@
|
|
3
3
|
<html:b xmlns:html="http://www.w3.org/1999/xhtml" html:a="b">bar<rdf:Thing xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><a:b xmlns:a="foo:"></a:b>here<a:c xmlns:a="foo:"></a:c></rdf:Thing></html:b>
|
4
4
|
baz
|
5
5
|
<html:i xmlns:html="http://www.w3.org/1999/xhtml">more</html:i>
|
6
|
-
|
6
|
+
"""^^rdf:XMLLiteral .
|
@@ -9,7 +9,6 @@
|
|
9
9
|
<html:b xmlns:html="http://www.w3.org/1999/xhtml" html:a="b">bar<rdf:Thing xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><a:b xmlns:a="foo:"></a:b>here<a:c xmlns:a="foo:"></a:c></rdf:Thing></html:b>
|
10
10
|
baz
|
11
11
|
<html:i xmlns:html="http://www.w3.org/1999/xhtml">more</html:i>
|
12
|
-
|
13
12
|
</title>
|
14
13
|
</rdf:Description>
|
15
14
|
</rdf:RDF>
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rdf_context
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 7
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 5
|
8
|
-
-
|
9
|
-
version: 0.5.
|
9
|
+
- 6
|
10
|
+
version: 0.5.6
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Gregg Kellogg
|
@@ -14,16 +15,18 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2010-
|
18
|
+
date: 2010-06-30 00:00:00 -07:00
|
18
19
|
default_executable: rdf_context
|
19
20
|
dependencies:
|
20
21
|
- !ruby/object:Gem::Dependency
|
21
22
|
name: addressable
|
22
23
|
prerelease: false
|
23
24
|
requirement: &id001 !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
24
26
|
requirements:
|
25
27
|
- - ">="
|
26
28
|
- !ruby/object:Gem::Version
|
29
|
+
hash: 15
|
27
30
|
segments:
|
28
31
|
- 2
|
29
32
|
- 0
|
@@ -35,9 +38,11 @@ dependencies:
|
|
35
38
|
name: treetop
|
36
39
|
prerelease: false
|
37
40
|
requirement: &id002 !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
38
42
|
requirements:
|
39
43
|
- - ">="
|
40
44
|
- !ruby/object:Gem::Version
|
45
|
+
hash: 7
|
41
46
|
segments:
|
42
47
|
- 1
|
43
48
|
- 4
|
@@ -49,9 +54,11 @@ dependencies:
|
|
49
54
|
name: whatlanguage
|
50
55
|
prerelease: false
|
51
56
|
requirement: &id003 !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
52
58
|
requirements:
|
53
59
|
- - ">="
|
54
60
|
- !ruby/object:Gem::Version
|
61
|
+
hash: 23
|
55
62
|
segments:
|
56
63
|
- 1
|
57
64
|
- 0
|
@@ -63,9 +70,11 @@ dependencies:
|
|
63
70
|
name: nokogiri
|
64
71
|
prerelease: false
|
65
72
|
requirement: &id004 !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
66
74
|
requirements:
|
67
75
|
- - ">="
|
68
76
|
- !ruby/object:Gem::Version
|
77
|
+
hash: 29
|
69
78
|
segments:
|
70
79
|
- 1
|
71
80
|
- 3
|
@@ -77,9 +86,11 @@ dependencies:
|
|
77
86
|
name: builder
|
78
87
|
prerelease: false
|
79
88
|
requirement: &id005 !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
80
90
|
requirements:
|
81
91
|
- - ">="
|
82
92
|
- !ruby/object:Gem::Version
|
93
|
+
hash: 15
|
83
94
|
segments:
|
84
95
|
- 2
|
85
96
|
- 1
|
@@ -88,31 +99,51 @@ dependencies:
|
|
88
99
|
type: :runtime
|
89
100
|
version_requirements: *id005
|
90
101
|
- !ruby/object:Gem::Dependency
|
91
|
-
name:
|
102
|
+
name: patron
|
92
103
|
prerelease: false
|
93
104
|
requirement: &id006 !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ">="
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
hash: 3
|
110
|
+
segments:
|
111
|
+
- 0
|
112
|
+
- 4
|
113
|
+
- 6
|
114
|
+
version: 0.4.6
|
115
|
+
type: :runtime
|
116
|
+
version_requirements: *id006
|
117
|
+
- !ruby/object:Gem::Dependency
|
118
|
+
name: rspec
|
119
|
+
prerelease: false
|
120
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
94
122
|
requirements:
|
95
123
|
- - ">="
|
96
124
|
- !ruby/object:Gem::Version
|
125
|
+
hash: 3
|
97
126
|
segments:
|
98
127
|
- 0
|
99
128
|
version: "0"
|
100
129
|
type: :development
|
101
|
-
version_requirements: *
|
130
|
+
version_requirements: *id007
|
102
131
|
- !ruby/object:Gem::Dependency
|
103
132
|
name: activesupport
|
104
133
|
prerelease: false
|
105
|
-
requirement: &
|
134
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
135
|
+
none: false
|
106
136
|
requirements:
|
107
137
|
- - ">="
|
108
138
|
- !ruby/object:Gem::Version
|
139
|
+
hash: 3
|
109
140
|
segments:
|
110
141
|
- 2
|
111
142
|
- 3
|
112
143
|
- 0
|
113
144
|
version: 2.3.0
|
114
145
|
type: :development
|
115
|
-
version_requirements: *
|
146
|
+
version_requirements: *id008
|
116
147
|
description: " RdfContext parses RDF/XML, RDFa and N3-rdf into a Graph object. It also serializes RDF/XML and N-Triples from the Graph.\n\n * Fully compliant RDF/XML parser.\n * Fully compliant XHTML/RDFa 1.0 parser.\n * N3-rdf parser\n * N-Triples and RDF/XML serializer\n * Graph serializes into RDF/XML and N-Triples.\n * ConjunctiveGraph, named Graphs and contextual storage modules.\n \n Install with 'gem install rdf_context'\n"
|
117
148
|
email: gregg@kellogg-assoc.com
|
118
149
|
executables:
|
@@ -170,6 +201,8 @@ files:
|
|
170
201
|
- spec/cwm_spec.rb
|
171
202
|
- spec/duration_spec.rb
|
172
203
|
- spec/graph_spec.rb
|
204
|
+
- spec/html4-manifest.yml
|
205
|
+
- spec/html5-manifest.yml
|
173
206
|
- spec/list_store_spec.rb
|
174
207
|
- spec/literal_spec.rb
|
175
208
|
- spec/matchers.rb
|
@@ -295,6 +328,7 @@ files:
|
|
295
328
|
- spec/rdfa_helper.rb
|
296
329
|
- spec/rdfa_parser_spec.rb
|
297
330
|
- spec/rdfcore/Manifest.rdf
|
331
|
+
- spec/rdfcore/Manifest.yml
|
298
332
|
- spec/rdfcore/amp-in-url/test001.nt
|
299
333
|
- spec/rdfcore/amp-in-url/test001.rdf
|
300
334
|
- spec/rdfcore/datatypes-intensional/test001.nt
|
@@ -652,7 +686,6 @@ files:
|
|
652
686
|
- spec/sqlite3_store_spec.rb
|
653
687
|
- spec/store_helper.rb
|
654
688
|
- spec/string_hacks_spec.rb
|
655
|
-
- spec/swap_helper.rb
|
656
689
|
- spec/swap_spec.rb
|
657
690
|
- spec/swap_test/animal.rdf
|
658
691
|
- spec/swap_test/anon-prop.n3
|
@@ -685,6 +718,7 @@ files:
|
|
685
718
|
- spec/swap_test/n3/n3parser.tests_n3_10019.nt
|
686
719
|
- spec/swap_test/n3/n3parser.tests_n3_10020.nt
|
687
720
|
- spec/swap_test/n3parser.tests
|
721
|
+
- spec/swap_test/n3parser.yml
|
688
722
|
- spec/swap_test/nodeID/classes.n3
|
689
723
|
- spec/swap_test/nodeID/classes.ref.rdf
|
690
724
|
- spec/swap_test/nodeID/ex1.rdf
|
@@ -724,6 +758,7 @@ files:
|
|
724
758
|
- spec/swap_test/ref/xml-syntax-basic-serialization.rdf
|
725
759
|
- spec/swap_test/ref/xmllit.nt
|
726
760
|
- spec/swap_test/regression.n3
|
761
|
+
- spec/swap_test/regression.yml
|
727
762
|
- spec/swap_test/reluri-1.n3
|
728
763
|
- spec/swap_test/strquot.n3
|
729
764
|
- spec/swap_test/syntax/colon-in-uri.rdf
|
@@ -778,7 +813,9 @@ files:
|
|
778
813
|
- spec/turtle/bad-13.ttl
|
779
814
|
- spec/turtle/bad-14.ttl
|
780
815
|
- spec/turtle/manifest-bad.ttl
|
816
|
+
- spec/turtle/manifest-bad.yml
|
781
817
|
- spec/turtle/manifest.ttl
|
818
|
+
- spec/turtle/manifest.yml
|
782
819
|
- spec/turtle/rdf-schema.out
|
783
820
|
- spec/turtle/rdf-schema.ttl
|
784
821
|
- spec/turtle/rdfq-results.out
|
@@ -851,6 +888,7 @@ files:
|
|
851
888
|
- spec/turtle_serializer_spec.rb
|
852
889
|
- spec/turtle_spec.rb
|
853
890
|
- spec/uriref_spec.rb
|
891
|
+
- spec/xhtml-manifest.yml
|
854
892
|
- spec/xml_serializer_spec.rb
|
855
893
|
- test/longtests_spec.rb
|
856
894
|
- test/n3_tests/lcsh/sh85062913.n3
|
@@ -894,23 +932,27 @@ rdoc_options:
|
|
894
932
|
require_paths:
|
895
933
|
- lib
|
896
934
|
required_ruby_version: !ruby/object:Gem::Requirement
|
935
|
+
none: false
|
897
936
|
requirements:
|
898
937
|
- - ">="
|
899
938
|
- !ruby/object:Gem::Version
|
939
|
+
hash: 3
|
900
940
|
segments:
|
901
941
|
- 0
|
902
942
|
version: "0"
|
903
943
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
944
|
+
none: false
|
904
945
|
requirements:
|
905
946
|
- - ">="
|
906
947
|
- !ruby/object:Gem::Version
|
948
|
+
hash: 3
|
907
949
|
segments:
|
908
950
|
- 0
|
909
951
|
version: "0"
|
910
952
|
requirements: []
|
911
953
|
|
912
954
|
rubyforge_project:
|
913
|
-
rubygems_version: 1.3.
|
955
|
+
rubygems_version: 1.3.7
|
914
956
|
signing_key:
|
915
957
|
specification_version: 3
|
916
958
|
summary: RdfContext is an RDF library for Ruby supporting contextual graphs, multiple datastores and compliant RDF/XML, RDFa and N3 parsers.
|
@@ -937,7 +979,6 @@ test_files:
|
|
937
979
|
- spec/sqlite3_store_spec.rb
|
938
980
|
- spec/store_helper.rb
|
939
981
|
- spec/string_hacks_spec.rb
|
940
|
-
- spec/swap_helper.rb
|
941
982
|
- spec/swap_spec.rb
|
942
983
|
- spec/triple_spec.rb
|
943
984
|
- spec/turtle_serializer_spec.rb
|
data/spec/swap_helper.rb
DELETED
@@ -1,136 +0,0 @@
|
|
1
|
-
require 'matchers'
|
2
|
-
|
3
|
-
module SWAPHelper
|
4
|
-
# Class representing test cases in format http://www.w3.org/2000/10/rdf-tests/rdfcore/testSchema#
|
5
|
-
class TestCase
|
6
|
-
include Matchers
|
7
|
-
|
8
|
-
TEST_DIR = File.join(File.dirname(__FILE__), 'swap_test')
|
9
|
-
|
10
|
-
attr_accessor :about
|
11
|
-
attr_accessor :approval
|
12
|
-
attr_accessor :conclusionDocument
|
13
|
-
attr_accessor :data
|
14
|
-
attr_accessor :description
|
15
|
-
attr_accessor :discussion
|
16
|
-
attr_accessor :document
|
17
|
-
attr_accessor :entailmentRules
|
18
|
-
attr_accessor :inputDocument
|
19
|
-
attr_accessor :issue
|
20
|
-
attr_accessor :name
|
21
|
-
attr_accessor :outputDocument
|
22
|
-
attr_accessor :premiseDocument
|
23
|
-
attr_accessor :rdf_type
|
24
|
-
attr_accessor :status
|
25
|
-
attr_accessor :warning
|
26
|
-
attr_accessor :parser
|
27
|
-
|
28
|
-
@@test_cases = []
|
29
|
-
|
30
|
-
def initialize(triples)
|
31
|
-
triples.each do |statement|
|
32
|
-
next if statement.subject.is_a?(BNode)
|
33
|
-
# self.about ||= statement.subject
|
34
|
-
# self.name ||= statement.subject.short_name
|
35
|
-
|
36
|
-
if statement.is_type?
|
37
|
-
self.rdf_type = statement.object.short_name
|
38
|
-
elsif statement.predicate.short_name =~ /Document\Z/i
|
39
|
-
#puts "#{statement.predicate.short_name}: #{statement.object.inspect}"
|
40
|
-
self.send("#{statement.predicate.short_name}=", statement.object.to_s.sub(/^.*swap\/test/, TEST_DIR))
|
41
|
-
if statement.predicate.short_name == "inputDocument"
|
42
|
-
self.about ||= statement.object
|
43
|
-
self.name ||= statement.object.short_name
|
44
|
-
end
|
45
|
-
elsif self.respond_to?("#{statement.predicate.short_name}=")
|
46
|
-
self.send("#{statement.predicate.short_name}=", statement.object.to_s)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
def inspect
|
52
|
-
"[Test Case " + %w(
|
53
|
-
about
|
54
|
-
name
|
55
|
-
inputDocument
|
56
|
-
outputDocument
|
57
|
-
issue
|
58
|
-
status
|
59
|
-
approval
|
60
|
-
description
|
61
|
-
discussion
|
62
|
-
issue
|
63
|
-
warning
|
64
|
-
).map {|a| v = self.send(a); "#{a}='#{v}'" if v}.compact.join(", ") +
|
65
|
-
"]"
|
66
|
-
end
|
67
|
-
|
68
|
-
def compare; :graph; end
|
69
|
-
|
70
|
-
# Read in file, and apply modifications reference either .html or .xhtml
|
71
|
-
def input
|
72
|
-
File.read(inputDocument)
|
73
|
-
end
|
74
|
-
|
75
|
-
def output
|
76
|
-
outputDocument && File.read(outputDocument)
|
77
|
-
end
|
78
|
-
|
79
|
-
# Run test case, yields input for parser to create triples
|
80
|
-
def run_test
|
81
|
-
rdf_string = input
|
82
|
-
|
83
|
-
# Run
|
84
|
-
@parser = RdfXmlParser.new
|
85
|
-
yield(rdf_string, @parser)
|
86
|
-
|
87
|
-
@parser.graph.should be_equivalent_graph(output, self) if output
|
88
|
-
end
|
89
|
-
|
90
|
-
def trace
|
91
|
-
@parser.debug.to_a.join("\n")
|
92
|
-
end
|
93
|
-
|
94
|
-
def self.parse_test_cases
|
95
|
-
return unless @@test_cases.empty?
|
96
|
-
|
97
|
-
@@positive_parser_tests = []
|
98
|
-
@@negative_parser_tests = []
|
99
|
-
@@positive_entailment_tests = []
|
100
|
-
@@negative_entailment_tests = []
|
101
|
-
|
102
|
-
manifest = File.read(File.join(TEST_DIR, "n3parser.tests"))
|
103
|
-
parser = Parser.new
|
104
|
-
begin
|
105
|
-
parser.parse(manifest, "http://www.w3.org/2000/10/swap/test/n3parser.tests")
|
106
|
-
rescue
|
107
|
-
raise "Parse error: #{$!}\n\t#{parser.debug.join("\t\n")}\n\n"
|
108
|
-
end
|
109
|
-
graph = parser.graph
|
110
|
-
|
111
|
-
# Group by subject
|
112
|
-
test_hash = graph.triples.inject({}) do |hash, st|
|
113
|
-
a = hash[st.subject] ||= []
|
114
|
-
a << st
|
115
|
-
hash
|
116
|
-
end
|
117
|
-
|
118
|
-
@@test_cases = test_hash.values.map {|statements| TestCase.new(statements)}.compact.sort_by{|t| t.about.is_a?(URIRef) ? t.about.uri.to_s : "zzz"}
|
119
|
-
|
120
|
-
@@test_cases.each do |tc|
|
121
|
-
next unless tc.status == "APPROVED"
|
122
|
-
case tc.rdf_type
|
123
|
-
when "PositiveParserTest" then @@positive_parser_tests << tc
|
124
|
-
when "NegativeParserTest" then @@negative_parser_tests << tc
|
125
|
-
when "PositiveEntailmentTest" then @@positive_entailment_tests << tc
|
126
|
-
when "NegativeEntailmentTest" then @@negative_entailment_tests << tc
|
127
|
-
end
|
128
|
-
end
|
129
|
-
end
|
130
|
-
def self.test_cases; parse_test_cases; @@test_cases; end
|
131
|
-
def self.positive_parser_tests; parse_test_cases; @@positive_parser_tests; end
|
132
|
-
def self.negative_parser_tests; parse_test_cases; @@negative_parser_tests; end
|
133
|
-
def self.positive_entailment_tests; parse_test_cases; @@positive_entailment_tests; end
|
134
|
-
def self.negative_entailment_tests; parse_test_cases; @@negative_entailment_tests; end
|
135
|
-
end
|
136
|
-
end
|