rdfa_parser 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +8 -4
- data/VERSION +1 -1
- data/bin/rdfa_parser +6 -0
- data/lib/rdfa_parser/triple.rb +4 -2
- data/spec/literal_spec.rb +2 -2
- data/spec/triple_spec.rb +19 -0
- metadata +2 -2
data/History.txt
CHANGED
@@ -1,7 +1,11 @@
|
|
1
|
-
=== 0.1.
|
2
|
-
*
|
3
|
-
|
4
|
-
|
1
|
+
=== 0.1.2 2009-11-04
|
2
|
+
* First gem release, all XHTML1 approved test cases pass at http://rdfa.digitalbazaar.com/test-suite/
|
3
|
+
|
4
|
+
=== 0.1.2 2009-10-27
|
5
|
+
* Move most test-case logic into rdfa_helper.
|
6
|
+
* Separate approved and unreviewed tests.
|
7
|
+
* Allow for soft failure of unreviewed tests by catching Spec::Expectations::ExpectationNotMetError.
|
8
|
+
* Integrate rdfa-test-suite and create test cases in the same manner. (Causing SPARQL problems with XMLLiterals)
|
5
9
|
|
6
10
|
=== 0.1.0 2009-10-17
|
7
11
|
* First gem release, all XHTML1 approved test cases pass at http://rdfa.digitalbazaar.com/test-suite/
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.2
|
data/bin/rdfa_parser
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby -s
|
2
|
+
# For some reason, options preceeding files are ignored
|
2
3
|
require 'rubygems'
|
3
4
|
require File.expand_path(File.dirname(__FILE__) + "/../lib/rdfa_parser")
|
4
5
|
require 'getoptlong'
|
@@ -19,6 +20,7 @@ class Parse
|
|
19
20
|
puts parser.debug.join("\n\t") if $verbose
|
20
21
|
rescue RdfaParser::ParserException => e
|
21
22
|
puts "Parse failure: #{e.message}"
|
23
|
+
#puts e.backtrace
|
22
24
|
puts parser.debug if $verbose && parser
|
23
25
|
#raise
|
24
26
|
rescue Exception => e
|
@@ -33,6 +35,7 @@ base_uri = "http://example.com"
|
|
33
35
|
|
34
36
|
opts = GetoptLong.new(
|
35
37
|
["--verbose", GetoptLong::NO_ARGUMENT],
|
38
|
+
["--version", GetoptLong::NO_ARGUMENT],
|
36
39
|
["--quiet", GetoptLong::NO_ARGUMENT],
|
37
40
|
["--debug", GetoptLong::NO_ARGUMENT],
|
38
41
|
["--format", GetoptLong::REQUIRED_ARGUMENT],
|
@@ -41,6 +44,9 @@ opts = GetoptLong.new(
|
|
41
44
|
opts.each do |opt, arg|
|
42
45
|
case opt
|
43
46
|
when '--verbose' then $verbose = true
|
47
|
+
when '--version'
|
48
|
+
puts "version: #{RdfaParser::VERSION}"
|
49
|
+
exit(0)
|
44
50
|
when '--quiet' then $quiet = true
|
45
51
|
when '--debug' then $DEBUG = true
|
46
52
|
when '--format' then $format = arg
|
data/lib/rdfa_parser/triple.rb
CHANGED
@@ -84,12 +84,14 @@ module RdfaParser
|
|
84
84
|
case object
|
85
85
|
when Addressable::URI
|
86
86
|
URIRef.new(object.to_s)
|
87
|
-
when String
|
87
|
+
when String
|
88
88
|
if object.to_s =~ /\S+\/\/\S+/ # does it smell like a URI?
|
89
89
|
URIRef.new(object.to_s)
|
90
90
|
else
|
91
|
-
Literal.
|
91
|
+
Literal.untyped(object)
|
92
92
|
end
|
93
|
+
when Integer, Float
|
94
|
+
Literal.build_from(object)
|
93
95
|
when URIRef, BNode, Literal
|
94
96
|
object
|
95
97
|
else
|
data/spec/literal_spec.rb
CHANGED
@@ -24,8 +24,8 @@ describe "Literals: " do
|
|
24
24
|
subject { Literal.untyped("松本 后子") }
|
25
25
|
|
26
26
|
describe "encodings" do
|
27
|
-
it "should return n3" do subject.to_n3.should == "\
|
28
|
-
it "should return ntriples" do subject.to_ntriples.should == "\
|
27
|
+
it "should return n3" do subject.to_n3.should == '"\u677E\u672C \u540E\u5B50"' end
|
28
|
+
it "should return ntriples" do subject.to_ntriples.should == '"\u677E\u672C \u540E\u5B50"' end
|
29
29
|
it "should return xml_args" do subject.xml_args.should == ["松本 后子", {}] end
|
30
30
|
it "should return TriX" do subject.to_trix.should == "<plainLiteral>" + "松本 后子" + "</plainLiteral>" end
|
31
31
|
end
|
data/spec/triple_spec.rb
CHANGED
@@ -114,6 +114,25 @@ describe "Triples" do
|
|
114
114
|
Triple.coerce_object(ref).should == ref
|
115
115
|
end
|
116
116
|
|
117
|
+
it "should coerse a URIRef from a string" do
|
118
|
+
uri = URIRef.new("foo://bar")
|
119
|
+
Triple.coerce_object(uri.to_s).should == uri
|
120
|
+
end
|
121
|
+
|
122
|
+
it "should coerse an untyped string" do
|
123
|
+
val = "foo"
|
124
|
+
Triple.coerce_object(val).should == val
|
125
|
+
end
|
126
|
+
|
127
|
+
it "should coerse an integer" do
|
128
|
+
val = 1
|
129
|
+
Triple.coerce_object(val).should == Literal.build_from(val)
|
130
|
+
end
|
131
|
+
|
132
|
+
it "should coerse a float" do
|
133
|
+
val = 1.1
|
134
|
+
Triple.coerce_object(val).should == Literal.build_from(val)
|
135
|
+
end
|
117
136
|
end
|
118
137
|
|
119
138
|
describe "equivalence" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rdfa_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gregg Kellogg
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-11-04 00:00:00 -08:00
|
13
13
|
default_executable: rdfa_parser
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|