This is a Ruby Library for extracting RDF Graph from an instance of String.
Create RDF Graph (an instance of RDF::Graph by RDF.rb) from an instance of String.
- RDFa
- Microdata
- RDF/XML
- DC-HTML (RFC2731)
- N3 (isn't tested)
- JSON-LD (isn't tested)
- Ruby (>=1.9.3)
- libxml2
- rake (>=0.9.2)
git clone https://github.com/tsunagun/rdf_string.git
cd rdf_string
rake build
rake install
require 'rdf_string'
class String
include RDFString
end
uri = "http://linter.structured-data.org/examples/google-rs/review.rdfa.html"
doc = open(uri).read
graph = doc.rdfa
uri = "http://linter.structured-data.org/examples/google-rs/review.md.html"
doc = open(uri).read
graph = doc.microdata
uri = "http://ci.nii.ac.jp/nrid/9000017716145.rdf"
doc = open(uri).read
graph = doc.rdfxml
uri = "http://www.aozora.gr.jp/cards/000020/files/2569_28291.html"
doc = open(uri).read
graph = doc.dc_html
I refer to Structured Data Linter. I use his code to detect formats(RDFa, Microdata, RDF/XML, and so on). Thanks for all.
This is free and unencumbered public domain software. For more information, see http://unlicense.org/ or the accompanying {file:UNLICENSE} file.