Parsing & validating a document

Hi,

First off, thanks for piecing together a well-rounded library! I really appreciate the documentation and specs available to make it easier to implement RDF in a project of mine.

I’m having a bit of trouble wrapping my head around the best way to implement a Ruby version of the Common Workflow Langauge<file:///Users/novast/common-workflow-language.github.io>.

Specifically, I’m trying to figure out the best way to parse out a Workflow object. I’d appreciate any feedback to get up and running!

My assumptions:

  *   There’s a Turtle schema available<https://rawgit.com/common-workflow-language/common-workflow-language.github.io/master/draft-2/cwl.ttl> that contains a list of classes. I can successfully process that schema as a RDF Schema<https://github.com/ohsu-computational-biology/common_workflow/blob/master/lib/common_workflow/schema.rb#L20>, and convert it to a JSON-LD object<https://github.com/ohsu-computational-biology/common_workflow/blob/master/lib/common_workflow/workflow.rb#L44>.

  *   There’s a JSON-LD context<https://rawgit.com/common-workflow-language/common-workflow-language.github.io/master/draft-2/cwl-context.jsonld> published for the schema. (Thanks for the rdf-turtle gem!)

  *   I can take the above graph from the schema and the context to create the input for a data frame<https://github.com/ohsu-computational-biology/common_workflow/blob/master/lib/common_workflow/workflow.rb#L33>.

  *   With that input, I’m trying to frame a document (a simple CLW workflow<https://github.com/common-workflow-language/common-workflow-language/blob/master/conformance/draft-2/cat1-tool.cwl>), however the object I get back contains just the @context attribute and no @graph property. According to the example in the JSON-LD docs<https://github.com/ruby-rdf/json-ld#frame-a-document>, I was hoping to get a @graph object that I can convert back to an RDF graph object.

So – my questions are:

  1.  Is this the right approach?

  2.  At what point can I validate that my document (i.e., cat1-tool.cwl) conforms to the schema.

  3.  Is it better to traverse the framed document in the JSON-LD form? Or should I convert it back to an RDF graph to traverse / query it there?

Thanks! I appreciate any feedback!

Received on Wednesday, 22 July 2015 11:36:22 UTC