It's all about the answers!

Ask a question

OSLC: Correct usage/handling of RDF/XML with Javascript?


Stefan Hufnagl (29411719) | asked Jan 16 '15, 4:36 a.m.
Hello,

I use Javascript to get Workitems and Artefacts with the help of OSLC. The Javascript Program is running in DNG Webinterface and is not a NodeJS App.

Questions:
* Currently I handle the RDF/XML presentation of a Workitem like normal XML...but in this case I lose the semantic. Are there other ways?
* Is someone using RDF Javascript libraries like rdfstore.js or rdfquery?
* The Namespaces inside RDF/XML make some problems with the XML handling (especially with JQuery), has someone a good solution for this?

BTW, I saw the Javascript Implementation from Steve Speicher but this is NodeJS related


Thx in advance

Steve

Comments
Donald Nong commented Jan 19 '15, 7:39 p.m.

Just a thought. CLM applications appear to use JSON, rather than RDF/XML, most of the time. Will it be easier if you switch over to JSON?


Stefan Hufnagl commented Jan 21 '15, 7:08 a.m. | edited Jan 22 '15, 7:41 p.m.

Hi Donald,

yes, JSON and Javascript fits perfect together, but it seems to me that not all OSLC API presentations support JSON. RDF/XML is allways supported. And also with JSON... I'm not sure if our OSLC JSON  is JSON-LD?

Thx


Donald Nong commented Jan 22 '15, 7:45 p.m.

I believe JSON is supported for all resources (artifacts). But if you are trying to run queries or reports, JSON may not be an option.
I am not sure about the JSON-LD bit. As a simple test, if I add "Accept: application/ld+json" as the request header, I will get an HTTP 406 "not acceptable" response. So I assume it is not JSON-LD.


Stefan Hufnagl commented Jan 25 '15, 8:40 a.m.

 Unfortunately, JSON is not available with DNG Artefacts.  

One answer



permanent link
Stefan Hufnagl (29411719) | answered Jan 23 '15, 3:27 a.m.
edited Jan 23 '15, 3:28 a.m.
Hi Donald,

thanks for the valuable hints. You are right...I was mixing OSLC and Reporting/Query REST API regarding the XML (or JSON) presentation features.

BTW, there is one bug in JQuery (Ticket  #11166) when you append elements to RDF/XML: JQuery convert all element and attribute names to lowercase. Because in OSLC we use "Camelcase" like "oslc_rm:trackedBy" you will run in troubles that are hard to find, i.e. I append new links to DNG Artefacts and it doesn't work. Interesting you get "200 OK" back when you use "PUT" to update the DNG Artefact. Still have no solution for this (except string.replace).

Thx

Steve

Your answer


Register or to post your answer.