rdf-raptor 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -14,7 +14,8 @@ Features
14
14
  * Requires the [Raptor][] library and utilities to be available.
15
15
  * Based on the [`rapper`][rapper] command-line utility bundled with Raptor.
16
16
  * Parses and serializes RDF data from/into the RDF/XML or Turtle formats.
17
- * Provides serialization format autodetection for RDF/XML and Turtle.
17
+ * Extracts RDF statements from XHTML+RDFa documents.
18
+ * Provides serialization format autodetection for RDF/XML, Turtle and RDFa.
18
19
  * Compatible with any operating system supported by Raptor and Ruby.
19
20
  * Compatible with MRI 1.8.x, 1.9.x and JRuby (tested with JRuby 1.4).
20
21
 
@@ -44,6 +45,14 @@ Examples
44
45
  end
45
46
  end
46
47
 
48
+ ### Extracting RDF statements from an XHTML+RDFa document
49
+
50
+ RDF::Reader.open(url = "http://bblfish.net/", :format => :rdfa, :base_uri => url) do |reader|
51
+ reader.each_statement do |statement|
52
+ puts statement.inspect
53
+ end
54
+ end
55
+
47
56
  ### Serializing RDF statements into an RDF/XML file
48
57
 
49
58
  data = RDF::Repository.load("http://datagraph.org/jhacker/foaf.nt")
@@ -80,6 +89,14 @@ Examples
80
89
  RDF::Format.for(:file_extension => "ttl")
81
90
  RDF::Format.for(:content_type => "text/turtle")
82
91
 
92
+ ### Obtaining the RDFa format specification class
93
+
94
+ RDF::Format.for(:rdfa) #=> RDF::Raptor::RDFa::Format
95
+ RDF::Format.for("input.html")
96
+ RDF::Format.for(:file_name => "input.html")
97
+ RDF::Format.for(:file_extension => "html")
98
+ RDF::Format.for(:content_type => "application/xhtml+xml")
99
+
83
100
  Documentation
84
101
  -------------
85
102
 
@@ -88,11 +105,12 @@ Documentation
88
105
  * {RDF::Raptor}
89
106
  * {RDF::Raptor::RDFXML}
90
107
  * {RDF::Raptor::Turtle}
108
+ * {RDF::Raptor::RDFa}
91
109
 
92
110
  Dependencies
93
111
  ------------
94
112
 
