rdf-rdfa 1.1.6.1 → 1.99.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 37184941079a9de95652928cc6444e4c81c0ae0b
4
- data.tar.gz: 1115b899aaa0df5f9d9f5b0146e6188386dc5b4b
3
+ metadata.gz: 0558e46f6ad2f13a2abe64998d503d903772b2e2
4
+ data.tar.gz: 744049f93032abe300beed3bd882672569da09ba
5
5
  SHA512:
6
- metadata.gz: 69aada8837f30c1e952b133d96019f69c449bb8989450070849e7529f91fb8fa2d18ee9a0fb66290d942f3f0541590eadf66b26ac3a2804a8609d87cbf0450d8
7
- data.tar.gz: d35995ba25cf44a360eba057bd9bd8221094e8de62c23f1522336d133aa5883f1493dad247b273c7a2de47735a7ff2a6c6ad6af78958ab2b7132b4a335e618a9
6
+ metadata.gz: 24ebed47ca4fd927c49a9f75ae6d1c322ebbd31eb64091cd70820f7f5a23f0f623d7bc05852344c014c98b386a5086f6552303457d34c9ead296cafc02ae02dd
7
+ data.tar.gz: 2f3625bee948e85289b142c5387199a836a23e30876a5a7aa66c16105196a0d77dfcc3575bf63f1da7d9029a20b45fe02d808dda196d235e2f0134ed14bfed29
data/README CHANGED
@@ -30,8 +30,7 @@ RDFa is an evolving standard, undergoing some substantial recent changes partly
30
30
  with Microdata. As a result, the RDF Webapps working group is currently looking at changes in the processing model for RDFa. These changes are now being tracked in {RDF::RDFa::Reader}:
31
31
 
32
32
  #### RDFa 1.1 Lite
33
- This version fully supports the limited syntax of [RDFa Lite 1.1][]. This includes the ability to use
34
- @property exclusively.
33
+ This version fully supports the limited syntax of [RDFa Lite 1.1][]. This includes the ability to use `@property` exclusively.
35
34
 
36
35
  #### Vocabulary Expansion
37
36
  One of the issues with vocabularies was that they discourage re-use of existing vocabularies when terms from several vocabularies are used at the same time. As it is common (encouraged) for RDF vocabularies to form sub-class and/or sub-property relationships with well defined vocabularies, the RDFa vocabulary expansion mechanism takes advantage of this.
