Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat's the best way to parse RDFa, Microdata, etc, store and display info back using a uniform schema/vocabulary (schema.org's for example)
    primarykey
    data
    text
    <p>I'm mainly using Ruby to do this but my plan of attack thus far is as follows:</p> <p>Use the gems rdf,rdf-rdfa, and either rdf-microdata or mida to parse data given any URI. I think it'd be best to map to a uniform schema like schema.org, for example take this yaml file which attempts to describe the conversion between data-vocabulary and opengraph to schema.org:</p> <pre><code># Schema X to schema.org conversion #data-vocabulary DV: name:name street-address:streetAddress region:addressRegion locality:addressLocality photo:image country-name:addressCountry postal-code:postalCode tel:telephone latitude:latitude longitude:longitude type:type #opengraph OG: title:name type:type image:image site_name:site_name description:description latitude:latitude longitude:longitude street-address:streetAddress locality:addressLocality region:addressRegion postal-code:postalCode country-name:addressCountry phone_number:telephone email:email </code></pre> <p>I can then store information found in one format and re-display them with schema.org syntax.</p> <p>The other part is determining type. I'd model my tables after schema.org and I'd like to know the type of 'Thing' (<a href="http://schema.org/Thing" rel="nofollow">Thing</a>) a record would be. So if I parse an opengraph type of 'bar', I'd store it is 'BarOrPub' (<a href="http://schema.org/BarOrPub" rel="nofollow">BarOrPub</a>).</p> <p>Is there a better way of doing this? Something automated? A solution already out there? Any input appreciated.</p> <p>EDIT:</p> <p>So I'm finding that this parses pretty well (where all_tags includes the tags i'm interested in as keys and schema.org equivalent as the value):</p> <pre><code>RDF::RDFa::Reader.open(url) do |reader| reader.each_statement do |statement| tag = statement.predicate.to_s.split('/')[-1].split('#')[-1] Rails.logger.debug "rdf tag: #{tag}" Rails.logger.debug "rdf predicate: #{statement.predicate}" if all_tags.keys.include? tag Rails.logger.debug "Found mapping for #{statement.predicate} and #{all_tags[tag]}" results[all_tags[tag]] = statement.object.to_s.strip end end end </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload