rdf_context 0.5.9.1 → 0.5.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. data/.gitignore +0 -1
  2. data/History.rdoc +23 -2
  3. data/Rakefile +17 -17
  4. data/VERSION +1 -1
  5. data/bin/rdf_context +1 -4
  6. data/lib/rdf_context.rb +55 -19
  7. data/lib/rdf_context/aggregate_graph.rb +0 -2
  8. data/lib/rdf_context/bnode.rb +14 -1
  9. data/lib/rdf_context/conjunctive_graph.rb +0 -2
  10. data/lib/rdf_context/graph.rb +9 -10
  11. data/lib/rdf_context/literal.rb +39 -56
  12. data/lib/rdf_context/n3_grammar.treetop +2 -2
  13. data/lib/rdf_context/n3parser.rb +7 -5
  14. data/lib/rdf_context/parser.rb +2 -3
  15. data/lib/rdf_context/quoted_graph.rb +0 -2
  16. data/lib/rdf_context/rdfaparser.rb +93 -68
  17. data/lib/rdf_context/rdfxmlparser.rb +1 -1
  18. data/lib/rdf_context/resource.rb +56 -0
  19. data/lib/rdf_context/serializer/abstract_serializer.rb +0 -2
  20. data/lib/rdf_context/serializer/nt_serializer.rb +0 -2
  21. data/lib/rdf_context/serializer/recursive_serializer.rb +0 -4
  22. data/lib/rdf_context/serializer/turtle_serializer.rb +0 -2
  23. data/lib/rdf_context/serializer/xml_serializer.rb +0 -2
  24. data/lib/rdf_context/store/abstract_sql_store.rb +3 -1
  25. data/lib/rdf_context/store/active_record_store.rb +272 -0
  26. data/lib/rdf_context/store/list_store.rb +2 -2
  27. data/lib/rdf_context/store/memory_store.rb +2 -2
  28. data/lib/rdf_context/store/sqlite3_store.rb +112 -48
  29. data/lib/rdf_context/term_utils.rb +0 -4
  30. data/lib/rdf_context/triple.rb +1 -3
  31. data/lib/rdf_context/uriref.rb +14 -1
  32. data/rdf_context.gemspec +872 -0
  33. data/script/tc +4 -4
  34. data/spec/active_record_store_spec.rb +61 -0
  35. data/spec/aggregate_graph_spec.rb +1 -1
  36. data/spec/bnode_spec.rb +37 -1
  37. data/spec/conjunctive_graph_spec.rb +1 -1
  38. data/spec/cwm_spec.rb +5 -5
  39. data/spec/duration_spec.rb +1 -1
  40. data/spec/graph_spec.rb +16 -2
  41. data/spec/list_store_spec.rb +1 -1
  42. data/spec/literal_spec.rb +47 -14
  43. data/spec/memory_store_spec.rb +1 -1
  44. data/spec/n3parser_spec.rb +19 -5
  45. data/spec/namespaces_spec.rb +1 -1
  46. data/spec/parser_spec.rb +1 -1
  47. data/spec/rdf_helper.rb +18 -15
  48. data/spec/rdfa_helper.rb +27 -14
  49. data/spec/rdfa_parser_spec.rb +28 -9
  50. data/spec/rdfxml_spec.rb +3 -3
  51. data/spec/spec_helper.rb +10 -5
  52. data/spec/sqlite3_store_spec.rb +1 -1
  53. data/spec/string_hacks_spec.rb +2 -1
  54. data/spec/swap_spec.rb +7 -7
  55. data/spec/swap_test/ref/contexts-1.n3 +12 -0
  56. data/spec/swap_test/ref/prefix2.rdf +33 -0
  57. data/spec/swap_test/ref/xmllit.nt +1 -1
  58. data/spec/swap_test/regression.n3 +18 -18
  59. data/spec/triple_spec.rb +1 -1
  60. data/spec/turtle_serializer_spec.rb +3 -3
  61. data/spec/turtle_spec.rb +3 -3
  62. data/spec/uriref_spec.rb +31 -1
  63. metadata +13 -15
@@ -2,7 +2,7 @@ $:.unshift "."
2
2
  require File.join(File.dirname(__FILE__), 'spec_helper')
3
3
  include RdfContext
4
4
 
5
- describe "Turtle Serializer" do
5
+ describe TurtleSerializer do
6
6
  describe "simple tests" do
7
7
  it "should use full URIs without base" do
