rdf-rdfxml 0.2.3 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdf-rdfxml
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 19
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
- - 2
8
8
  - 3
9
- version: 0.2.3
9
+ - 0
10
+ version: 0.3.0
10
11
  platform: ruby
11
12
  authors:
12
13
  - Gregg Kellogg
@@ -14,7 +15,7 @@ autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []
16
17
 
17
- date: 2010-08-31 00:00:00 -07:00
18
+ date: 2010-12-27 00:00:00 -08:00
18
19
  default_executable:
19
20
  dependencies:
20
21
  - !ruby/object:Gem::Dependency
@@ -25,11 +26,12 @@ dependencies:
25
26
  requirements:
26
27
  - - ">="
27
28
  - !ruby/object:Gem::Version
29
+ hash: 19
28
30
  segments:
29
31
  - 0
30
- - 2
31
- - 2
32
- version: 0.2.2
32
+ - 3
33
+ - 0
34
+ version: 0.3.0
33
35
  type: :runtime
34
36
  version_requirements: *id001
35
37
  - !ruby/object:Gem::Dependency
@@ -40,6 +42,7 @@ dependencies:
40
42
  requirements:
41
43
  - - ">="
42
44
  - !ruby/object:Gem::Version
45
+ hash: 29
43
46
  segments:
44
47
  - 1
45
48
  - 3
@@ -55,9 +58,12 @@ dependencies:
55
58
  requirements:
56
59
  - - ">="
57
60
  - !ruby/object:Gem::Version
61
+ hash: 11
58
62
  segments:
63
+ - 2
64
+ - 1
59
65
  - 0
60
- version: "0"
66
+ version: 2.1.0
61
67
  type: :development
62
68
  version_requirements: *id003
63
69
  - !ruby/object:Gem::Dependency
@@ -68,11 +74,10 @@ dependencies:
68
74
  requirements:
69
75
  - - ">="
70
76
  - !ruby/object:Gem::Version
77
+ hash: 3
71
78
  segments:
72
79
  - 0
73
- - 2
74
- - 2
75
- version: 0.2.2
80
+ version: "0"
76
81
  type: :development
77
82
  version_requirements: *id004
78
83
  - !ruby/object:Gem::Dependency
@@ -83,6 +88,7 @@ dependencies:
83
88
  requirements:
84
89
  - - ">="
85
90
  - !ruby/object:Gem::Version
91
+ hash: 3
86
92
  segments:
87
93
  - 0
88
94
  version: "0"
@@ -96,12 +102,13 @@ dependencies:
96
102
  requirements:
97
103
  - - ">="
98
104
  - !ruby/object:Gem::Version
105
+ hash: 3
99
106
  segments:
100
107
  - 0
101
108
  version: "0"
102
109
  type: :development
103
110
  version_requirements: *id006
104
- description: " RDF::RDFXML is an RDF/XML reader and writer for Ruby using the RDF.rb library suite.\n"
111
+ description: RDF::RDFXML is an RDF/XML reader and writer for Ruby using the RDF.rb library suite.
105
112
  email: gregg@kellogg-assoc.com
106
113
  executables: []
107
114
 
@@ -110,14 +117,14 @@ extensions: []
110
117
  extra_rdoc_files:
111
118
  - AUTHORS
112
119
  - CONTRIBUTORS
113
- - History.txt
120
+ - History.rdoc
114
121
  - README.rdoc
115
122
  files:
116
123
  - .gitignore
117
124
  - .yardopts
118
125
  - AUTHORS
119
126
  - CONTRIBUTORS
120
- - History.txt
127
+ - History.rdoc
121
128
  - README.rdoc
122
129
  - Rakefile
123
130
  - VERSION
@@ -130,9 +137,6 @@ files:
130
137
  - lib/rdf/rdfxml/patches/graph_properties.rb
131
138
  - lib/rdf/rdfxml/patches/literal_hacks.rb
132
139
  - lib/rdf/rdfxml/patches/nokogiri_hacks.rb
133
- - lib/rdf/rdfxml/patches/qname_hacks.rb
134
- - lib/rdf/rdfxml/patches/seq.rb
135
- - lib/rdf/rdfxml/patches/uri_hacks.rb
136
140
  - lib/rdf/rdfxml/reader.rb
137
141
  - lib/rdf/rdfxml/version.rb
138
142
  - lib/rdf/rdfxml/vocab.rb
@@ -508,7 +512,6 @@ files:
508
512
  - spec/reader_spec.rb
509
513
  - spec/spec.opts
510
514
  - spec/spec_helper.rb
511
- - spec/uri_spec.rb
512
515
  - spec/writer_spec.rb
513
516
  has_rdoc: true
514
517
  homepage: http://github.com/gkellogg/rdf-rdfxml
@@ -524,6 +527,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
524
527
  requirements:
525
528
  - - ">="
526
529
  - !ruby/object:Gem::Version
530
+ hash: 3
527
531
  segments:
