Created
June 3, 2010 11:30
-
-
Save njh/423774 to your computer and use it in GitHub Desktop.
Example of parsing RDFa into a graph
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'rdf/rdfa' | |
graph = RDF::Graph.load('http://rdfa.digitalbazaar.com/test-suite/test-cases/xhtml1/0001.xhtml', :base_uri => 'http://rdfa.digitalbazaar.com/test-suite/test-cases/xhtml1/0001.xhtml') | |
graph.each_statement do |statement| | |
statement.inspect! | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I need to take care of getting rid of
:base_uri
, but note that the rest of it can (in Ruby 1.8.7+) be simplified to:...which is why the
RDF::Value#inspect!
method exists in the first place :-)