8
8
  input = %(<http://a/b> <http://a/c> <http://a/d> .)
@@ -199,8 +199,8 @@ describe "Turtle Serializer" do
199
199
  else
200
200
  begin
201
201
  t.run_test do |rdf_string, parser|
202
- parser.parse(rdf_string, t.about.uri.to_s, :strict => true, :debug => [])
203
- parser.graph.serialize(:format => :ttl, :base => t.about.uri.to_s)
202
+ parser.parse(rdf_string, t.about, :strict => true, :debug => [])
203
+ parser.graph.serialize(:format => :ttl, :base => t.about)
204
204
  t.compare = :none
205
205
  end
206
206
  #rescue #Spec::Expectations::ExpectationNotMetError => e
@@ -2,7 +2,7 @@ $:.unshift "."
2
2
  require File.join(File.dirname(__FILE__), 'spec_helper')
3
3
  include RdfContext
4
4
 
5
- describe "N3 parser" do
5
+ describe N3Parser do
6
6
  # W3C Turtle Test suite from http://www.w3.org/2000/10/swap/test/regression.n3
7
7
  describe "w3c turtle tests" do
8
8
  require 'rdf_helper'
@@ -33,7 +33,7 @@ describe "N3 parser" do
33
33
  else
34
34
  begin
35
35
  t.run_test do |rdf_string, parser|
36
- parser.parse(rdf_string, t.about.uri.to_s, :strict => true, :debug => [])
36
+ parser.parse(rdf_string, t.about, :strict => true, :debug => [])
37
37
  t.compare = :array if parser.graph.bnodes.empty?
38
38
  end
39
39
  #rescue #Spec::Expectations::ExpectationNotMetError => e
@@ -51,7 +51,7 @@ describe "N3 parser" do
51
51
  begin
52
52
  t.run_test do |rdf_string, parser|
53
53
  lambda do
54
- parser.parse(rdf_string, t.about.uri.to_s, :strict => true, :debug => [])
54
+ parser.parse(rdf_string, t.about, :strict => true, :debug => [])
55
55
  end.should raise_error(RdfException)
56
56
  end
57
57
  rescue #Spec::Expectations::ExpectationNotMetError => e
@@ -5,7 +5,7 @@ require 'webrick'
5
5
  include WEBrick
6
6
  #require 'lib/uriref'
7
7
 
8
- describe "URI References" do
8
+ describe URIRef do
9
9
  it "should output NTriples" do
10
10
  f = URIRef.new("http://tommorris.org/foaf/")
11
11
  f.to_ntriples.should == "<http://tommorris.org/foaf/>"
@@ -47,6 +47,36 @@ describe "URI References" do
47
47
  uri2.to_s.should == "http://example.org/foo#bar"
48
48
  end
49
49
 
50
+ describe "descriminators" do
51
+ subject { URIRef.new("http://example.org/") }
52
+
53
+ it "returns false for bnode?" do
54
+ subject.should_not be_bnode
55
+ end
56
+ it "returns false for graph?" do
57
+ subject.should_not be_graph
58
+ end
59
+ it "returns false for literal?" do
60
+ subject.should_not be_literal
61
+ end
62
+ it "returns true for uri?" do
63
+ subject.should be_uri
64
+ end
65
+ end
66
+
67
+ describe ".parse" do
68
+ it "returns nil if invalid" do
69
+ URIRef.parse("foo").should be_nil
70
+ end
71
+
72
+ it "returns URIRef for 'http://example.com/'" do
73
+ URIRef.parse('http://example.com/').to_n3.should == '<http://example.com/>'
74
+ end
75
+ it "returns URIRef for '<http://example.com/>'" do
76
+ URIRef.parse('<http://example.com/>').to_n3.should == '<http://example.com/>'
77
+ end
78
+ end
79
+
50
80
  describe "short_name" do
51
81
  specify { URIRef.new("http://foo/bar").short_name.should == "bar"}
52
82
  specify { URIRef.new("http://foo").short_name.should == false}
metadata CHANGED
@@ -1,14 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdf_context
3
3
  version: !ruby/object:Gem::Version
4
- hash: 65
5
4
  prerelease: false
6
5
  segments:
7
6
  - 0
8
7
  - 5
9
- - 9
10
- - 1
11
- version: 0.5.9.1
8
+ - 10
9
+ version: 0.5.10
12
10
  platform: ruby
13
11
  authors:
14
12
  - Gregg Kellogg
@@ -16,7 +14,7 @@ autorequire:
16
14
  bindir: bin
17
15
  cert_chain: []
18
16
 
19
- date: 2010-11-04 00:00:00 -07:00
17
+ date: 2010-12-19 00:00:00 -08:00
20
18
  default_executable: rdf_context
21
19
  dependencies:
22
20
  - !ruby/object:Gem::Dependency
@@ -27,7 +25,6 @@ dependencies:
27
25
  requirements:
28
26
  - - ">="
29
27
  - !ruby/object:Gem::Version
30
- hash: 7
31
28
  segments:
32
29
  - 2
33
30
  - 2
@@ -43,7 +40,6 @@ dependencies:
43
40
  requirements:
44
41
  - - ">="
45
42
  - !ruby/object:Gem::Version
46
- hash: 7
47
43
  segments:
48
44
  - 1
49
45
  - 4
@@ -59,7 +55,6 @@ dependencies:
59
55
  requirements:
60
56
  - - ">="
61
57
  - !ruby/object:Gem::Version
62
- hash: 1
63
58
  segments:
64
59
  - 1
65
60
  - 4
@@ -75,7 +70,6 @@ dependencies:
75
70
  requirements:
76
71
  - - ">="
77
72
  - !ruby/object:Gem::Version
78
- hash: 15
79
73
  segments:
80
74
  - 2
81
75
  - 1
@@ -91,10 +85,11 @@ dependencies:
91
85
  requirements:
92
86
  - - ">="
93
87
  - !ruby/object:Gem::Version
94
- hash: 3
95
88
  segments:
89
+ - 2
90
+ - 1
96
91
  - 0
97
- version: "0"
92
+ version: 2.1.0
98
93
  type: :development
99
94
  version_requirements: *id005
100
95
  - !ruby/object:Gem::Dependency
@@ -105,7 +100,6 @@ dependencies:
105
100
  requirements:
106
101
  - - ">="
107
102
  - !ruby/object:Gem::Version
108
- hash: 3
109
103
  segments:
110
104
  - 2
111
105
  - 3
@@ -121,7 +115,6 @@ dependencies:
121
115
  requirements:
122
116
  - - ">="
123
117
  - !ruby/object:Gem::Version
124
- hash: 3
125
118
  segments:
126
119
  - 0
127
120
  version: "0"
@@ -162,6 +155,7 @@ files:
162
155
  - lib/rdf_context/quoted_graph.rb
163
156
  - lib/rdf_context/rdfaparser.rb
164
157
  - lib/rdf_context/rdfxmlparser.rb
158
+ - lib/rdf_context/resource.rb
165
159
  - lib/rdf_context/serializer/abstract_serializer.rb
166
160
  - lib/rdf_context/serializer/nt_serializer.rb
167
161
  - lib/rdf_context/serializer/recursive_serializer.rb
@@ -169,6 +163,7 @@ files:
169
163
  - lib/rdf_context/serializer/xml_serializer.rb
170
164
  - lib/rdf_context/store/abstract_sql_store.rb
171
165
  - lib/rdf_context/store/abstract_store.rb
166
+ - lib/rdf_context/store/active_record_store.rb
172
167
  - lib/rdf_context/store/list_store.rb
173
168
  - lib/rdf_context/store/memory_store.rb
174
169
  - lib/rdf_context/store/sqlite3_store.rb
@@ -176,9 +171,11 @@ files:
176
171
  - lib/rdf_context/term_utils.rb
177
172
  - lib/rdf_context/triple.rb
178
173
  - lib/rdf_context/uriref.rb
174
+ - rdf_context.gemspec
179
175
  - script/console
180
176
  - script/tc
181
177
  - spec/.gitignore
178
+ - spec/active_record_store_spec.rb
182
179
  - spec/aggregate_graph_spec.rb
183
180
  - spec/bnode_spec.rb
184
181
  - spec/conjunctive_graph_spec.rb
@@ -712,6 +709,7 @@ files:
712
709
  - spec/swap_test/ref/bnode.n3
713
710
  - spec/swap_test/ref/bnode.rdf
714
711
  - spec/swap_test/ref/colon-in-uri.n3
712
+ - spec/swap_test/ref/contexts-1.n3
715
713
  - spec/swap_test/ref/daml-ex.n3
716
714
  - spec/swap_test/ref/daml-ont.n3
717
715
  - spec/swap_test/ref/djb1a-out.n3
@@ -729,6 +727,7 @@ files:
729
727
  - spec/swap_test/ref/path1.n3
730
728
  - spec/swap_test/ref/path2.n3
731
729
  - spec/swap_test/ref/prefix1.rdf
730
+ - spec/swap_test/ref/prefix2.rdf
732
731
  - spec/swap_test/ref/prefix3.rdf
733
732
  - spec/swap_test/ref/rdf-redefine.rdf
734
733
  - spec/swap_test/ref/reluri-1.rdf
@@ -915,7 +914,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
915
914
  requirements:
916
915
  - - ">="
917
916
  - !ruby/object:Gem::Version
918
- hash: 3
919
917
  segments:
920
918
  - 0
921
919
  version: "0"
@@ -924,7 +922,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
924
922
  requirements:
925
923
  - - ">="
926
924
  - !ruby/object:Gem::Version
927
- hash: 3
928
925
  segments:
929
926
  - 0
930
927
  version: "0"
@@ -936,6 +933,7 @@ signing_key:
936
933
  specification_version: 3
937
934
  summary: RdfContext is an RDF library for Ruby supporting contextual graphs, multiple datastores and compliant RDF/XML, RDFa and N3 parsers.
938
935
  test_files:
936
+ - spec/active_record_store_spec.rb
939
937
  - spec/aggregate_graph_spec.rb
940
938
  - spec/bnode_spec.rb
941
939
  - spec/conjunctive_graph_spec.rb