[oslc-core] Meeting notes and using rdf:RDF as root element

Arthur Ryman ryman at ca.ibm.com
Fri Jul 9 11:30:26 EDT 2010


Dave,

You generated the output from a very small and uncomplicated RDF graph. 
There is no guarantee that RDF/XML-ABBREV would produce documents that 
conformed to the OSLC subset when applied it to other larger and more 
complicated RDF graphs.

The RDF/XML-ABBREV writer is defined by Jena and takes many parameters, 
e.g. blockRules, to control its output [1].  We could move towards a more 
formal definition of the OSLC subset by specifying how it maps to 
RDF/XML-ABBREV. This means that when we generate RDF/XML using the Jena 
RDF/XML-ABBREV writer with the prescribed set of control parameters then 
it conforms to the OSLC subset. A consumer would therefore not conform to 
the OSLC spec if it failed to correctly  process a document generated 
using the RDF/XML-ABBREV writer with the prescribed control parameters.

[1] http://jena.sourceforge.net/IO/iohowto.html#output

Regards, 
___________________________________________________________________________ 

Arthur Ryman, PhD, DE


Chief Architect, Project and Portfolio Management

IBM Software, Rational

Markham, ON, Canada | Office: 905-413-3077, Cell: 416-939-5063
Twitter | Facebook | YouTube







From:
Dave <snoopdave at gmail.com>
To:
oslc-core <oslc-core at open-services.net>
Date:
07/09/2010 11:09 AM
Subject:
Re: [oslc-core] Meeting notes and using rdf:RDF as root element
Sent by:
oslc-core-bounces at open-services.net



On Thu, Jul 8, 2010 at 11:59 AM, Dave <snoopdave at gmail.com> wrote:
>> Furthermore, when I try to generate RDF using
>> the toolkit, it will not conform to the OSLC subset so I'll have to 
write
>> my own serializer. We are therefore in the paradoxical situation of
>> embracing RDF as our data model yet making life more difficult for
>> implementers that want to use RDF toolkits.
>
> This could be a real issue and probably warrants some testing with
> Jena and other RDF serializers. Can anybody comment in this issue?

To answer my own question...


Here's how you would generate OSLC recommended RDF with Jena using Java:

                 // define a bogus OSLC resource
                 Property oslcBogon = new
PropertyImpl("http://open-services.net/ns/bogus#Bogon");
 
                 // define a property
                 Property dctermsTitle = new PropertyImpl("
http://purl.org/dc/terms/title");
 
                 // create a model, add the prefixes we want
                 Model model = ModelFactory.createDefaultModel();
                 model.setNsPrefix("dcterms", "http://purl.org/dc/terms/
");
                 model.setNsPrefix("oslc-bogus", "
http://open-services.net/ns/bogus#");
 
                 // create a resource, add a title
                 Resource resource = model.createResource("
http://example.com/resources/1");
                 resource.addProperty(RDF.type, oslcBogon);
                 resource.addLiteral(dctermsTitle, "This is my title.");
 
                 // spit it out in OSLC form
                 RDFWriter writer = model.getWriter("RDF/XML-ABBREV");
                 String useAbsoluteURLs = null;
                 writer.write(model, System.out, useAbsoluteURLs);


When you run that you get this:

   <rdf:RDF
       xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
       xmlns:dcterms="http://purl.org/dc/terms/"
       xmlns:oslc-bogus="http://open-services.net/ns/bogus#">
     <oslc-bogus:Bogon rdf:about="http://example.com/resources/1">
       <dcterms:title
rdf:datatype="http://www.w3.org/2001/XMLSchema#string">This is my
title.</dcterms:title>
     </oslc-bogus:Bogon>
   </rdf:RDF>


No special serializers is required.

Thanks,
- Dave

_______________________________________________
Oslc-Core mailing list
Oslc-Core at open-services.net
http://open-services.net/mailman/listinfo/oslc-core_open-services.net







More information about the Oslc-Core mailing list