@@ -244,11 +243,11 @@ In an [RDFA+HTML Errata](https://www.w3.org/2001/sw/wiki/RDFa_1.1._Errata#Using_
244
243
 
245
244
  ### Reading RDF data in the RDFa format
246
245
 
247
- graph = RDF::Graph.load("etc/doap.html", :format => :rdfa)
246
+ graph = RDF::Graph.load("etc/doap.html", format: :rdfa)
248
247
 
249
248
  ### Reading RDF data with vocabulary expansion
250
249
 
251
- graph = RDF::Graph.load("etc/doap.html", :format => :rdfa, :vocab_expansion => true)
250
+ graph = RDF::Graph.load("etc/doap.html", format: :rdfa, vocab_expansion: true)
252
251
 
253
252
  or
254
253
 
@@ -256,11 +255,11 @@ or
256
255
 
257
256
  ### Reading Processor Graph
258
257
 
259
- graph = RDF::Graph.load("etc/doap.html", :format => :rdfa, :rdfagraph => :processor)
258
+ graph = RDF::Graph.load("etc/doap.html", format: :rdfa, rdfagraph: :processor)
260
259
 
261
260
  ### Reading Both Processor and Output Graphs
262
261
 
263
- graph = RDF::Graph.load("etc/doap.html", :format => :rdfa, :rdfagraph => [:output, :processor])
262
+ graph = RDF::Graph.load("etc/doap.html", format: :rdfa, rdfagraph: [:output, :processor])
264
263
 
265
264
  ### Writing RDF data using the XHTML+RDFa format
266
265
 
@@ -274,8 +273,8 @@ Note that prefixes may be chained between Reader and Writer, so that the Writer
274
273
  use the same prefix definitions found during parsing:
275
274
 
276
275
  prefixes = {}
277
- graph = RDF::Graph.load("etc/doap.html", :prefixes => prefixes)
278
- puts graph.dump(:rdfa, :prefixes => prefixes)
276
+ graph = RDF::Graph.load("etc/doap.html", prefixes: prefixes)
277
+ puts graph.dump(:rdfa, prefixes: prefixes)
279
278
 
280
279
  ### Template-based Writer
281
280
  The RDFa writer uses [Haml][Haml] templates for code generation. This allows
@@ -288,7 +287,7 @@ To specify an alternative Haml template, consider the following:
288
287
 
289
288
  require 'rdf/rdfa'
290
289
 
291
- RDF::RDFa::Writer.buffer(:haml => RDF::RDFa::Writer::MIN_HAML) << graph
290
+ RDF::RDFa::Writer.buffer(haml: RDF::RDFa::Writer::MIN_HAML) << graph
292
291
 
293
292
  The template hash defines four Haml templates:
294
293
 
@@ -385,12 +384,12 @@ The template hash defines four Haml templates:
385
384
  the associated Hash. For example:
386
385
 
387
386
  {
388
- :document => "...",
389
- :subject => "...",
387
+ document: "...",
388
+ subject: "...",
390
389
  :property\_value => "...",
391
390
  :property\_values => "...",
392
391
  RDF::URI("http://schema.org/Person") => {
393
- :subject => "...",
392
+ subject: "...",
394
393
  :property\_value => "...",
395
394
  :property\_values => "...",
396
395
  }
@@ -422,7 +421,6 @@ Full documentation available on [Rubydoc.info][RDFa doc]
422
421
  * {RDF::RDFa::Writer}
423
422
 
424
423
  ### Additional vocabularies
425
- * {RDF::PTR}
426
424
  * {RDF::RDFA}
427
425
  * {RDF::XML}
428
426
  * {RDF::XSI}
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.6.1
1
+ 1.99.0
@@ -63,7 +63,7 @@ module RDF::RDFa
63
63
  # @return [RDF::Repository]
64
64
  # @raise [RDF::RDFa::ContextError] if context does not support contexts
65
65
  def self.repository
66
- @repository ||= RDF::Repository.new(:title => "RDFa Contexts")
66
+ @repository ||= RDF::Repository.new(title: "RDFa Contexts")
67
67
  end
68
68
 
69
69
  ##
@@ -89,7 +89,7 @@ module RDF::RDFa
89
89
  cache[uri] = new(uri) do |context|
90
90
  STDERR.puts("process_context: retrieve context <#{uri}>") if RDF::RDFa.debug?
91
91
  Context.load(uri)
92
- context.parse(repository.query(:context => uri))
92
+ context.parse(repository.query(context: uri))
93
93
  end
94
94
  rescue Exception => e
95
95
  raise ContextError, "Context #{uri}: #{e.message}", e.backtrace
@@ -98,7 +98,7 @@ module RDF::RDFa
98
98
  # Load context into repository
99
99
  def self.load(uri)
100
100
  uri = RDF::URI.intern(uri)
101
- repository.load(uri.to_s, :base_uri => uri, :context => uri) unless repository.has_context?(uri)
101
+ repository.load(uri.to_s, base_uri: uri, context: uri) unless repository.has_context?(uri)
102
102
  end
103
103
 
104
104
  # @return [RDF::Repository]
@@ -5,32 +5,32 @@ class RDF::RDFa::Context
5
5
  def self.find_with_xhtml_rdfa_1_1(uri)
6
6
  if uri.to_s == "http://www.w3.org/2011/rdfa-context/xhtml-rdfa-1.1"
7
7
  @_xhtml_rdfa_1_1_prof ||= RDF::RDFa::Context.new(RDF::URI("http://www.w3.org/2011/rdfa-context/xhtml-rdfa-1.1"), {
8
- :terms => {
9
- :alternate => "http://www.w3.org/1999/xhtml/vocab#alternate",
10
- :appendix => "http://www.w3.org/1999/xhtml/vocab#appendix",
11
- :bookmark => "http://www.w3.org/1999/xhtml/vocab#bookmark",
12
- :chapter => "http://www.w3.org/1999/xhtml/vocab#chapter",
13
- :cite => "http://www.w3.org/1999/xhtml/vocab#cite",
14
- :contents => "http://www.w3.org/1999/xhtml/vocab#contents",
15
- :copyright => "http://www.w3.org/1999/xhtml/vocab#copyright",
16
- :first => "http://www.w3.org/1999/xhtml/vocab#first",
17
- :glossary => "http://www.w3.org/1999/xhtml/vocab#glossary",
18
- :help => "http://www.w3.org/1999/xhtml/vocab#help",
19
- :icon => "http://www.w3.org/1999/xhtml/vocab#icon",
20
- :index => "http://www.w3.org/1999/xhtml/vocab#index",
21
- :last => "http://www.w3.org/1999/xhtml/vocab#last",
22
- :license => "http://www.w3.org/1999/xhtml/vocab#license",
23
- :meta => "http://www.w3.org/1999/xhtml/vocab#meta",
24
- :next => "http://www.w3.org/1999/xhtml/vocab#next",
25
- :p3pv1 => "http://www.w3.org/1999/xhtml/vocab#p3pv1",
26
- :prev => "http://www.w3.org/1999/xhtml/vocab#prev",
27
- :previous => "http://www.w3.org/1999/xhtml/vocab#previous",
28
- :section => "http://www.w3.org/1999/xhtml/vocab#section",
29
- :start => "http://www.w3.org/1999/xhtml/vocab#start",
30
- :stylesheet => "http://www.w3.org/1999/xhtml/vocab#stylesheet",
31
- :subsection => "http://www.w3.org/1999/xhtml/vocab#subsection",
32
- :top => "http://www.w3.org/1999/xhtml/vocab#top",
33
- :up => "http://www.w3.org/1999/xhtml/vocab#up",
8
+ terms: {
9
+ alternate: "http://www.w3.org/1999/xhtml/vocab#alternate",
10
+ appendix: "http://www.w3.org/1999/xhtml/vocab#appendix",
11
+ bookmark: "http://www.w3.org/1999/xhtml/vocab#bookmark",
12
+ chapter: "http://www.w3.org/1999/xhtml/vocab#chapter",
13
+ cite: "http://www.w3.org/1999/xhtml/vocab#cite",
14
+ contents: "http://www.w3.org/1999/xhtml/vocab#contents",
15
+ copyright: "http://www.w3.org/1999/xhtml/vocab#copyright",
16
+ first: "http://www.w3.org/1999/xhtml/vocab#first",
17
+ glossary: "http://www.w3.org/1999/xhtml/vocab#glossary",
18
+ help: "http://www.w3.org/1999/xhtml/vocab#help",
19
+ icon: "http://www.w3.org/1999/xhtml/vocab#icon",
20
+ index: "http://www.w3.org/1999/xhtml/vocab#index",
21
+ last: "http://www.w3.org/1999/xhtml/vocab#last",
22
+ license: "http://www.w3.org/1999/xhtml/vocab#license",
23
+ meta: "http://www.w3.org/1999/xhtml/vocab#meta",
24
+ next: "http://www.w3.org/1999/xhtml/vocab#next",
25
+ p3pv1: "http://www.w3.org/1999/xhtml/vocab#p3pv1",
26
+ prev: "http://www.w3.org/1999/xhtml/vocab#prev",
27
+ previous: "http://www.w3.org/1999/xhtml/vocab#previous",
28
+ section: "http://www.w3.org/1999/xhtml/vocab#section",
29
+ start: "http://www.w3.org/1999/xhtml/vocab#start",
30
+ stylesheet: "http://www.w3.org/1999/xhtml/vocab#stylesheet",
31
+ subsection: "http://www.w3.org/1999/xhtml/vocab#subsection",
32
+ top: "http://www.w3.org/1999/xhtml/vocab#top",
33
+ up: "http://www.w3.org/1999/xhtml/vocab#up",
34
34
  },
35
35
  })
36
36
  else
@@ -5,47 +5,47 @@ class RDF::RDFa::Context
5
5
  def self.find_with_rdfa_1_1(uri)
6
6
  if uri.to_s == "http://www.w3.org/2011/rdfa-context/rdfa-1.1"
7
7
  @_rdfa_1_1_prof ||= RDF::RDFa::Context.new(RDF::URI("http://www.w3.org/2011/rdfa-context/rdfa-1.1"), {
8
- :prefixes => {
9
- :cc => "http://creativecommons.org/ns#",
10
- :ctag => "http://commontag.org/ns#",
11
- :dc => "http://purl.org/dc/terms/",
12
- :dc11 => "http://purl.org/dc/elements/1.1/",
13
- :dcat => "http://www.w3.org/ns/dcat#",
14
- :dcterms => "http://purl.org/dc/terms/",
15
- :foaf => "http://xmlns.com/foaf/0.1/",
16
- :gr => "http://purl.org/goodrelations/v1#",
17
- :grddl => "http://www.w3.org/2003/g/data-view#",
18
- :ical => "http://www.w3.org/2002/12/cal/icaltzd#",
19
- :ma => "http://www.w3.org/ns/ma-ont#",
20
- :og => "http://ogp.me/ns#",
21
- :org => "http://www.w3.org/ns/org#",
22
- :owl => "http://www.w3.org/2002/07/owl#",
23
- :prov => "http://www.w3.org/ns/prov#",
24
- :qb => "http://purl.org/linked-data/cube#",
25
- :rdf => "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
26
- :rdfa => "http://www.w3.org/ns/rdfa#",
27
- :rdfs => "http://www.w3.org/2000/01/rdf-schema#",
28
- :rev => "http://purl.org/stuff/rev#",
29
- :rif => "http://www.w3.org/2007/rif#",
30
- :rr => "http://www.w3.org/ns/r2rml#",
31
- :schema => "http://schema.org/",
32
- :sd => "http://www.w3.org/ns/sparql-service-description#",
33
- :sioc => "http://rdfs.org/sioc/ns#",
34
- :skos => "http://www.w3.org/2004/02/skos/core#",
35
- :skosxl => "http://www.w3.org/2008/05/skos-xl#",
36
- :v => "http://rdf.data-vocabulary.org/#",
37
- :vcard => "http://www.w3.org/2006/vcard/ns#",
38
- :void => "http://rdfs.org/ns/void#",
39
- :wdr => "http://www.w3.org/2007/05/powder#",
40
- :wdrs => "http://www.w3.org/2007/05/powder-s#",
41
- :xhv => "http://www.w3.org/1999/xhtml/vocab#",
42
- :xml => "http://www.w3.org/XML/1998/namespace",
43
- :xsd => "http://www.w3.org/2001/XMLSchema#",
8
+ prefixes: {
9
+ cc: "http://creativecommons.org/ns#",
10
+ ctag: "http://commontag.org/ns#",
11
+ dc: "http://purl.org/dc/terms/",
12
+ dc11: "http://purl.org/dc/elements/1.1/",
13
+ dcat: "http://www.w3.org/ns/dcat#",
14
+ dcterms: "http://purl.org/dc/terms/",
15
+ foaf: "http://xmlns.com/foaf/0.1/",
16
+ gr: "http://purl.org/goodrelations/v1#",
17
+ grddl: "http://www.w3.org/2003/g/data-view#",
18
+ ical: "http://www.w3.org/2002/12/cal/icaltzd#",
19
+ ma: "http://www.w3.org/ns/ma-ont#",
20
+ og: "http://ogp.me/ns#",
21
+ org: "http://www.w3.org/ns/org#",
22
+ owl: "http://www.w3.org/2002/07/owl#",
23
+ prov: "http://www.w3.org/ns/prov#",
24
+ qb: "http://purl.org/linked-data/cube#",
25
+ rdf: "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
26
+ rdfa: "http://www.w3.org/ns/rdfa#",
27
+ rdfs: "http://www.w3.org/2000/01/rdf-schema#",
28
+ rev: "http://purl.org/stuff/rev#",
29
+ rif: "http://www.w3.org/2007/rif#",
30
+ rr: "http://www.w3.org/ns/r2rml#",
31
+ schema: "http://schema.org/",
32
+ sd: "http://www.w3.org/ns/sparql-service-description#",
33
+ sioc: "http://rdfs.org/sioc/ns#",
34
+ skos: "http://www.w3.org/2004/02/skos/core#",
35
+ skosxl: "http://www.w3.org/2008/05/skos-xl#",
36
+ v: "http://rdf.data-vocabulary.org/#",
37
+ vcard: "http://www.w3.org/2006/vcard/ns#",
38
+ void: "http://rdfs.org/ns/void#",
39
+ wdr: "http://www.w3.org/2007/05/powder#",
40
+ wdrs: "http://www.w3.org/2007/05/powder-s#",
41
+ xhv: "http://www.w3.org/1999/xhtml/vocab#",
42
+ xml: "http://www.w3.org/XML/1998/namespace",
43
+ xsd: "http://www.w3.org/2001/XMLSchema#",
44
44
  },
45
- :terms => {
46
- :describedby => "http://www.w3.org/2007/05/powder-s#describedby",
47
- :license => "http://www.w3.org/1999/xhtml/vocab#license",
48
- :role => "http://www.w3.org/1999/xhtml/vocab#role",
45
+ terms: {
46
+ describedby: "http://www.w3.org/2007/05/powder-s#describedby",
47
+ license: "http://www.w3.org/1999/xhtml/vocab#license",
48
+ role: "http://www.w3.org/1999/xhtml/vocab#role",
49
49
  },
50
50
  })
51
51
  else
@@ -17,7 +17,7 @@ module RDF::RDFa
17
17
  add_debug("expand") {"Repository has #{repository.count} statements"}
18
18
 
19
19
  # Load missing vocabularies
20
- vocabs = repository.query(:predicate => RDF::RDFA.usesVocabulary).to_a.map(&:object)
20
+ vocabs = repository.query(predicate: RDF::RDFA.usesVocabulary).to_a.map(&:object)
21
21
  vocabs.map! do |vocab|
22
22
  begin
23
23
  # Create the name with a predictable name so that it is enumerated and can be found
@@ -99,12 +99,12 @@ module RDF::RDFa
99
99
  end
100
100
  end
101
101
 
102
- def antecedent(subject, prediate, object, context = nil)
103
- antecedents << RDF::Query::Pattern.new(subject, prediate, object, :context => context)
102
+ def antecedent(subject, prediate, object)
103
+ antecedents << RDF::Query::Pattern.new(subject, prediate, object)
104
104
  end
105
105
 
106
- def consequent(subject, prediate, object, context = nil)
107
- consequents << RDF::Query::Pattern.new(subject, prediate, object, :context => context)
106
+ def consequent(subject, prediate, object)
107
+ consequents << RDF::Query::Pattern.new(subject, prediate, object)
108
108
  end
109
109
 
110
110
  ##
@@ -118,7 +118,7 @@ module RDF::RDFa
118
118
  nodes = {}
119
119
  consequents.each do |consequent|
120
120
  terms = {}
121
- [:subject, :predicate, :object, :context].each do |r|
121
+ [:subject, :predicate, :object].each do |r|
122
122
  terms[r] = case o = consequent.send(r)
123
123
  when RDF::Node then nodes[o] ||= RDF::Node.new
124
124
  when RDF::Query::Variable then solution[o]
@@ -5,21 +5,21 @@ module RDF::RDFa
5
5
  # @example Obtaining an RDFa format class
6
6
  # RDF::Format.for(:rdfa) #=> RDF::RDFa::Format
7
7
  # RDF::Format.for("etc/doap.html")
8
- # RDF::Format.for(:file_name => "etc/doap.html")
9
- # RDF::Format.for(:file_extension => "html")
10
- # RDF::Format.for(:content_type => "text/html")
11
- # RDF::Format.for(:content_type => "application/xhtml+xml")
8
+ # RDF::Format.for(file_name: "etc/doap.html")
9
+ # RDF::Format.for(file_extension: "html")
10
+ # RDF::Format.for(content_type: "text/html")
11
+ # RDF::Format.for(content_type: "application/xhtml+xml")
12
12
  #
13
13
  # @example Obtaining serialization format MIME types
14
14
  # RDF::Format.content_types #=> {"text/html" => [RDF::RDFa::Format]}
15
15
  #
16
16
  # @example Obtaining serialization format file extension mappings
17
- # RDF::Format.file_extensions #=> {:xhtml => "application/xhtml+xml"}
17
+ # RDF::Format.file_extensions #=> {xhtml: "application/xhtml+xml"}
18
18
  #
19
19
  # @see http://www.w3.org/TR/rdf-testcases/#ntriples
20
20
  class Format < RDF::Format
21
21
  content_encoding 'utf-8'
22
- content_type 'text/html', :extension => :html
22
+ content_type 'text/html', extension: :html
23
23
  reader { RDF::RDFa::Reader }
24
24
  writer { RDF::RDFa::Writer }
25
25
 
@@ -49,7 +49,7 @@ module RDF::RDFa
49
49
  # RDF::Format.for(:lite).writer # RDF::RDFa::Writer
50
50
  class Lite < RDF::Format
51
51
  content_encoding 'utf-8'
52
- content_type 'text/html', :extension => :html
52
+ content_type 'text/html', extension: :html
53
53
  reader { RDF::RDFa::Reader }
54
54
  writer { RDF::RDFa::Writer }
55
55
  end
@@ -64,7 +64,7 @@ module RDF::RDFa
64
64
  # RDF::Format.for(:html).writer # RDF::RDFa::Writer
65
65
  class HTML < RDF::Format
66
66
  content_encoding 'utf-8'
67
- content_type 'text/html', :extension => :html
67
+ content_type 'text/html', extension: :html
68
68
  reader { RDF::RDFa::Reader }
69
69
  writer { RDF::RDFa::Writer }
70
70
  end
@@ -79,7 +79,7 @@ module RDF::RDFa
79
79
  # RDF::Format.for(:xhtml).writer # RDF::RDFa::Writer
80
80
  class XHTML < RDF::Format
81
81
  content_encoding 'utf-8'
82
- content_type 'application/xhtml+xml', :extension => :xhtml
82
+ content_type 'application/xhtml+xml', extension: :xhtml
83
83
  reader { RDF::RDFa::Reader }
84
84
  writer { RDF::RDFa::Writer }
85
85
  end
@@ -94,7 +94,7 @@ module RDF::RDFa
94
94
  # RDF::Format.for(:svg).writer # RDF::RDFa::Writer
95
95
  class SVG < RDF::Format
96
96
  content_encoding 'utf-8'
97
- content_type 'image/svg+xml', :extension => :svg
97
+ content_type 'image/svg+xml', extension: :svg
98
98
  reader { RDF::RDFa::Reader }
99
99
  writer { RDF::RDFa::Writer }
100
100
  end
@@ -209,7 +209,7 @@ module RDF::RDFa
209
209
  #
210
210
  # A hash associating lists with properties.
211
211
  # @!attribute [rw] list_mapping
212
- # @return [Hash{RDF::URI => Array<RDF::Resource>}]
212
+ # @return [Hash{RDF:URI: Array<RDF::Resource>}]
213
213
  attr_accessor :list_mapping
214
214
 
215
215
  # @param [RDF::URI] base
@@ -292,7 +292,7 @@ module RDF::RDFa
292
292
  @errors = @options[:errors]
293
293
  @warnings = @options[:warnings]
294
294
  @debug = @options[:debug]
295
- @options = {:reference_folding => true}.merge(@options)
295
+ @options = {reference_folding: true}.merge(@options)
296
296
  @repository = RDF::Repository.new
297
297
 
298
298
  @options[:rdfagraph] = case @options[:rdfagraph]
@@ -335,9 +335,9 @@ module RDF::RDFa
335
335
  #
336
336
  # The Host Language may require the automatic inclusion of one or more Initial Contexts
337
337
  @host_defaults = {
338
- :vocabulary => nil,
339
- :uri_mappings => {},
340
- :initial_contexts => [],
338
+ vocabulary: nil,
339
+ uri_mappings: {},
340
+ initial_contexts: [],
341
341
  }
342
342
 
343
343
  if @version == :"rdfa1.0"
@@ -345,7 +345,7 @@ module RDF::RDFa
345
345
  @host_defaults[:term_mappings] = %w(
346
346
  alternate appendix bookmark cite chapter contents copyright first glossary help icon index
347
347
  last license meta next p3pv1 prev role section stylesheet subsection start top up
348
- ).inject({}) { |hash, term| hash[term] = RDF::XHV[term]; hash }
348
+ ).inject({}) { |hash, term| hash[term] = RDF::URI("http://www.w3.org/1999/xhtml/vocab#") + term; hash }
349
349
  end
350
350
 
351
351
  case @host_language
@@ -394,7 +394,7 @@ module RDF::RDFa
394
394
  rescue LoadError
395
395
  end
396
396
 
397
- if reader = RDF::Reader.for(:content_type => type.to_s)
397
+ if reader = RDF::Reader.for(content_type: type.to_s)
398
398
  add_debug(el, "=> reader #{reader.to_sym}")
399
399
  # Wrap input in a RemoteDocument with appropriate content-type
400
400
  doc = if input.is_a?(String)
@@ -450,7 +450,7 @@ module RDF::RDFa
450
450
  # statements in the associated named or default graph from the
451
451
  # processed repository
452
452
  @repository.each do |statement|
453
- case statement.context
453
+ case statement.graph_name
454
454
  when nil
455
455
  yield statement if @options[:rdfagraph].include?(:output)
456
456
  when RDF::RDFA.ProcessorGraph
@@ -523,17 +523,17 @@ module RDF::RDFa
523
523
  if @options[:processor_callback] || @options[:rdfagraph].include?(:processor)
524
524
  n = RDF::Node.new
525
525
  processor_statements = [
526
- RDF::Statement.new(n, RDF["type"], process_class, :context => RDF::RDFA.ProcessorGraph),
527
- RDF::Statement.new(n, RDF::DC.description, message, :context => RDF::RDFA.ProcessorGraph),
528
- RDF::Statement.new(n, RDF::DC.date, RDF::Literal::Date.new(DateTime.now), :context => RDF::RDFA.ProcessorGraph)
526
+ RDF::Statement.new(n, RDF["type"], process_class, graph_name: RDF::RDFA.ProcessorGraph),
527
+ RDF::Statement.new(n, RDF::URI("http://purl.org/dc/terms/description"), message, graph_name: RDF::RDFA.ProcessorGraph),
528
+ RDF::Statement.new(n, RDF::URI("http://purl.org/dc/terms/date"), RDF::Literal::Date.new(DateTime.now), graph_name: RDF::RDFA.ProcessorGraph)
529
529
  ]
530
- processor_statements << RDF::Statement.new(n, RDF::RDFA.context, base_uri, :context => RDF::RDFA.ProcessorGraph) if base_uri
530
+ processor_statements << RDF::Statement.new(n, RDF::RDFA.context, base_uri, graph_name: RDF::RDFA.ProcessorGraph) if base_uri
531
531
  if node.respond_to?(:path)
532
532
  nc = RDF::Node.new
533
533
  processor_statements += [
534
- RDF::Statement.new(n, RDF::RDFA.context, nc, :context => RDF::RDFA.ProcessorGraph),
535
- RDF::Statement.new(nc, RDF["type"], RDF::PTR.XPathPointer, :context => RDF::RDFA.ProcessorGraph),
536
- RDF::Statement.new(nc, RDF::PTR.expression, node.path, :context => RDF::RDFA.ProcessorGraph)
534
+ RDF::Statement.new(n, RDF::RDFA.context, nc, graph_name: RDF::RDFA.ProcessorGraph),
535
+ RDF::Statement.new(nc, RDF["type"], RDF::PTR.XPathPointer, graph_name: RDF::RDFA.ProcessorGraph),
536
+ RDF::Statement.new(nc, RDF::PTR.expression, node.path, graph_name: RDF::RDFA.ProcessorGraph)
537
537
  ]
538
538
  end
539
539
 
@@ -552,9 +552,9 @@ module RDF::RDFa
552
552
  # @param [RDF::Resource] subject the subject of the statement
553
553
  # @param [RDF::URI] predicate the predicate of the statement
554
554
  # @param [RDF::Value] object the object of the statement
555
- # @param [RDF::Value] context the context of the statement
555
+ # @param [RDF::Value] graph_name the graph name of the statement
556
556
  # @raise [RDF::ReaderError] Checks parameter types and raises if they are incorrect if parsing mode is _validate_.
557
- def add_triple(node, subject, predicate, object, context = nil)
557
+ def add_triple(node, subject, predicate, object, graph_name = nil)
558
558
  statement = RDF::Statement.new(subject, predicate, object)
559
559
  add_error(node, "statement #{RDF::NTriples.serialize(statement)} is invalid") unless statement.valid?
560
560
  if subject && predicate && object # Basic sanity checking
@@ -819,15 +819,15 @@ module RDF::RDFa
819
819
 
820
820
  # rels and revs
821
821
  rels = process_uris(element, attrs[:rel], evaluation_context, base,
822
- :uri_mappings => uri_mappings,
823
- :term_mappings => term_mappings,
824
- :vocab => default_vocabulary,
825
- :restrictions => TERMorCURIEorAbsIRI.fetch(@version, []))
822
+ uri_mappings: uri_mappings,
823
+ term_mappings: term_mappings,
824
+ vocab: default_vocabulary,
825
+ restrictions: TERMorCURIEorAbsIRI.fetch(@version, []))
826
826
  revs = process_uris(element, attrs[:rev], evaluation_context, base,
827
- :uri_mappings => uri_mappings,
828
- :term_mappings => term_mappings,
829
- :vocab => default_vocabulary,
830
- :restrictions => TERMorCURIEorAbsIRI.fetch(@version, []))
827
+ uri_mappings: uri_mappings,
828
+ term_mappings: term_mappings,
829
+ vocab: default_vocabulary,
830
+ restrictions: TERMorCURIEorAbsIRI.fetch(@version, []))
831
831
 
832
832
  add_debug(element) do
833
833
  "rels: #{rels.join(" ")}, revs: #{revs.join(" ")}"
@@ -839,14 +839,14 @@ module RDF::RDFa
839
839
  if @version == :"rdfa1.0"
840
840
  new_subject = if attrs[:about]
841
841
  process_uri(element, attrs[:about], evaluation_context, base,
842
- :uri_mappings => uri_mappings,
843
- :restrictions => SafeCURIEorCURIEorIRI.fetch(@version, []))
842
+ uri_mappings: uri_mappings,
843
+ restrictions: SafeCURIEorCURIEorIRI.fetch(@version, []))
844
844
  elsif attrs[:resource]
845
845
  process_uri(element, attrs[:resource], evaluation_context, base,
846
- :uri_mappings => uri_mappings,
847
- :restrictions => SafeCURIEorCURIEorIRI.fetch(@version, []))
846
+ uri_mappings: uri_mappings,
847
+ restrictions: SafeCURIEorCURIEorIRI.fetch(@version, []))
848
848
  elsif attrs[:href] || attrs[:src]