528
532
  - 0
529
533
  version: "0"
@@ -532,6 +536,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
532
536
  requirements:
533
537
  - - ">="
534
538
  - !ruby/object:Gem::Version
539
+ hash: 3
535
540
  segments:
536
541
  - 0
537
542
  version: "0"
@@ -550,5 +555,4 @@ test_files:
550
555
  - spec/rdf_helper.rb
551
556
  - spec/reader_spec.rb
552
557
  - spec/spec_helper.rb
553
- - spec/uri_spec.rb
554
558
  - spec/writer_spec.rb
@@ -1,57 +0,0 @@
1
- module RDF
2
- class URI
3
- #unless defined?(:vocab)
4
- def vocab
5
- # Find vocabulary if not assigned
6
- return @vocab if @vocab
7
-
8
- Vocabulary.each do |vocab|
9
- return self.vocab = vocab if to_s.index(vocab.to_uri.to_s) == 0
10
- end
11
- nil
12
- end
13
-
14
- def vocab=(value)
15
- raise "Vocab #{value.inspect} is not a Vocabulary!" if value.is_a?(Array)
16
- @vocab = value
17
- end
18
-
19
- def qname
20
- @qname ||= if vocab
21
- raise "Vocab #{vocab.inspect} is not a Vocabulary!" if vocab.is_a?(Array)
22
- vocab_name = vocab.__name__.to_s.split('::').last.downcase
23
- local_name = to_s[vocab.to_uri.to_s.size..-1]
24
- vocab_name && local_name && [vocab_name.to_sym, local_name.empty? ? nil : local_name.to_sym]
25
- end
26
- end
27
- #end
28
- end
29
-
30
- class Vocabulary
31
- def self.[](property)
32
- @prop_uri ||= {}
33
- @prop_uri[property] ||= begin
34
- uri = RDF::URI.intern([to_s, property.to_s].join(''))
35
- uri.vocab = self
36
- uri
37
- end
38
- end
39
-
40
- def [](property)
41
- @prop_uri ||= {}
42
- @prop_uri[property] ||= begin
43
- uri = RDF::URI.intern([to_s, property.to_s].join(''))
44
- uri.vocab = self
45
- uri
46
- end
47
- end
48
-
49
- def to_uri
50
- @uri ||= begin
51
- uri = RDF::URI.intern(to_s)
52
- uri.vocab = self
53
- uri
54
- end
55
- end
56
- end
57
- end
@@ -1,34 +0,0 @@
1
- require 'rdf/rdfxml/patches/graph_properties'
2
- module RDF
3
- class Graph
4
- # Returns ordered rdf:_n objects or rdf:first, rdf:rest for a given subject
5
- def seq(subject)
6
- props = properties(subject)
7
- rdf_type = (props[RDF.type.to_s] || []).map {|t| t.to_s}
8
-
9
- #puts "seq; #{rdf_type} #{rdf_type - [RDF.Seq, RDF.Bag, RDF.Alt]}"
10
- if !(rdf_type - [RDF.Seq, RDF.Bag, RDF.Alt]).empty?
11
- props.keys.select {|k| k.match(/#{RDF._}(\d)$/)}.
12
- sort_by {|i| i.sub(RDF._.to_s, "").to_i}.
13
- map {|key| props[key]}.
14
- flatten
15
- elsif !self.query(:subject => subject, :predicate => RDF.first).empty?
16
- # N3-style first/rest chain
17
- list = []
18
- while subject != RDF.nil
19
- props = properties(subject)
20
- f = props[RDF.first.to_s]
21
- if f.to_s.empty? || f.first == RDF.nil
22
- subject = RDF.nil
23
- else
24
- list += f
25
- subject = props[RDF.rest.to_s].first
26
- end
27
- end
28
- list
29
- else
30
- []
31
- end
32
- end
33
- end
34
- end
@@ -1,24 +0,0 @@
1
- module RDF
2
- class URI
3
- ##
4
- # Joins several URIs together.
5
- #
6
- # @param [Array<String, URI, #to_str>] uris
7
- # @return [URI]
8
- #
9
- # GK -- don't add a "/" at the end of URIs, due to rdfcore/xmlbase/test002.rdf
10
- def join(*uris)
11
- result = @uri
12
- uris.each do |uri|
13
- result = result.join(uri)
14
- end
15
- self.class.new(result)
16
- end
17
- end
18
-
19
- class NTriples::Writer
20
- def format_uri(uri, options = {})
21
- "<%s>" % escaped(uri_for(uri))
22
- end
23
- end
24
- end
data/spec/uri_spec.rb DELETED
@@ -1,115 +0,0 @@
1
- # coding: utf-8
2
- $:.unshift "."
3
- require File.join(File.dirname(__FILE__), 'spec_helper')
4
-
5
- describe RDF::URI do
6
- class EXa < RDF::Vocabulary("http://example.org/foo/"); end
7
- class EXb < RDF::Vocabulary("http://example.org/foo#"); end
8
- class EXc < RDF::Vocabulary("http://example.org/foo"); end
9
-
10
- subject { RDF::URI.new("http://example.org")}
11
-
12
- context "join" do
13
- it "should append fragment to uri" do
14
- subject.join("foo").to_s.should == "http://example.org/foo"
15
- end
16
-
17
- it "should append another fragment" do
18
- subject.join("foo#bar").to_s.should == "http://example.org/foo#bar"
19
- end
20
-
21
- it "should append another URI" do
22
- subject.join(RDF::URI.new("foo#bar")).to_s.should == "http://example.org/foo#bar"
23
- end
24
-
25
- describe "utf-8 escaped" do
26
- {
27
- %(http://a/D%C3%BCrst) => %(<http://a/D%C3%BCrst>),
28
- %(http://a/D\u00FCrst) => %(<http://a/D\\u00FCrst>),
29
- %(http://b/Dürst) => %(<http://b/D\\u00FCrst>),
30
- %(http://a/\u{15678}another) => %(<http://a/\\U00015678another>),
31
- }.each_pair do |uri, dump|
32
- it "should dump #{uri} as #{dump}" do
33
- RDF::URI.new(uri).to_ntriples.should == dump
34
- end
35
- end
36
- end if defined?(::Encoding) # Only works properly in Ruby 1.9
37
-
38
- describe "join" do
39
- {
40
- %w(http://foo ) => "<http://foo>",
41
- %w(http://foo a) => "<http://foo/a>",
42
- %w(http://foo /a) => "<http://foo/a>",
43
- %w(http://foo #a) => "<http://foo#a>",
44
-
45
- %w(http://foo/ ) => "<http://foo/>",
46
- %w(http://foo/ a) => "<http://foo/a>",
47
- %w(http://foo/ /a) => "<http://foo/a>",
48
- %w(http://foo/ #a) => "<http://foo/#a>",
49
-
50
- %w(http://foo# ) => "<http://foo#>",
51
- %w(http://foo# a) => "<http://foo/a>",
52
- %w(http://foo# /a) => "<http://foo/a>",
53
- %w(http://foo# #a) => "<http://foo#a>",
54
-
55
- %w(http://foo/bar ) => "<http://foo/bar>",
56
- %w(http://foo/bar a) => "<http://foo/a>",
57
- %w(http://foo/bar /a) => "<http://foo/a>",
58
- %w(http://foo/bar #a) => "<http://foo/bar#a>",
59
-
60
- %w(http://foo/bar/ ) => "<http://foo/bar/>",
61
- %w(http://foo/bar/ a) => "<http://foo/bar/a>",
62
- %w(http://foo/bar/ /a) => "<http://foo/a>",
63
- %w(http://foo/bar/ #a) => "<http://foo/bar/#a>",
64
-
65
- %w(http://foo/bar# ) => "<http://foo/bar#>",
66
- %w(http://foo/bar# a) => "<http://foo/a>",
67
- %w(http://foo/bar# /a) => "<http://foo/a>",
68
- %w(http://foo/bar# #a) => "<http://foo/bar#a>",
69
-
70
- %w(http://foo/bar# #D%C3%BCrst) => "<http://foo/bar#D%C3%BCrst>",
71
- %w(http://foo/bar# #Dürst) => "<http://foo/bar#D\\u00FCrst>",
72
- }.each_pair do |input, result|
73
- it "should create <#{result}> from <#{input[0]}> and '#{input[1]}'" do
74
- RDF::URI.new(input[0]).join(input[1].to_s).to_ntriples.should == result
75
- end
76
- end
77
- end
78
- end
79
-
80
- context "qname" do
81
- it "should create [:rdf, :foo]" do
82
- RDF.foo.qname.should == [:rdf, :foo]
83
- end
84
-
85
- it "should create [:rdfs, nil]" do
86
- RDF::RDFS.to_uri.qname.should == [:rdfs, nil]
87
- end
88
-
89
- it "should find with trailing /" do
90
- EXa.bar.qname.should == [:exa, :bar]
91
- end
92
-
93
- it "should find with trailing #" do
94
- EXb.bar.qname.should == [:exb, :bar]
95
- end
96
-
97
- it "should find with trailing word" do
98
- EXc.bar.qname.should == [:exc, :bar]
99
- end
100
- end
101
-
102
- context "Invalid Formats" do
103
- it "should detect invalid URI formats" do
104
- lambda {Addressable::URI.parse("_:test")}.should raise_error(Addressable::URI::InvalidURIError)
105
- end
106
- end
107
-
108
- context "vocab" do
109
- RDF::Vocabulary.each do |v|
110
- specify {v.foo.vocab.should == v}
111
- specify {v.foo.vocab.to_uri.to_s.should == v.to_uri.to_s}
112
- specify {v.to_s.should == v.to_uri.to_s} unless v == RDF
113
- end
114
- end
115
- end