rdf-trig 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/VERSION +1 -1
  2. data/lib/rdf/trig/reader.rb +6 -37
  3. metadata +19 -30
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
@@ -25,7 +25,7 @@ module RDF::TriG
25
25
  # Productions
26
26
  # [3g] graph defines the basic creation of context
27
27
  production(:graph) do |reader, phase, input, current, callback|
28
- current[:context] = nil
28
+ callback.call(:context, "graph", nil)
29
29
  end
30
30
 
31
31
  # [4g] graphIri
@@ -35,45 +35,10 @@ module RDF::TriG
35
35
  # If input contains set_graph_iri, use the returned value to set @context
36
36
  if phase == :finish
37
37
  callback.call(:trace, "graphIri", lambda {"Set graph context to #{current[:resource]}"})
38
- input[:context] = current[:resource]
38
+ callback.call(:context, "graphIri", current[:resource])
39
39
  end
40
40
  end
41
41
 
42
- # [12] object ::= IRIref | blank | literal
43
- production(:object) do |reader, phase, input, current, callback|
44
- next unless phase == :finish
45
- if input[:object_list]
46
- # Part of an rdf:List collection
47
- input[:object_list] << current[:resource]
48
- else
49
- callback.call(:trace, "object", lambda {"current: #{current.inspect}"})
50
- callback.call(:statement, "object", input[:subject], input[:predicate], current[:resource], input[:context])
51
- end
52
- end
53
-
54
- # [16] collection ::= "(" object* ")"
55
- production(:collection) do |reader, phase, input, current, callback|
56
- if phase == :start
57
- current[:object_list] = [] # Tells the object production to collect and not generate statements
58
- else
59
- # Create an RDF list
60
- bnode = reader.bnode
61
- objects = current[:object_list]
62
- list = RDF::List.new(bnode, nil, objects)
63
- list.each_statement do |statement|
64
- # Spec Confusion, referenced section "Collection" is missing from the spec.
65
- # Anicdodal evidence indicates that some expect each node to be of type rdf:list,
66
- # but existing Notation3 and Turtle tests (http://www.w3.org/2001/sw/DataAccess/df1/tests/manifest.ttl) do not.
67
- next if statement.predicate == RDF.type && statement.object == RDF.List
68
- callback.call(:statement, "collection", statement.subject, statement.predicate, statement.object, input[:context])
69
- end
70
- bnode = RDF.nil if list.empty?
71
-
72
- # Return bnode as resource
73
- input[:resource] = bnode
74
- end
75
- end
76
-
77
42
  ##
78
43
  # Iterates the given block for each RDF statement in the input.
79
44
  #
@@ -89,7 +54,11 @@ module RDF::TriG
89
54
  ) do |context, *data|
90
55
  loc = data.shift
91
56
  case context
57
+ when :context
58
+ @context = data[0]
92
59
  when :statement
60
+ data << @context if @context
61
+ debug("each_statement") {"data: #{data.inspect}, context: #{@context.inspect}"}
93
62
  add_statement(loc, RDF::Statement.from(data))
94
63
  when :trace
95
64
  debug(loc, *data)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdf-trig
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-02-06 00:00:00.000000000Z
12
+ date: 2012-05-01 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rdf
16
- requirement: &2164497940 !ruby/object:Gem::Requirement
16
+ requirement: &70113874716740 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.3.4
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2164497940
24
+ version_requirements: *70113874716740
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rdf-turtle
27
- requirement: &2164497480 !ruby/object:Gem::Requirement
27
+ requirement: &70113874716240 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.1.1
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *2164497480
35
+ version_requirements: *70113874716240
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: open-uri-cached
38
- requirement: &2164497020 !ruby/object:Gem::Requirement
38
+ requirement: &70113874715740 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: 0.0.4
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *2164497020
46
+ version_requirements: *70113874715740
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: spira
49
- requirement: &2164496560 !ruby/object:Gem::Requirement
49
+ requirement: &70113874715220 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 0.0.12
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *2164496560
57
+ version_requirements: *70113874715220
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: rspec
60
- requirement: &2164496100 !ruby/object:Gem::Requirement
60
+ requirement: &70113874714760 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 2.8.0
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *2164496100
68
+ version_requirements: *70113874714760
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rdf-isomorphic
71
- requirement: &2164495640 !ruby/object:Gem::Requirement
71
+ requirement: &70113874714260 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,21 +76,10 @@ dependencies:
76
76
  version: 0.3.4
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *2164495640
80
- - !ruby/object:Gem::Dependency
81
- name: rdf-n3
82
- requirement: &2164495180 !ruby/object:Gem::Requirement
83
- none: false
84
- requirements:
85
- - - ! '>='
86
- - !ruby/object:Gem::Version
87
- version: 0.3.5
88
- type: :development
89
- prerelease: false
90
- version_requirements: *2164495180
79
+ version_requirements: *70113874714260
91
80
  - !ruby/object:Gem::Dependency
92
81
  name: rdf-spec
93
- requirement: &2164494720 !ruby/object:Gem::Requirement
82
+ requirement: &70113874713780 !ruby/object:Gem::Requirement
94
83
  none: false
95
84
  requirements:
96
85
  - - ! '>='
@@ -98,10 +87,10 @@ dependencies:
98
87
  version: 0.3.4
99
88
  type: :development
100
89
  prerelease: false
101
- version_requirements: *2164494720
90
+ version_requirements: *70113874713780
102
91
  - !ruby/object:Gem::Dependency
103
92
  name: yard
104
- requirement: &2164494260 !ruby/object:Gem::Requirement
93
+ requirement: &70113874713280 !ruby/object:Gem::Requirement
105
94
  none: false
106
95
  requirements:
107
96
  - - ! '>='
@@ -109,7 +98,7 @@ dependencies:
109
98
  version: 0.6.0
110
99
  type: :development
111
100
  prerelease: false
112
- version_requirements: *2164494260
101
+ version_requirements: *70113874713280
113
102
  description: RDF::TriG is an TriG reader/writer for the RDF.rb library suite.
114
103
  email: public-rdf-ruby@w3.org
115
104
  executables: []
@@ -148,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
137
  version: '0'
149
138
  requirements: []
150
139
  rubyforge_project: rdf-trig
151
- rubygems_version: 1.8.10
140
+ rubygems_version: 1.8.17
152
141
  signing_key:
153
142
  specification_version: 3
154
143
  summary: TriG reader/writer for Ruby.