849
- process_uri(element, (attrs[:href] || attrs[:src]), evaluation_context, base, :restrictions => [:uri])
849
+ process_uri(element, (attrs[:href] || attrs[:src]), evaluation_context, base, restrictions: [:uri])
850
850
  end
851
851
 
852
852
  # If no URI is provided by a resource attribute, then the first match from the following rules
@@ -879,8 +879,8 @@ module RDF::RDFa
879
879
  new_subject ||= if attrs[:about]
880
880
  # by using the resource from @about, if present, obtained according to the section on CURIE and IRI Processing;
881
881
  process_uri(element, attrs[:about], evaluation_context, base,
882
- :uri_mappings => uri_mappings,
883
- :restrictions => SafeCURIEorCURIEorIRI.fetch(@version, []))
882
+ uri_mappings: uri_mappings,
883
+ restrictions: SafeCURIEorCURIEorIRI.fetch(@version, []))
884
884
  elsif [:xhtml1, :xhtml5, :html4, :html5].include?(@host_language) && element.name =~ /^(head|body)$/
885
885
  # From XHTML+RDFa 1.1:
886
886
  # if no URI is provided, then first check to see if the element is the head or body element. If it is, then act as if the new subject is set to the parent object.
@@ -906,13 +906,13 @@ module RDF::RDFa
906
906
  typed_resource ||= if attrs[:resource]
