Next task is to provide the feature for getting the RDF output for the vocabularies. There would be a link on the workspace page which would display the vocabulary in RDF Syntax on click.

if the URI of the vocabualary is http://{some_path}/testvoc# , then the URI of the RDF output will be http://{some_path}/testvoc.rdf

Comments

cygri’s picture

Here are some pointers into the D6 code that might be useful. Here's probably a situation where copying a lot of the D6 code is a good idea.

  1. neologism_menu has an entry that binds the vocab/rdf path to neologism_export_rdfxml
  2. neologism_export_rdfxml delegates most of the heavy lifting to neologism_get_rdf_model.
  3. neologism_get_rdf_model basically fetches an entire vocabulary from the database (most of that happens in _neologism_get_all_classes and _neologism_get_all_properties), and then uses an NeologismRDFWriter to convert all that information to RDF. This function shouldn't require too many changes, mostly the names of the fields, and removing/commenting the parts that are not yet implemented.
  4. _neologism_get_all_classes and _neologism_get_all_properties are the places that will require the most changes. It's a matter of translating the CCK bulk load into Field API data access. Perhaps the EntityFieldQuery approach you used for the vocabulary overview page can be used again to load all the nodes here. This doesn't look very difficult but it looks rather time-consuming…
  5. The job of the NeologismRDFWriter is to generate an ARC2 model. ARC2 is an RDF library that provides an RDF/XML and Turtle serializer which we use to actually write out the RDF (see neologism_export_rdfxml). The NeologismRDFWriter class is in neologism.rdfwriter.inc. That entire file can probably just be used in D7 without change, except for the ARC2 include in the very beginning.

Hope that helps…

mayankkandpal’s picture

Will try to roll a patch within another day.

mayankkandpal’s picture

Some issues :

1. In drupal-7, the " node/%id/rdf " page for is reserved for the automatically generated RDFa output, and I have not been able to override the callback. So, for now, I am displaying the RDF/XML on " node/%neologism_vocabulary/rdf-export ".

2. vann is not imported as a namespace by default, so for now, I have hard-coded registration of vann while generating RDF/XML output

  $rdf->register_namespace('vann', 'http://purl.org/vocab/vann/' );
cygri’s picture

1. How about "node/%neologism_vocabulary/rdfxml"?

2. Ok, we can sort that out later.

mayankkandpal’s picture

StatusFileSize
new29.2 KB

Patch for displaying RDF/XML output at node/%neologism_vocabulary/rdfxml

There are a couple of whitespace errors in the neologism.rdfwriter.inc I will have to manually remove them since coder-format script doesnt work properly on it and does some unwanted editing which results in errors.

mayankkandpal’s picture

StatusFileSize
new29.2 KB

Cleaned up whitespace manually.

mayankkandpal’s picture

StatusFileSize
new30.16 KB

Patch for adding Workspace author information to the RDF/XML output. No issues.

Probably we should commit this to the branch else the patches will keep getting bigger :)