95
- * [RDF.rb](http://rubygems.org/gems/rdf) (>= 0.1.4)
113
+ * [RDF.rb](http://rubygems.org/gems/rdf) (>= 0.1.9)
96
114
  * [Raptor][] (>= 1.4.16), specifically the `rapper` binary
97
115
 
98
116
  Installation
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.3.0
data/lib/rdf/raptor.rb CHANGED
@@ -8,6 +8,8 @@ module RDF
8
8
  # machine-readable RDF/XML format.
9
9
  # * {RDF::Raptor::Turtle} provides support for the popular
10
10
  # human-readable Turtle format.
11
+ # * {RDF::Raptor::RDFa} provides support for extracting
12
+ # RDF statements from XHTML+RDFa documents.
11
13
  #
12
14
  # @example Requiring the `RDF::Raptor` module
13
15
  # require 'rdf/raptor'
@@ -32,6 +34,13 @@ module RDF
32
34
  # RDF::Format.for(:file_extension => "ttl")
33
35
  # RDF::Format.for(:content_type => "text/turtle")
34
36
  #
37
+ # @example Obtaining an RDFa format class
38
+ # RDF::Format.for(:rdfa) #=> RDF::Raptor::RDFa::Format
39
+ # RDF::Format.for("input.html")
40
+ # RDF::Format.for(:file_name => "input.html")
41
+ # RDF::Format.for(:file_extension => "html")
42
+ # RDF::Format.for(:content_type => "application/xhtml+xml")
43
+ #
35
44
  # @see http://rdf.rubyforge.org/
36
45
  # @see http://librdf.org/raptor/
37
46
  #
@@ -104,5 +113,6 @@ module RDF
104
113
 
105
114
  require 'rdf/raptor/rdfxml'
106
115
  require 'rdf/raptor/turtle'
116
+ require 'rdf/raptor/rdfa'
107
117
  end # module Raptor
108
118
  end # module RDF
@@ -0,0 +1,56 @@
1
+ module RDF::Raptor
2
+ ##
3
+ # RDFa support.
4
+ #
5
+ # @example Requiring the `RDF::Raptor` module
6
+ # require 'rdf/raptor'
7
+ #
8
+ # @example Extracting RDF statements from an XHTML+RDFa file
9
+ # RDF::Reader.open("input.html") do |reader|
10
+ # reader.each_statement do |statement|
11
+ # puts statement.inspect
12
+ # end
13
+ # end
14
+ #
15
+ # @see http://rdfa.info/
16
+ module RDFa
17
+ ##
18
+ # RDFa format specification.
19
+ #
20
+ # @example Obtaining an RDFa format class
21
+ # RDF::Format.for(:rdfa) #=> RDF::Raptor::RDFa::Format
22
+ # RDF::Format.for("input.html")
23
+ # RDF::Format.for(:file_name => "input.html")
24
+ # RDF::Format.for(:file_extension => "html")
25
+ # RDF::Format.for(:content_type => "application/xhtml+xml")
26
+ #
27
+ class Format < RDF::Raptor::Format
28
+ content_type 'application/xhtml+xml', :extension => :html
29
+ content_encoding 'utf-8'
30
+ rapper_format :rdfa
31
+
32
+ reader { RDF::Raptor::RDFa::Reader }
33
+ end
34
+
35
+ ##
36
+ # RDFa extractor.
37
+ #
38
+ # @example Obtaining an RDFa reader class
39
+ # RDF::Reader.for(:rdfa) #=> RDF::Raptor::RDFa::Reader
40
+ # RDF::Reader.for("input.html")
41
+ # RDF::Reader.for(:file_name => "input.html")
42
+ # RDF::Reader.for(:file_extension => "html")
43
+ # RDF::Reader.for(:content_type => "application/xhtml+xml")
44
+ #
45
+ # @example Extracting RDF statements from an XHTML+RDFa file
46
+ # RDF::Reader.open("input.html") do |reader|
47
+ # reader.each_statement do |statement|
48
+ # puts statement.inspect
49
+ # end
50
+ # end
51
+ #
52
+ class Reader < RDF::Raptor::Reader
53
+ format RDF::Raptor::RDFa::Format
54
+ end
55
+ end
56
+ end
@@ -1,8 +1,8 @@
1
1
  module RDF; module Raptor
2
2
  module VERSION
3
3
  MAJOR = 0
4
- MINOR = 2
5
- TINY = 1
4
+ MINOR = 3
5
+ TINY = 0
6
6
  EXTRA = nil
7
7
 
8
8
  STRING = [MAJOR, MINOR, TINY].join('.')
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 2
8
- - 1
9
- version: 0.2.1
7
+ - 3
8
+ - 0
9
+ version: 0.3.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Arto Bendiken
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-07 00:00:00 +02:00
17
+ date: 2010-04-28 00:00:00 +02:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -27,8 +27,8 @@ dependencies:
27
27
  segments:
28
28
  - 0
29
29
  - 1
30
- - 4
31
- version: 0.1.4
30
+ - 9
31
+ version: 0.1.9
32
32
  type: :development
33
33
  version_requirements: *id001
34
34
  - !ruby/object:Gem::Dependency
@@ -69,8 +69,8 @@ dependencies:
69
69
  segments:
70
70
  - 0
71
71
  - 1
72
- - 4
73
- version: 0.1.4
72
+ - 9
73
+ version: 0.1.9
74
74
  type: :runtime
75
75
  version_requirements: *id004
76
76
  description: RDF.rb plugin for parsing/serializing RDF/XML and Turtle data using the Raptor RDF Parser library.
@@ -88,6 +88,7 @@ files:
88
88
  - VERSION
89
89
  - lib/rdf/raptor/cli.rb
90
90
  - lib/rdf/raptor/ffi.rb
91
+ - lib/rdf/raptor/rdfa.rb
91
92
  - lib/rdf/raptor/rdfxml.rb
92
93
  - lib/rdf/raptor/turtle.rb
93
94
  - lib/rdf/raptor/version.rb