907
907
  # by using the resource from @resource, if present, obtained according to the section on CURIE and IRI Processing;
908
908
  process_uri(element, attrs[:resource], evaluation_context, base,
909
- :uri_mappings => uri_mappings,
910
- :restrictions => SafeCURIEorCURIEorIRI.fetch(@version, []))
909
+ uri_mappings: uri_mappings,
910
+ restrictions: SafeCURIEorCURIEorIRI.fetch(@version, []))
911
911
  elsif attrs[:href] || attrs[:src]
912
912
  # otherwise, by using the IRI from @href, if present, obtained according to the section on CURIE and IRI Processing;
913
913
  # otherwise, by using the IRI from @src, if present, obtained according to the section on CURIE and IRI Processing;
914
914
  process_uri(element, (attrs[:href] || attrs[:src]), evaluation_context, base,
915
- :restrictions => [:uri])
915
+ restrictions: [:uri])
916
916
  else
917
917
  # otherwise, the value of typed resource is set to a newly created bnode.
918
918
  RDF::Node.new
@@ -926,11 +926,11 @@ module RDF::RDFa
926
926
  new_subject =
927
927
  process_uri(element, (attrs[:about] || attrs[:resource]),
928
928
  evaluation_context, base,
929
- :uri_mappings => uri_mappings,
930
- :restrictions => SafeCURIEorCURIEorIRI.fetch(@version, [])) if attrs[:about] ||attrs[:resource]
929
+ uri_mappings: uri_mappings,
930
+ restrictions: SafeCURIEorCURIEorIRI.fetch(@version, [])) if attrs[:about] ||attrs[:resource]
931
931
  new_subject ||=
