rdf-rdfa 0.3.16 → 0.3.17

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.3.16
1
+ 0.3.17
@@ -9,19 +9,19 @@ module RDF::RDFa
9
9
  # or to load into, if no such graph exists
10
10
  class Context
11
11
  # Prefix mappings defined in this context
12
- # @return [Hash{Symbol => RDF::URI}]
12
+ # @attr_reader [Hash{Symbol => RDF::URI}]
13
13
  attr_reader :prefixes
14
14
 
15
15
  # Term mappings defined in this context
16
- # @return [Hash{Symbol => RDF::URI}]
16
+ # @attr_reader [Hash{Symbol => RDF::URI}]
17
17
  attr_reader :terms
18
18
 
19
19
  # Default URI defined for this vocabulary
20
- # @return [RDF::URI]
20
+ # @attr_reader [RDF::URI]
21
21
  attr_reader :vocabulary
22
22
 
23
23
  # URI defining this context
24
- # @return [RDF::URI]
24
+ # @attr_reader [RDF::URI]
25
25
  attr_reader :uri
26
26
 
27
27
  ##
@@ -89,13 +89,13 @@ module RDF::RDFa
89
89
  # Takes a list of antecedent patterns used to find solutions against a queryable
90
90
  # object. Yields each consequent with bindings from the solution
91
91
  class Rule
92
- # @attr [Array<RDF::Query::Pattern>]
92
+ # @attr_reader [Array<RDF::Query::Pattern>]
93
93
  attr_reader :antecedents
94
94
 
95
- # @attr [Array<RDF::Query::Pattern>]
95
+ # @attr_reader [Array<RDF::Query::Pattern>]
96
96
  attr_reader :consequents
97
97
 
98
- # @attr [String] name
98
+ # @attr_reader [String] name
99
99
  attr_reader :name
100
100
 
101
101
  ##
@@ -80,11 +80,11 @@ module RDF::RDFa
80
80
  Regexp::EXTENDED)
81
81
 
82
82
  # Host language
83
- # @attr [:xml, :xhtml1, :xhtml5, :html4, :html5, :svg]
83
+ # @attr_reader [:xml, :xhtml1, :xhtml5, :html4, :html5, :svg]
84
84
  attr_reader :host_language
85
85
 
86
86
  # Version
87
- # @attr [:"rdfa1.0", :"rdfa1.1"]
87
+ # @attr_reader [:"rdfa1.0", :"rdfa1.1"]
88
88
  attr_reader :version
89
89
 
90
90
  # The Recursive Baggage
@@ -98,8 +98,8 @@ module RDF::RDFa
98
98
  # such as the (X)HTML base element. The important thing is that it establishes
99
99
  # a URL against which relative paths can be resolved.
100
100
  #
101
- # @attr [RDF::URI]
102
- attr :base, true
101
+ # @attr_accessor [RDF::URI]
102
+ attr_accessor :base
103
103
 
104
104
  ##
105
105
  # The parent subject.
@@ -107,8 +107,8 @@ module RDF::RDFa
107
107
  # The initial value will be the same as the initial value of base,
108
108
  # but it will usually change during the course of processing.
109
109
  #
110
- # @attr [RDF::URI]
111
- attr :parent_subject, true
110
+ # @attr_accessor [RDF::URI]
111
+ attr_accessor :parent_subject
112
112
 
113
113
  ##
114
114
  # The parent object.
@@ -120,21 +120,21 @@ module RDF::RDFa
120
120
  # This means that the bnode must be set in the containing statement and passed down,
121
121
  # and this property is used to convey this value.
122
122
  #
123
- # @attr [RDF::URI]
124
- attr :parent_object, true
123
+ # @attr_accessor [RDF::URI]
124
+ attr_accessor :parent_object
125
125
 
126
126
  ##
127
127
  # A list of current, in-scope URI mappings.
128
128
  #
129
- # @attr [Hash{Symbol => String}]
130
- attr :uri_mappings, true
129
+ # @attr_accessor [Hash{Symbol => String}]
130
+ attr_accessor :uri_mappings
131
131
 
132
132
  ##
133
133
  # A list of current, in-scope Namespaces. This is the subset of uri_mappings
134
134
  # which are defined using xmlns.
135
135
  #
136
- # @attr [Hash{String => Namespace}]
137
- attr :namespaces, true
136
+ # @attr_accessor [Hash{String => Namespace}]
137
+ attr_accessor :namespaces
138
138
 
139
139
  ##
140
140
  # A list of incomplete triples.
@@ -144,14 +144,14 @@ module RDF::RDFa
144
144
  # The triples can be completed when a resource becomes available,
