This wiki is locked. Future workgroup activity and specification development must take place at our new wiki. For more information, see this blog post about the new governance model and this post about changes to the website.

OSLC Core Specification:
JSON Representation Examples

By: The OSLC Core Workgroup

Overview

In this section we provide JSON format representations of the resources defined in the RDF/XML examples. These example representations following the JSON representation guidance offered in OSLC Core Specification Appendix B.

Note that we also provide RDF/XML Examples and Turtle Examples that match the examples in this appendix.

Resources

Below is an example JSON representation of the example blog entry.

{  
   "prefixes" : {
      "oslc": "http://open-services.net/ns/core#",
      "rdf" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
      "foaf" : "http://http://xmlns.com/foaf/0.1/",
      "dcterms" : "http://purl.org/dc/terms/"
   },
   "rdf:type" : [ { "rdf:resource" : "http://open-services.net/ns/bogus/blogs#Entry" } ],
   "rdf:about" : "http://example.com/blogs/entry/1",
   "dcterms:title" : "I love trash",
   "dcterms:modified" : "2002-10-10T12:00:00-05:00",
   "dcterms:content" : "Anything dirty or dingy or dusty. \\nAnything ragged or rotten or rusty.",
   "dcterms:creator" : {
      "foaf:name" : "Oscar T. Grouch"
   }
}
 

Below is an example JSON representation of the example blog comment.

{  
   "prefixes" : {
      "oslc_blog": "http://open-services.net/ns/bogus/blogs#",
      "rdf" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
      "foaf" : "http://http://xmlns.com/foaf/0.1/",
      "dcterms" : "http://purl.org/dc/terms/"
   },
   "rdf:type" : [ { "rdf:resource" : "http://open-services.net/ns/bogus/blogs#Comment" } ],
   "rdf:about" : "http://example.com/comments/1",
   "oslc_blog:Entry" : { "rdf:resource" : "http://example.com/blogs/entry/1" },
   "dcterms:modified" : "2002-10-10T12:12:23-05:00",
   "dcterms:content" : "LOL! Tell us how you really feel, Oscar.",
   "dcterms:creator" : {
      "foaf:name" : "William B. Bird"
   }
}
 

Service Provider Resource

Below is an example JSON representation of the example blog service provider.

{
   "prefixes" : {
      "oslc": "http://open-services.net/ns/core#",
      "rdf" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
      "foaf" : "http://http://xmlns.com/foaf/0.1/",
      "dcterms" : "http://purl.org/dc/terms/"
   },

   "rdf:type" : [ { "rdf:resource" : "http://open-services.net/ns/core#ServiceProvider" } ],
   "rdf:about" : "http://example.com/service-provider",

   "dcterms:title" : "Blogging Service",
   "dcterms:description": "Example OSLC Blog Service",

   "dcterms:publisher" : {
      "dcterms:title" : "OSLC Core Workgroup documentation department",
      "dcterms:identifier": "com.example.oslc.blogservice",
      "oslc:icon" : { "rdf:resource" : "http://example.com/icons/myprod.ico"}
   },

   "oslc:prefixDefinition" : [{
      "oslc:prefix" : "dc",
      "oslc:prefixBase" : { "rdf:resource" : "http://purl.org/dc/elements/1.1/" }
   },
   {  "oslc:prefix" : "oslc_blog",
      "oslc:prefixBase" : { "rdf:resource" : "http://open-services.net/ns/bogus/blogs#"} 
   },
   { "oslc:prefix" : "foaf",
      "oslc:prefixBase" : { "rdf:resource" : "http://http://xmlns.com/foaf/0.1/"} 
   },
   { "oslc:prefix" : "rdf",
      "oslc:prefixBase" : { "rdf:resource" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#"} 
   }],

   "oslc:service" : [{
         "oslc:domain": { "rdf:resource" : "http://open-services.net/ns/bogus/blogs#"},

         "oslc:creationFactory": [{
            "dcterms:title": "Location for creation of Blog Entries",
            "oslc:label": "Blog Entries",
            "oslc:creation" : { "rdf:resource" : "http://example.com/creation/entries" },
            "oslc:resourceShape" : [{ "rdf:resource" : "http://example.com/shapes/blogentry" }]
         },
         {
            "dcterms:title": "Location for creation of Blog Comments",
            "oslc:label": "Blog Comments",
            "oslc:creation" : { "rdf:resource" : "http://example.com/creation/comments" },
            "oslc:resourceShape" : [{ "rdf:resource" : "http://example.com/shapes/blogcomment" }]
         }],
         "oslc:queryCapability":[{
               "dcterms:title" : "Blog Entry and Comment Query",
               "oslc:label" : "blogquery",
               "oslc:queryBase" : { "rdf:resource" : "http://example.com/query"},
               "oslc:resourceShape" : [{ "rdf:resource" : "http://example.com/shapes/blogquery" }]
         }]
     }]
}

Query Resource

Below is an example JSON representation of the example blog query result searching for the text string "remote"

{
   "prefixes" : {
      "oslc": "http://open-services.net/ns/core#",
      "oslc_blog": "http://open-services.net/ns/bogus/blogs#",
      "rdf" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
      "foaf" : "http://http://xmlns.com/foaf/0.1/",
      "dcterms" : "http://purl.org/dc/terms/"
   },
   "rdf:type" : [ { "rdf:resource" : "http://open-services.net/ns/bogus/blogs#BlogQuery" } ],
   "rdf:about" : "http://example.com/query",

   "oslc:responseInfo" : {
      "dcterms:title" : "Blog Service Query Results for term [remote]",
      "rdf:about" : "http://example.com/query?oslc.searchTerms="remote"",
      "oslc:nextPage" : { "rdf:resource" : "http://example.com/query?oslc.searchTerms="remote"&page=2"}
   },

   "oslc_blog:Comment" : [{
       "rdf:resource" : "http://example.com/blogs/comment/346"  },
    {  "rdf:resource" : "http://example.com/blogs/comment/344"  },
    {  "rdf:resource" : "http://example.com/blogs/comment/673"  },
    {  "rdf:resource" : "http://example.com/blogs/comment/232"  },
    {  "rdf:resource" : "http://example.com/blogs/comment/333"
    }]
}
Topic revision: r13 - 05 Nov 2012 - 18:25:25 - SteveSpeicher
Main.OSLCCoreSpecJSONExamples moved from Main.OSLCCoreSpecAppendixD on 22 Oct 2010 - 18:34 by DaveJohnson - put it back
 
This site is powered by the TWiki collaboration platform Copyright � by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Contributions are governed by our Terms of Use
Ideas, requests, problems regarding this site? Send feedback