932
932
  process_uri(element, (attrs[:href] || attrs[:src]), evaluation_context, base,
933
- :restrictions => [:uri]) if attrs[:href] || attrs[:src]
933
+ restrictions: [:uri]) if attrs[:href] || attrs[:src]
934
934
 
935
935
  # If no URI is provided by a resource attribute, then the first match from the following rules
936
936
  # will apply:
@@ -968,11 +968,11 @@ module RDF::RDFa
968
968
  # If the current element does contain a @rel or @rev attribute, then the next step is to
969
969
  # establish both a value for new subject and a value for current object resource:
970
970
  new_subject = process_uri(element, attrs[:about], evaluation_context, base,
971
- :uri_mappings => uri_mappings,
972
- :restrictions => SafeCURIEorCURIEorIRI.fetch(@version, []))
971
+ uri_mappings: uri_mappings,
972
+ restrictions: SafeCURIEorCURIEorIRI.fetch(@version, []))
973
973
  new_subject ||= process_uri(element, attrs[:src], evaluation_context, base,
974
- :uri_mappings => uri_mappings,
975
- :restrictions => [:uri]) if @version == :"rdfa1.0"
974
+ uri_mappings: uri_mappings,
975
+ restrictions: [:uri]) if @version == :"rdfa1.0"
976
976
 