145
145
  # which will be when the next subject is specified (part of the process called chaining).
146
146
  #
147
- # @attr [Array<Array<RDF::URI, RDF::Resource>>]
148
- attr :incomplete_triples, true
147
+ # @attr_accessor [Array<Array<RDF::URI, RDF::Resource>>]
148
+ attr_accessor :incomplete_triples
149
149
 
150
150
  ##
151
151
  # The language. Note that there is no default language.
152
152
  #
153
- # @attr [Symbol]
154
- attr :language, true
153
+ # @attr_accessor [Symbol]
154
+ attr_accessor :language
155
155
 
156
156
  ##
157
157
  # The term mappings, a list of terms and their associated URIs.
@@ -160,8 +160,8 @@ module RDF::RDFa
160
160
  # Host Languages may define an initial list.
161
161
  # If a Host Language provides an initial list, it should do so via an RDFa Context document.
162
162
  #
163
- # @attr [Hash{Symbol => RDF::URI}]
164
- attr :term_mappings, true
163
+ # @attr_accessor [Hash{Symbol => RDF::URI}]
164
+ attr_accessor :term_mappings
165
165
 
166
166
  ##
167
167
  # The default vocabulary
@@ -170,15 +170,15 @@ module RDF::RDFa
170
170
  # This specification does not define an initial setting for the default vocabulary.
171
171
  # Host Languages may define an initial setting.
172
172
  #
173
- # @attr [RDF::URI]
174
- attr :default_vocabulary, true
173
+ # @attr_accessor [RDF::URI]
174
+ attr_accessor :default_vocabulary
175
175
 
176
176
  ##
177
177
  # lists
178
178
  #
179
179
  # A hash associating lists with properties.
180
- # @attr [Hash{RDF::URI => Array<RDF::Resource>}]
181
- attr :list_mapping, true
180
+ # @attr_accessor [Hash{RDF::URI => Array<RDF::Resource>}]
181
+ attr_accessor :list_mapping
182
182
 
183
183
  # @param [RDF::URI] base
184
184
  # @param [Hash] host_defaults
@@ -568,7 +568,7 @@ module RDF::RDFa
568
568
  end
569
569
  end
570
570
 
571
- # Extract the XMLNS mappings from an element
571
+ # Extract the prefix mappings from an element
572
572
  def extract_mappings(element, uri_mappings, namespaces)
573
573
  # look for xmlns
574
574
  # (note, this may be dependent on @host_language)
@@ -600,6 +600,9 @@ module RDF::RDFa
600
600
  # Downcase prefix for RDFa 1.1
601
601
  pfx_lc = (@version == :"rdfa1.0" || prefix.nil?) ? prefix : prefix.downcase
602
602
  if prefix
603
+ if uri_mappings.fetch(pfx_lc.to_sym, href) != href
604
+ add_warning(element, "Redefining prefix #{pfx_lc}: from <#{uri_mappings[pfx_lc]}> to <#{href}>", RDF::RDFA.PrefixRedefinition)
605
+ end
603
606
  uri_mappings[pfx_lc.to_sym] = href
604
607
  namespaces[pfx_lc] ||= href
605
608
  prefix(pfx_lc, href)
@@ -619,7 +622,7 @@ module RDF::RDFa
619
622
  #puts "uri_mappings prefix #{prefix} <#{uri}>"
620
623
  next unless prefix.match(/:$/)
621
624
  prefix.chop!
622
-
625
+
623
626
  unless prefix.match(NC_REGEXP)
624
627
  add_error(element, "extract_mappings: Prefix #{prefix.inspect} does not match NCName production")
625
628
  next
@@ -628,7 +631,11 @@ module RDF::RDFa
628
631
  # A Conforming RDFa Processor must ignore any definition of a mapping for the '_' prefix.
629
632
  next if prefix == "_"
630
633
 
631
- uri_mappings[prefix.to_s.empty? ? nil : prefix.to_s.to_sym] = uri
634
+ pfx_index = prefix.to_s.empty? ? nil : prefix.to_s.to_sym
635
+ if uri_mappings.fetch(pfx_index, uri) != uri
636
+ add_warning(element, "Redefining prefix #{prefix}: from <#{uri_mappings[pfx_index]}> to <#{uri}>", RDF::RDFA.PrefixRedefinition)
637
+ end
638
+ uri_mappings[pfx_index] = uri
632
639
  prefix(prefix, uri)
633
640
  add_info(element, "extract_mappings: prefix #{prefix} => <#{uri}>")
634
641
  end unless @version == :"rdfa1.0"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdf-rdfa
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.16
4
+ version: 0.3.17
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-11-29 00:00:00.000000000 Z
13
+ date: 2012-12-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rdf