Microdata parser for RDF.rb.
RDF::Microdata is a Microdata reader for Ruby using the RDF.rb library suite.
- Microdata parser.
- Uses Nokogiri for parsing HTML
Install with 'gem install rdf-microdata'
Microdata to RDF transformation is undergoing active development. This implementation attempts to be up-to-date as of the time of release, and is being used in developing the Microdata RDF specification.
This implementation includes support for the proposed @itemprop-reverse attribute.
The parser uses a build-in version of the Microdata RDF registry.
Reading RDF data in the Microdata format
require 'rdf/microdata' graph = ::Graph.load("etc/doap.html", format: :microdata)
Reading using content-negotation
require 'rdf/microdata' graph = ::Graph.load("etc/doap.html", content_type: "text/html")
This spec is based on the W3C HTML Data Task Force specification and does not support GRDDL-type triple generation, such as for html>head>title anchor tags.
RDFa parser is available, will not assert content type
text/html or file extension
.html, as this is also asserted by RDFa. Instead, the RDFa reader will invoke the microdata reader if an
@itemscope attribute is detected.
Full documentation available on Rubydoc.info
- Asserts :html format, text/html mime-type and .html file extension.
There is an experimental reader based on transforming Microdata to RDFa within the DOM. To invoke
this, add the
rdfa: true option to the , or
The reader exposes a
#rdfa method, which can be used to retrieve the transformed HTML+RDFa
- Do your best to adhere to the existing coding conventions and idioms.
- Don't use hard tabs, and don't leave trailing whitespace on any line.
- Do document every method you add using YARD annotations. Read the tutorial or just look at the existing code for examples.
- Don't touch the
AUTHORSfiles. If you need to change them, do so on your private branch only.
- Do feel free to add yourself to the
CREDITSfile and the corresponding list in the the
README. Alphabetical order applies.
- Do note that in order for us to merge any non-trivial changes (as a rule of thumb, additions larger than about 15 lines of code), we need an explicit public domain dedication on record from you, which you will be asked to agree to on the first commit to a repo within the organization. Note that the agreement applies to all repos in the Ruby RDF organization.