977
977
  # if the @typeof attribute is present, set typed resource to new subject
978
978
  typed_resource = new_subject if attrs[:typeof]
@@ -995,12 +995,12 @@ module RDF::RDFa
995
995
 
996
996
  # Then the current object resource is set to the URI obtained from the first match from the following rules:
997
997
  current_object_resource = process_uri(element, attrs[:resource], evaluation_context, base,
998
- :uri_mappings => uri_mappings,
999
- :restrictions => SafeCURIEorCURIEorIRI.fetch(@version, [])) if attrs[:resource]
998
+ uri_mappings: uri_mappings,
999
+ restrictions: SafeCURIEorCURIEorIRI.fetch(@version, [])) if attrs[:resource]
1000
1000
  current_object_resource ||= process_uri(element, attrs[:href], evaluation_context, base,
1001
- :restrictions => [:uri]) if attrs[:href]
1001
+ restrictions: [:uri]) if attrs[:href]
1002
1002
  current_object_resource ||= process_uri(element, attrs[:src], evaluation_context, base,
1003
- :restrictions => [:uri]) if attrs[:src] && @version != :"rdfa1.0"
1003
+ restrictions: [:uri]) if attrs[:src] && @version != :"rdfa1.0"
1004
1004
  current_object_resource ||= RDF::Node.new if attrs[:typeof] && !attrs[:about] && @version != :"rdfa1.0"
1005
1005
 
1006
1006
  # and also set the value typed resource to this bnode
@@ -1023,10 +1023,10 @@ module RDF::RDFa
1023
1023
  if typed_resource
1024
1024
  # Typeof is TERMorCURIEorAbsIRIs
1025
1025
  types = process_uris(element, attrs[:typeof], evaluation_context, base,
1026
- :uri_mappings => uri_mappings,
1027
- :term_mappings => term_mappings,
1028
- :vocab => default_vocabulary,
1029
- :restrictions => TERMorCURIEorAbsIRI.fetch(@version, []))
1026
+ uri_mappings: uri_mappings,
1027
+ term_mappings: term_mappings,
1028
+ vocab: default_vocabulary,
1029
+ restrictions: TERMorCURIEorAbsIRI.fetch(@version, []))
1030
1030
  add_debug(element, "[Step 7] typeof: #{attrs[:typeof]}")
