rdf-rdfa 0.3.4.2 → 0.3.5.1

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/.yardopts DELETED
@@ -1,13 +0,0 @@
1
- --title "RDFa reader/writer for RDF.rb."
2
- --output-dir doc/yard
3
- --protected
4
- --no-private
5
- --hide-void-return
6
- --markup markdown
7
- --readme README.md
8
- -
9
- AUTHORS
10
- History.md
11
- CONTRIBUTORS
12
- VERSION
13
- UNLICENSE
@@ -1 +0,0 @@
1
- * Nicholas Humfrey <nicholas.humfrey@bbc.co.uk>
data/Gemfile DELETED
@@ -1,19 +0,0 @@
1
- source "http://rubygems.org"
2
- gem 'addressable', '2.2.4'
3
- gem 'rdf', :git => "https://github.com/gkellogg/rdf.git", :branch => "0.4.x"
4
- gem 'haml', '>= 3.0.0'
5
- gem 'nokogiri', '>= 1.3.3'
6
- gem 'facets', '>= 2.9.1'
7
-
8
- group :development do
9
- gem 'open-uri-cached', '>= 0.0.3'
10
- gem 'rdf-spec', :git => "https://github.com/gkellogg/rdf-spec.git", :branch => "0.4.x", :require => 'rdf/spec'
11
- gem 'rdf-isomorphic', '>= 0.3.4', :require => 'rdf/isomorphic'
12
- gem 'rdf-n3', '>= 0.3.1', :require => 'rdf/n3'
13
- gem 'rspec', '>= 2.1.0'
14
- gem 'sxp', :git => "https://github.com/gkellogg/sxp-ruby.git", :branch => "query-algebra"
15
- gem 'sparql-algebra', :git => "https://github.com/gkellogg/sparql-algebra.git", :require => 'sparql/algebra'
16
- gem 'sparql-grammar', :git => "https://github.com/gkellogg/sparql-grammar.git", :require => 'sparql/grammar'
17
- gem 'spira', '>= 0.0.12'
18
- gem 'yard', '>= 0.6.4'
19
- end
data/History.md DELETED
@@ -1,98 +0,0 @@
1
- ### 0.3.4.2
2
- * Fix Writer output for multi-valued properties when there is no :property\_values Haml template.
3
- * Simplify templates by using pre-rendered CURIEs.
4
-
5
- ### 0.3.4.1
6
- * Change built-in profiles to use alias\_method\_chain, as they were being removed from the cache.
7
- * Fixes to Writer template detection with type.
8
-
9
- ### 0.3.4
10
- * Add writer support for template selection based on subject type.
11
-
12
- ### 0.3.3.3
13
- * Minor update to rdfa-1-1 profile
14
-
15
- ### 0.3.3.2
16
- * In Reader:
17
- * Ensure that encoding is set to utf-8 if not specified.
18
- * Look for encoding from input and HTML meta tags.
19
- * Look for content-type from input and HTML meta tags.
20
- * Retrieve @xmlns, @xml:lang and @lang as attributes when doing HTML parsing.
21
-
22
- ### 0.3.3.1
23
- * Improve format detection.
24
- * Use HTML parser instead of XML if format is determined to be html4 or html5.
25
-
26
- ### 0.3.3
27
- * Major update to writer using Haml templates, rather than Nokogiri node creation.
28
-
29
- ### 0.3.2
30
- * Added RDFa Writer, to perform templated serialization of RDF content to RDFa.
31
- * Uses Haml to define default and minimal templates for RDFa serialization.
32
- * Allows templates to be specified on invocation, for arbitrary RDFa serialization.
33
- * Update to pre-LC2 drafts of RDFa
34
- * Add support for cached profiles, and include cached profiles for XML+RDFa and XHTML+RDFa.
35
- * Profiles are processed left to right
36
- * Detect 1.0 using @version
37
- * Automatically load profiles based on host language
38
-
39
- ### 0.3.1.2
40
- * Assert :html and xhtml as a format types (by creating RDF::RDFa::HTML/XHTML as a sub-class of Format that uses RDFa::Reader/Writer)
41
- * Added :svg format, image/svg+xml and .svg as looks for RDFa parser as well.
42
-
43
- ### 0.3.1
44
- * Bug fix relating to datatypes in literals being ignored.
45
- * Bug fix parsing non-RDFa profiles to ensure they don't cause processing to terminate (or recurse).
46
-
47
- ### 0.3.0
48
- * RDF.rb 0.3.0 compatibility updates
49
- * Remove literal_normalization and qname_hacks, add back uri_hacks (until 0.3.0)
50
- * URI canonicalization and validation.
51
- * Added :canonicalize, and :intern options.
52
- * Change :strict option to :validate.
53
- * Add check to ensure that predicates are not literals, it's not legal in any RDF variant.
54
- * Collect prefixes when extracting mappings.
55
- * Added :profile_repository option to RDF::RDFa::Reader.initialize. This MUST be an RDF::Repository and will be used to save profiles that are encountered.
56
- * Fixme, for now, retrieval should include HTTP headers and perform appropriate HTTP cache control and check for potential updates.
57
- * Update to 2010-10-26 LC version of RDFa Core 1.1
58
- * Deep processing of XMLLiterals
59
- * Case sensitive Terms
60
- * Updated processor graph vocabulary
61
- * Upgrade for changes to RDFa 1.1 test suite
62
- * Allow use of xml:base for non-HTML languages
63
- * XHTML has no default vocabulary.
64
- * No longer pass vocabularies, prefixes or terms when creating XMLLiterals. Only namespaces derived via xmlns are passed to Literal#typed.
65
- * Literal::XML
66
- * Add all in-scope namespaces, not just those that seem to be used.
67
- * RSpec 2 compatibility.
68
-
69
- ### 0.2.2
70
- * Ruby 1.9.2 compatibility
71
- * Added script/parse as command-line option for parsing files.
72
- * Add back support for RDFa 1.0 as well as RDFa 1.1. Parser checks @version to determine which
73
- * Update RDFa processing to WD-rdfa-core-20100803 semantics
74
- * Added Processor Graph and required output
75
- * Reverse order of processing profiles
76
- * Don't process element if any profile fails
77
- * XMLLiterals must be explicitly specified as @datatype
78
- * TERMorCURIEorAbsURI requires an absolute URI, not document relative
79
- * Extract a new default vocabulary from @profile.
80
-
81
- ### 0.2.1
82
- * Update for RDF 0.2.1
83
-
84
- ### 0.2.0
85
- * Updates for RDF 0.2.0
86
- * Use URI#intern instead of URI#new
87
- * Change use of Graph#predicates and Graph#objects to use as enumerables
88
-
89
- ### 0.0.3
90
- * Removed internal graph in Reader and implement each_triple & each_statement to perform parsing
91
-
92
- ### 0.0.2
93
- * Remove dependency on Namespace
94
- * Changed to RDF::RDFa, and moved files accordingly.
95
- * Added vocab definitions for RDA, XHV, XML, XSI and OWL
96
-
97
- ### 0.0.1
98
- * First port from RdfContext version 0.5.4
data/README.md DELETED
@@ -1,311 +0,0 @@
1
- # RDF::RDFa reader/writer
2
-
3
- [RDFa][RDFa 1.1 Core] parser for RDF.rb.
4
-
5
- ## DESCRIPTION
6
- RDF::RDFa is an RDFa reader and writer for Ruby using the [RDF.rb][RDF.rb] library suite.
7
-
8
- ## FEATURES
9
- RDF::RDFa parses [RDFa][RDFa 1.1 Core] into statements or triples.
10
-
11
- * Fully compliant RDFa 1.1 parser.
12
- * Template-based Writer to generate XHTML+RDFa.
13
- * Writer uses user-replacable [Haml][Haml]-based templates to generate RDFa.
14
- * Uses Nokogiri for parsing HTML/SVG
15
- * [RDFa tests][RDFa-test-suite] use SPARQL for most tests due to Rasqal limitations. Other tests compare directly against N-triples.
16
-
17
- Install with 'gem install rdf-rdfa'
18
-
19
- ## Usage
20
-
21
- ### Reading RDF data in the RDFa format
22
-
23
- RDF::RDFa::Reader.open("etc/foaf.html") do |reader|
24
- reader.each_statement do |statement|
25
- puts statement.inspect
26
- end
27
- end
28
-
29
- ### Writing RDF data using the XHTML+RDFa format
30
-
31
- require 'rdf/rdfa'
32
-
33
- RDF::RDFa::Writer.open("hello.html") do |writer|
34
- writer << RDF::Graph.new do |graph|
35
- graph << [:hello, RDF::DC.title, "Hello, world!"]
36
- end
37
- end
38
-
39
- Note that prefixes may be chained between Reader and Writer, so that the Writer will
40
- use the same prefix definitions found during parsing:
41
-
42
- prefixes = {}
43
- graph = RDF::Graph.load("etc/foaf.html", :prefixes => prefixes)
44
- puts graph.dump(:rdfa, :prefixes => prefixes)
45
-
46
- ### Template-based Writer
47
- The RDFa writer uses [Haml][Haml] templates for code generation. This allows fully
48
- customizable RDFa output in a variety of host languages.
49
- The [default template]({RDF::RDFa::Writer::DEFAULT_HAML}) generates human readable HTML5
50
- output. A [minimal template]({RDF::RDFa::Writer::MIN_HAML}) generates HTML, which is not
51
- intended for human consumption.
52
-
53
- To specify an alternative Haml template, consider the following:
54
-
55
- require 'rdf/rdfa'
56
-
57
- RDF::RDFa::Writer.buffer(:haml => RDF::RDFa::Writer::MIN_HAML) << graph
58
-
59
- The template hash defines four Haml templates:
60
-
61
- * _doc_: Document Template, takes an ordered list of _subject_s and yields each one to be rendered.
62
- Described further in {RDF::RDFa::Writer#render_document}.
63
-
64
- !!! XML
65
- !!! 5
66
- %html{:xmlns => "http://www.w3.org/1999/xhtml", :lang => lang, :profile => profile, :prefix => prefix}
67
- - if base || title
68
- %head
69
- - if base
70
- %base{:href => base}
71
- - if title
72
- %title= title
73
- %body
74
- - subjects.each do |subject|
75
- != yield(subject)
76
-
77
- This template takes locals _lang_, _profile_, _prefix_, _base_, _title_ in addition to _subjects_
78
- to create output similar to the following:
79
-
80
- <!DOCTYPE html>
81
- <html prefix='xhv: http://www.w3.org/1999/xhtml/vocab#' xmlns='http://www.w3.org/1999/xhtml'>
82
- <head>
83
- <base href="http://example/">
84
- <title>Document Title</title>
85
- </head>
86
- <body>
87
- ...
88
- </body>
89
- </html>
90
-
91
- Options passed to the Writer are used to supply _lang_, _profile_ and _base_ locals.
92
- _prefix_ is generated based upon prefixes found from default or supplied profiles, as well
93
- as those provided by a previous Reader. _title_ is taken from the first top-level subject
94
- having an appropriate title property (as defined by the _heading_predicates_ option).
95
-
96
- * _subject_: Subject Template, take a _subject_ and an order list of _predicate_s and yields
97
- each _predicate_ to be rendered. Described further in {RDF::RDFa::Writer#render_subject}.
98
-
99
- - if element == :li
100
- %li{:about => get_curie(subject), :typeof => typeof}
101
- - if typeof
102
- %span.type!= typeof
103
- - predicates.each do |predicate|
104
- != yield(predicate)
105
- - elsif rel && typeof
106
- %div{:rel => get_curie(rel)}
107
- %div{:about => get_curie(subject), :typeof => typeof}
108
- %span.type!= typeof
109
- - predicates.each do |predicate|
110
- != yield(predicate)
111
- - elsif rel
112
- %div{:rel => get_curie(rel), :resource => get_curie(subject)}
113
- - predicates.each do |predicate|
114
- != yield(predicate)
115
- - else
116
- %div{:about => get_curie(subject), :typeof => typeof}
117
- - if typeof
118
- %span.type!= typeof
119
- - predicates.each do |predicate|
120
- != yield(predicate)
121
-
122
- The template takes locals _rel_ and _typeof_ in addition to _predicates_ and _subject_ to
123
- create output similar to the following:
124
-
125
- <div about="http://example/">
126
- ...
127
- </div>
128
-
129
- Note that if _typeof_ is defined, in this template, it will generate a textual description.
130
-
131
- * _property\_value_: Property Value Template, used for predicates having a single value; takes
132
- a _predicate_, and a single-valued Array of _objects_. Described further in {RDF::RDFa::Writer#render\_property}.
133
-
134
- - object = objects.first
135
- - if heading_predicates.include?(predicate) && object.literal?
136
- %h1{:property => get_curie(predicate), :content => get_content(object), :lang => get_lang(object), :datatype => get_dt_curie(object)}&= get_value(object)
137
- - else
138
- %div.property
139
- %span.label
140
- = get_predicate_name(predicate)
141
- - if res = yield(object)
142
- != res
143
- - elsif object.node?
144
- %span{:resource => get_curie(object), :rel => get_curie(predicate)}= get_curie(object)
145
- - elsif object.uri?
146
- %a{:href => object.to_s, :rel => get_curie(predicate)}= object.to_s
147
- - elsif object.datatype == RDF.XMLLiteral
148
- %span{:property => get_curie(predicate), :lang => get_lang(object), :datatype => get_dt_curie(object)}<!= get_value(object)
149
- - else
150
- %span{:property => get_curie(predicate), :content => get_content(object), :lang => get_lang(object), :datatype => get_dt_curie(object)}&= get_value(object)
151
-
152
- In addition to _predicate_ and _objects_, the template takes locals _property_ and/or _rel_, which are
153
- copies of _predicate_ and indicate use in the @property or @rel attributes. Either or both may be
154
- specified, as the conditions dictate.
155
-
156
- Also, if the predicate is identified as a _heading predicate_ (via _:heading\_predicates_ option),
157
- it will generate a heading element, and may use the value as the document title.
158
-
159
- Each _object_ is yielded to the calling block, and the result is rendered, unless nil.
160
- Otherwise, rendering depends on the type of _object_. This is useful for recursive document
161
- descriptions.
162
-
163
- Creates output similar to the following:
164
-
165
- <div class='property'>
166
- <span class='label'>
167
- xhv:alternate
168
- </span>
169
- <a href='http://rdfa.info/feed/' rel='xhv:alternate'>http://rdfa.info/feed/</a>
170
- </div>
171
-
172
- Note the use of methods defined in {RDF::RDFa::Writer} useful in rendering the output.
173
-
174
- * _property\_values_: Similar to _property\_value_, but for predicates having more than one value.
175
- Locals are identical to _property\_values_, but _objects_ is expected to have more than one value.
176
-
177
- %div.property
178
- %span.label
179
- = get_predicate_name(predicate)
180
- %ul{:rel => (get_curie(rel) if rel), :property => (get_curie(property) if property)}
181
- - objects.each do |object|
182
- - if res = yield(object)
183
- != res
184
- - elsif object.node?
185
- %li{:resource => get_curie(object)}= get_curie(object)
186
- - elsif object.uri?
187
- %li
188
- %a{:href => object.to_s}= object.to_s
189
- - elsif object.datatype == RDF.XMLLiteral
190
- %li{:lang => get_lang(object), :datatype => get_curie(object.datatype)}<!= get_value(object)
191
- - else
192
- %li{:content => get_content(object), :lang => get_lang(object), :datatype => get_dt_curie(object)}&= get_value(object)
193
-
194
- In this case, and unordered list is used for output. Creates output similar to the following:
195
-
196
- <div class='property'>
197
- <span class='label'>
198
- xhv:bookmark
199
- </span>
200
- <ul rel='xhv:bookmark'>
201
- <li>
202
- <a href='http://rdfa.info/2009/12/12/oreilly-catalog-uses-rdfa/'>
203
- http://rdfa.info/2009/12/12/oreilly-catalog-uses-rdfa/
204
- </a>
205
- </li>
206
- <a href='http://rdfa.info/2010/05/31/new-rdfa-checker/'>
207
- http://rdfa.info/2010/05/31/new-rdfa-checker/
208
- </a>
209
- </li>
210
- </ul>
211
- </div>
212
- If _property\_values_ does not exist, repeated values will be replecated
213
- using _property\_value_.
214
- * Type-specific templates.
215
- To simplify generation of different output types, the
216
- template may contain a elements indexed by a URI. When a subject with an rdf:type
217
- matching that URI is found, subsequent Haml definitions will be taken from
218
- the associated Hash. For example:
219
-
220
- {
221
- :document => "...",
222
- :subject => "...",
223
- :property\_value => "...",
224
- :property\_values => "...",
225
- RDF::URI("http://schema.org/Person") => {
226
- :subject => "...",
227
- :property\_value => "...",
228
- :property\_values => "...",
229
- }
230
- }
231
-
232
- ## Dependencies
233
- * [RDF.rb](http://rubygems.org/gems/rdf) (>= 0.3.1)
234
- * [Nokogiri](http://rubygems.org/gems/nokogiri) (>= 1.3.3)
235
- * [Haml](https://rubygems.org/gems/haml) (>= 3.0.0)
236
-
237
- ## Documentation
238
- Full documentation available on [RubyForge](http://rdf.rubyforge.org/rdfa)
239
-
240
- ### Principle Classes
241
- * {RDF::RDFa::Format}
242
- * {RDF::RDFa::HTML}
243
- Asserts :html format, text/html mime-type and .html file extension.
244
- * {RDF::RDFa::XHTML}
245
- Asserts :html format, application/xhtml+xml mime-type and .xhtml file extension.
246
- * {RDF::RDFa::SVG}
247
- Asserts :svg format, image/svg+xml mime-type and .svg file extension.
248
- * {RDF::RDFa::Reader}
249
- * {RDF::RDFa::Profile}
250
- * {RDF::RDFa::Writer}
251
-
252
- ### Additional vocabularies
253
- * {RDF::PTR}
254
- * {RDF::RDFA}
255
- * {RDF::XHV}
256
- * {RDF::XML}
257
- * {RDF::XSI}
258
-
259
- ## TODO
260
- * Add support for LibXML and REXML bindings, and use the best available
261
- * Consider a SAX-based parser for improved performance
262
-
263
- ## Resources
264
- * [RDF.rb][RDF.rb]
265
- * [Distiller](http://rdf.greggkellogg.net/distiller)
266
- * [Documentation](http://rdf.rubyforge.org/rdfa)
267
- * [History](file:file.History.html)
268
- * [RDFa 1.1 Core][RDFa 1.1 Core]
269
- * [XHTML+RDFa 1.1][XHTML+RDFa 1.1]
270
- * [RDFa-test-suite](http://rdfa.digitalbazaar.com/test-suite/ "RDFa test suite")
271
-
272
- ## Author
273
- * [Gregg Kellogg](http://github.com/gkellogg) - <http://kellogg-assoc.com/>
274
-
275
- ## Contributors
276
- * [Nicholas Humfrey](http://github.com/njh)
277
-
278
- ## Contributing
279
-
280
- * Do your best to adhere to the existing coding conventions and idioms.
281
- * Don't use hard tabs, and don't leave trailing whitespace on any line.
282
- * Do document every method you add using [YARD][] annotations. Read the
283
- [tutorial][YARD-GS] or just look at the existing code for examples.
284
- * Don't touch the `.gemspec`, `VERSION` or `AUTHORS` files. If you need to
285
- change them, do so on your private branch only.
286
- * Do feel free to add yourself to the `CREDITS` file and the corresponding
287
- list in the the `README`. Alphabetical order applies.
288
- * Do note that in order for us to merge any non-trivial changes (as a rule
289
- of thumb, additions larger than about 15 lines of code), we need an
290
- explicit [public domain dedication][PDD] on record from you.
291
-
292
- ## License
293
-
294
- This is free and unencumbered public domain software. For more information,
295
- see <http://unlicense.org/> or the accompanying {file:UNLICENSE} file.
296
-
297
- ## FEEDBACK
298
-
299
- * gregg@kellogg-assoc.com
300
- * <http://rubygems.org/rdf-rdfa>
301
- * <http://github.com/gkellogg/rdf-rdfa>
302
- * <http://lists.w3.org/Archives/Public/public-rdf-ruby/>
303
-
304
- [RDF.rb]: http://rdf.rubyforge.org/
305
- [YARD]: http://yardoc.org/
306
- [YARD-GS]: http://rubydoc.info/docs/yard/file/docs/GettingStarted.md
307
- [PDD]: http://lists.w3.org/Archives/Public/public-rdf-ruby/2010May/0013.html
308
- [RDFa 1.1 Core]: http://www.w3.org/TR/2011/WD-rdfa-core-20110331/ "RDFa 1.1 Core"
309
- [XHTML+RDFa 1.1]: http://www.w3.org/TR/2011/WD-xhtml-rdfa-20110331/ "XHTML+RDFa 1.1"
310
- [RDFa-test-suite]: http://rdfa.digitalbazaar.com/test-suite/ "RDFa test suite"
311
- [Haml]: http://haml-lang.com/
data/Rakefile DELETED
@@ -1,64 +0,0 @@
1
- require 'rubygems'
2
- require 'yard'
3
-
4
- begin
5
- gem 'jeweler'
6
- require 'jeweler'
7
- Jeweler::Tasks.new do |gemspec|
8
- gemspec.name = "rdf-rdfa"
9
- gemspec.summary = "RDFa reader/writer for RDF.rb."
10
- gemspec.description = <<-DESCRIPTION
11
- RDF::RDFa is an RDFa reader/writer for Ruby using the RDF.rb library suite.
12
- DESCRIPTION
13
- gemspec.email = "gregg@kellogg-assoc.com"
14
- gemspec.homepage = "http://github.com/gkellogg/rdf-rdfa"
15
- gemspec.authors = ["Gregg Kellogg"]
16
- gemspec.add_dependency('rdf', '>= 0.3.3')
17
- gemspec.add_dependency('haml', '>= 3.0.0')
18
- gemspec.add_dependency('nokogiri', '>= 1.4.4')
19
- gemspec.add_dependency('facets','>= 2.9.1')
20
-
21
- gemspec.add_development_dependency('spira', '>= 0.0.12')
22
- gemspec.add_development_dependency('rspec', '>= 2.5.0')
23
- gemspec.add_development_dependency('rdf-spec', '>= 0.3.3')
24
- gemspec.add_development_dependency('rdf-isomorphic', '>= 0.3.4')
25
- gemspec.add_development_dependency('yard')
26
- gemspec.extra_rdoc_files = %w(README.md History.md AUTHORS CONTRIBUTORS)
27
- end
28
- Jeweler::GemcutterTasks.new
29
- rescue LoadError
30
- puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
31
- end
32
-
33
- require 'rspec/core/rake_task'
34
- RSpec::Core::RakeTask.new(:spec)
35
-
36
- desc "Run specs through RCov"
37
- RSpec::Core::RakeTask.new("spec:rcov") do |spec|
38
- spec.rcov = true
39
- spec.rcov_opts = %q[--exclude "spec"]
40
- end
41
-
42
- desc "Update RDFa Profiles"
43
- task :update_profiles do
44
- {
45
- :xhtml => "http://www.w3.org/profile/html-rdfa-1.1",
46
- :xml => "http://www.w3.org/profile/rdfa-1.1",
47
- }.each do |v, uri|
48
- puts "Build #{uri}"
49
- vocab = File.expand_path(File.join(File.dirname(__FILE__), "lib", "rdf", "rdfa", "profile", "#{v}.rb"))
50
- FileUtils.rm(vocab)
51
- `./script/intern_vocabulary -o #{vocab} #{uri}`
52
- end
53
- end
54
-
55
- namespace :doc do
56
- YARD::Rake::YardocTask.new
57
-
58
- desc "Generate HTML report specs"
59
- RSpec::Core::RakeTask.new("spec") do |spec|
60
- spec.rspec_opts = ["--format", "html", "-o", "doc/spec.html"]
61
- end
62
- end
63
-
64
- task :default => :spec