1031
1031
  types.each do |one_type|
1032
1032
  add_triple(element, typed_resource, RDF["type"], one_type)
@@ -1087,14 +1087,14 @@ module RDF::RDFa
1087
1087
  list_mapping[r] = RDF::List.new
1088
1088
  add_debug(element) {"[Step 10] list(#{r}): create #{list_mapping[r].inspect}"}
1089
1089
  end
1090
- incomplete_triples << {:list => list_mapping[r], :direction => :none}
1090
+ incomplete_triples << {list: list_mapping[r], direction: :none}
1091
1091
  else
1092
- incomplete_triples << {:predicate => r, :direction => :forward}
1092
+ incomplete_triples << {predicate: r, direction: :forward}
1093
1093
  end
1094
1094
  end
1095
1095
 
1096
1096
  revs.each do |r|
1097
- incomplete_triples << {:predicate => r, :direction => :reverse}
1097
+ incomplete_triples << {predicate: r, direction: :reverse}
1098
1098
  end
1099
1099
  end
1100
1100
 
@@ -1104,10 +1104,10 @@ module RDF::RDFa
1104
1104
  # list associated with that property, creating a new list if necessary.
1105
1105
  if attrs[:property]
1106
1106
  properties = process_uris(element, attrs[:property], evaluation_context, base,
1107
- :uri_mappings => uri_mappings,
1108
- :term_mappings => term_mappings,
1109
- :vocab => default_vocabulary,
1110
- :restrictions => TERMorCURIEorAbsIRI.fetch(@version, []))
1107
+ uri_mappings: uri_mappings,
1108
+ term_mappings: term_mappings,
1109
+ vocab: default_vocabulary,
1110
+ restrictions: TERMorCURIEorAbsIRI.fetch(@version, []))
1111
1111
 
1112
1112
  properties.reject! do |p|
1113
1113
  if p.is_a?(RDF::URI)
@@ -1119,16 +1119,16 @@ module RDF::RDFa
1119
1119
  end
1120
1120
 
1121
1121
  datatype = process_uri(element, attrs[:datatype], evaluation_context, base,
1122
- :uri_mappings => uri_mappings,
1123
- :term_mappings => term_mappings,
1124
- :vocab => default_vocabulary,
1125
- :restrictions => TERMorCURIEorAbsIRI.fetch(@version, [])) unless attrs[:datatype].to_s.empty?
1122
+ uri_mappings: uri_mappings,
1123
+ term_mappings: term_mappings,
1124
+ vocab: default_vocabulary,
1125
+ restrictions: TERMorCURIEorAbsIRI.fetch(@version, [])) unless attrs[:datatype].to_s.empty?
1126
1126
  begin
1127
1127
  current_property_value = case
1128
1128
  when datatype && ![RDF.XMLLiteral, RDF.HTML].include?(datatype)
1129
1129
  # typed literal
1130
1130
  add_debug(element, "[Step 11] typed literal (#{datatype})")
1131
- RDF::Literal.new(attrs[:content] || attrs[:datetime] || attrs[:value] || element.inner_text.to_s, :datatype => datatype, :validate => validate?, :canonicalize => canonicalize?)
1131
+ RDF::Literal.new(attrs[:content] || attrs[:datetime] || attrs[:value] || element.inner_text.to_s, datatype: datatype, validate: validate?, canonicalize: canonicalize?)
1132
1132
  when @version == :"rdfa1.1"
1133
1133
  case
1134
1134
  when datatype == RDF.XMLLiteral
@@ -1143,14 +1143,14 @@ module RDF::RDFa
1143
1143
  # child node must take precedence over declarations that were active on the current node.
1144
1144
  begin
1145
1145
  c14nxl = element.children.c14nxl(
1146
- :library => @library,
1147
- :language => language,
1148
- :namespaces => {nil => XHTML}.merge(namespaces))
1146
+ library: @library,
1147
+ language: language,
1148
+ namespaces: {nil => XHTML}.merge(namespaces))
1149
1149
  RDF::Literal.new(c14nxl,
1150
- :library => @library,
1151
- :datatype => RDF.XMLLiteral,
1152
- :validate => validate?,
1153
- :canonicalize => canonicalize?)
1150
+ library: @library,
1151
+ datatype: RDF.XMLLiteral,
1152
+ validate: validate?,
1153
+ canonicalize: canonicalize?)
1154
1154
  rescue ArgumentError => e
1155
1155
  add_error(element, e.message)
1156
1156
  end
@@ -1161,10 +1161,10 @@ module RDF::RDFa
1161
1161
  # Just like XMLLiteral, but without the c14nxl
1162
1162
  begin
1163
1163
  RDF::Literal.new(element.children.to_html,
1164
- :library => @library,
1165
- :datatype => RDF.HTML,
1166
- :validate => validate?,
1167
- :canonicalize => canonicalize?)
1164
+ library: @library,
1165
+ datatype: RDF.HTML,
1166
+ validate: validate?,
1167
+ canonicalize: canonicalize?)
1168
1168
  rescue ArgumentError => e
1169
1169
  add_error(element, e.message)
1170
1170
  end
@@ -1184,11 +1184,11 @@ module RDF::RDFa
1184
1184
  # concatenating the value of all descendant text nodes, of the current element in turn.
1185
1185
  # typed literal
1186
1186
  add_debug(element, "[Step 11] datatyped literal (#{datatype})")
1187
- RDF::Literal.new(attrs[:content] || element.inner_text.to_s, :language => language, :validate => validate?, :canonicalize => canonicalize?)
1187
+ RDF::Literal.new(attrs[:content] || element.inner_text.to_s, language: language, validate: validate?, canonicalize: canonicalize?)
1188
1188
  when attrs[:content]
1189
1189
  # plain literal
1190
1190
  add_debug(element, "[Step 11] plain literal (content)")
1191
- RDF::Literal.new(attrs[:content], :language => language, :validate => validate?, :canonicalize => canonicalize?)
1191
+ RDF::Literal.new(attrs[:content], language: language, validate: validate?, canonicalize: canonicalize?)
1192
1192
  when element.name == 'time'
1193
1193
  # HTML5 support
1194
1194
  # Lexically scan value and assign appropriate type, otherwise, leave untyped
@@ -1197,41 +1197,41 @@ module RDF::RDFa
1197
1197
  v.match(dt::GRAMMAR)
1198
1198
  end || RDF::Literal
1199
1199
  add_debug(element) {"[Step 11] <time> literal: #{datatype} #{v.inspect}"}
1200
- datatype.new(v, :language => language)
1200
+ datatype.new(v, language: language)
1201
1201
  when (attrs[:resource] || attrs[:href] || attrs[:src]) &&
1202
1202
  !(attrs[:rel] || attrs[:rev]) &&
1203
1203
  @version != :"rdfa1.0"
1204
1204
  add_debug(element, "[Step 11] resource (resource|href|src)")
1205
1205
  res = process_uri(element, attrs[:resource], evaluation_context, base,
1206
- :uri_mappings => uri_mappings,
1207
- :restrictions => SafeCURIEorCURIEorIRI.fetch(@version, [])) if attrs[:resource]
1208
- res ||= process_uri(element, (attrs[:href] || attrs[:src]), evaluation_context, base, :restrictions => [:uri])
1206
+ uri_mappings: uri_mappings,
1207
+ restrictions: SafeCURIEorCURIEorIRI.fetch(@version, [])) if attrs[:resource]
1208
+ res ||= process_uri(element, (attrs[:href] || attrs[:src]), evaluation_context, base, restrictions: [:uri])
1209
1209
  when typed_resource && !attrs[:about] && @version != :"rdfa1.0"
1210
1210
  add_debug(element, "[Step 11] typed_resource")
1211
1211
  typed_resource
1212
1212
  else
1213
1213
  # plain literal
1214
1214
  add_debug(element, "[Step 11] plain literal (inner text)")
1215
- RDF::Literal.new(element.inner_text.to_s, :language => language, :validate => validate?, :canonicalize => canonicalize?)
1215
+ RDF::Literal.new(element.inner_text.to_s, language: language, validate: validate?, canonicalize: canonicalize?)
1216
1216
  end
1217
1217
  else # rdfa1.0
1218
1218
  if element.text_content? || (element.children.length == 0) || attrs[:datatype] == ""
1219
1219
  # plain literal
1220
1220
  add_debug(element, "[Step 11 (1.0)] plain literal")
1221
- RDF::Literal.new(attrs[:content] || element.inner_text.to_s, :language => language, :validate => validate?, :canonicalize => canonicalize?)
1221
+ RDF::Literal.new(attrs[:content] || element.inner_text.to_s, language: language, validate: validate?, canonicalize: canonicalize?)
1222
1222
  elsif !element.text_content? and (datatype == nil or datatype == RDF.XMLLiteral)
1223
1223
  # XML Literal
1224
1224
  add_debug(element) {"[Step 11 (1.0)] XML Literal: #{element.inner_html}"}
1225
1225
  recurse = false
1226
1226
  c14nxl = element.children.c14nxl(
1227
- :library => @library,
1228
- :language => language,
1229
- :namespaces => {nil => XHTML}.merge(namespaces))
1227
+ library: @library,
1228
+ language: language,
1229
+ namespaces: {nil => XHTML}.merge(namespaces))
1230
1230
  RDF::Literal.new(c14nxl,
1231
- :library => @library,
1232
- :datatype => RDF.XMLLiteral,
1233
- :validate => validate?,
1234
- :canonicalize => canonicalize?)
1231
+ library: @library,
1232
+ datatype: RDF.XMLLiteral,
1233
+ validate: validate?,
1234
+ canonicalize: canonicalize?)
1235
1235
  end
1236
1236
  end
1237
1237
  rescue ArgumentError => e
@@ -1350,14 +1350,14 @@ module RDF::RDFa
1350
1350
  if attrs[:role]
1351
1351
  subject = attrs[:id] ? uri(base, "##{attrs[:id]}") : RDF::Node.new
1352
1352
  roles = process_uris(element, attrs[:role], evaluation_context, base,
1353
- :uri_mappings => uri_mappings,
1354
- :term_mappings => term_mappings,
1355
- :vocab => RDF::XHV.to_s,
1356
- :restrictions => TERMorCURIEorAbsIRI.fetch(@version, []))
1353
+ uri_mappings: uri_mappings,
1354
+ term_mappings: term_mappings,
1355
+ vocab: "http://www.w3.org/1999/xhtml/vocab#",
1356
+ restrictions: TERMorCURIEorAbsIRI.fetch(@version, []))
1357
1357
 
1358
1358
  add_debug(element) {"role: about: #{subject.to_ntriples}, roles: #{roles.map(&:to_ntriples).inspect}"}
1359
1359
  roles.each do |r|
1360
- add_triple(element, subject, RDF::XHV.role, r)
1360
+ add_triple(element, subject, RDF::URI("http://www.w3.org/1999/xhtml/vocab#role"), r)
1361
1361
  end
1362
1362
  end
1363
1363
  end
@@ -1374,7 +1374,7 @@ module RDF::RDFa
1374
1374
  return if value.nil?
1375
1375
  restrictions = options[:restrictions]
1376
1376
  add_debug(element) {"process_uri: #{value}, restrictions = #{restrictions.inspect}"}
1377
- options = {:uri_mappings => {}}.merge(options)
1377
+ options = {uri_mappings: {}}.merge(options)
1378
1378
  if !options[:term_mappings] && options[:uri_mappings] && restrictions.include?(:safe_curie) && value.to_s.match(/^\[(.*)\]$/)
1379
1379
  # SafeCURIEorCURIEorIRI
1380
1380
  # When the value is surrounded by square brackets, then the content within the brackets is
@@ -1462,7 +1462,7 @@ module RDF::RDFa
1462
1462
  bnode(reference)
1463
1463
  elsif curie.to_s.match(/^:/)
1464
1464
  # Default prefix
1465
- RDF::XHV[reference.to_s]
1465
+ RDF::URI("http://www.w3.org/1999/xhtml/vocab#") + reference.to_s
1466
1466
  elsif !curie.to_s.match(/:/)
1467
1467
  # No prefix, undefined (in this context, it is evaluated as a term elsewhere)
1468
1468
  nil