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 Appendix C: JSON Representation Examples DRAFT

By: The OSLC Core Workgroup

Overview

In this appendix we provide examples JSON representations of the resources defined in Appendix B. These example representations conform to the OSLC Core rules for JSON representations.

Resource

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

{  
   "oslc:namespaceDefinition" : [{
      "qname" : "oslc:NamespaceDefinition"
      "prefix" : "dc",
      "namespaceURI" : "http://purl.org/dc/elements/1.1/" 
   },
   { "qname" : "oslc:NamespaceDefinition"
      "prefix" : "oslc_blog",
      "namespaceURI" : "http://open-services.net/xmlns/oslc-core/bogus/blogs#" 
   },
   { "qname" : "oslc:NamespaceDefinition"
      "prefix" : "foaf",
      "namespaceURI" : "http://http://xmlns.com/foaf/0.1/" 
   },
   {"qname" : "oslc:NamespaceDefinition"
      "prefix" : "rdf",
      "namespaceURI" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
   }],
   "qname" : "oslc_blog:Entry",
   "rdf:type" : { "uri" : "http://open-services.net/xmlns/oslc-core/bogus/blogs#Entry" },
   "uri" : "http://example.com/blogs/entry/42",
   "dc:title", "I love trash",
   "dc:modified" : "2002-10-10T12:00:00-05:00",
   "dc:content", "Anything dirty or dingy or dusty. \\nAnything ragged or rotten or rusty."
   "dc:creator" : {
      "qname" : "foaf:Person",
      "foaf:name" : "Oscar T. Grouch"
   },
}
 

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

{  
   "oslc:namespaceDefinition" : [{
      "qname" : "oslc:NamespaceDefinition"
      "prefix" : "dc",
      "namespaceURI" : "http://purl.org/dc/elements/1.1/" 
   },
   { "qname" : "oslc:NamespaceDefinition"
      "prefix" : "oslc_blog",
      "namespaceURI" : "http://open-services.net/xmlns/oslc-core/bogus/blogs#" 
   },
   { "qname" : "oslc:NamespaceDefinition"
      "prefix" : "foaf",
      "namespaceURI" : "http://http://xmlns.com/foaf/0.1/" 
   },
   {"qname" : "oslc:NamespaceDefinition"
      "prefix" : "rdf",
      "namespaceURI" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
   }],
   "qname" : "oslc_blog:Comment",
   "rdf:type" : { "uri" : "http://open-services.net/xmlns/oslc-core/bogus/blogs#Comment" },
   "uri" : "http://example.com/comments/883",
   "dc:modified" : "2002-10-10T12:12:23-05:00",
   "dc:content", "LOL! Tell us how you really feel, Oscar."
   "dc:creator" : {
      "qname" : "foaf:Person",
      "foaf:name" : "William B. Bird"
   },
}
 

Service Provider Resource

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

{
   "qname" : "oslc:ServiceProvider",
   "uri" : "http://example.com/service-provider",

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

   "dc:contributor" : {
      "qname": "oslc:Contributor",
      "dc:title" : "OSLC Core Workgroup documentation department",
      "dc:identifier": "com.example.oslc.blogservice",
      "oslc:icon" : "http://example.com/icons/myprod.ico"
   },

   "oslc:namespaceDefinition" : [{
      "qname" : "oslc:NamespaceDefinition"
      "prefix" : "dc",
      "namespaceURI" : "http://purl.org/dc/elements/1.1/" 
   },
   { "qname" : "oslc:NamespaceDefinition"
      "prefix" : "rdf",
      "namespaceURI" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
   },
   { "qname" : "oslc:NamespaceDefinition"
      "prefix" : "oslc",
      "namespaceURI" : "http://open-services.net/xmlns/oslc#" 
   },
   {"qname" : "oslc:NamespaceDefinition"
      "prefix" : "oslc_blog",
      "namespaceURI" : "http://open-services.net/xmlns/bogus/blogs#" 
   }],

   "service" : {
         "qname": "oslc:Service",
         "oslc:domain": "http://open-services.net/xmlns/bogus/blogs#",

         "oslc:creationFactory": {
            "qname": "oslc:CreationFactory",
            "dc:title", "Location for creation of Blog Entries",
            "oslc:label", "Blog Entries",
            "oslc:creation" : { "uri" : "http://example.com/creation/entries" },
            "oslc:shape" : { "uri" : "http://example.com/shapes/blogentry" }
         },
         "oslc:creationFactory": {
            "qname": "oslc:CreationFactory",
            "dc:title", "Location for creation of Blog Comments",
            "oslc:label", "Blog Comments",
            "oslc:creation" : { "uri" : "http://example.com/creation/comments" },
            "oslc:shape" : { "uri" : "http://example.com/shapes/blogcomment" }
         },
         "oslc:queryCapability": {
            "qname": "oslc:QueryCapability",
               <dc:title> Blog Entry and Comment Query</dc:title>
               <oslc:label> blogquery </oslc:label>
               <oslc:creation rdf:resource="http://example.com/query" />
               <oslc:shape rdf:resource="http://example.com/shapes/blogquery" />
         },
     }
}

Query Resource

Below is an example JSON representation of the example blog query result.

{
   "oslc:namespaceDefinition" : [ { 
      "qname" : "oslc:NamespaceDefinition"
      "prefix" : "oslc_blog",
      "namespaceURI" : "http://open-serivces.net/xmlns/bogus/blog#" 
   },
   { "qname" : "oslc:NamespaceDefinition"
      "prefix" : "dc",
      "namespaceURI" : "http://purl.org/dc/elements/1.1/" 
   },
   { "qname" : "oslc:NamespaceDefinition"
      "prefix" : "rdf",
      "namespaceURI" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   },
   { "qname" : "oslc:NamespaceDefinition"
      "prefix" : "oslc",
      "namespaceURI" : "http://open-serivces.net/xmlns/core" 
   } ],
   "qname" : "oslc_blog:BlogQuery",
   "uri" : "http://example.com/query?oslc%3Aquery=remote",

   "oslc:responseInfo" : {
      "qname" : "oslc:ResponseInfo",
      "dc:title" : "Blog Service Query Results for term [remote]",
      "oslc:self" : "http://example.com/query?oslc%3Aquery=remote"
      "oslc:nextPage" : "http://example.com/query?oslc%3Aquery=remote&page=2"
   }, 

   "oslc_blog:comment" : [{
       "qname" : "oslc_blog:BlogComment",
       "uri" : "http://example.com/blogs/comment/346",
    },
    { "qname" : "oslc_blog:BlogComment",
       "uri" : "http://example.com/blogs/comment/344",
    },
    { "qname" : "oslc_blog:BlogComment",
       "uri" : "http://example.com/blogs/comment/673",
    },
    { "qname" : "oslc_blog:BlogComment",
       "uri" : "http://example.com/blogs/comment/232",
    },
    { "qname" : "oslc_blog:BlogComment",
       "uri" : "http://example.com/blogs/comment/333",
    }]
}
Topic revision: r3 - 10 May 2010 - 19:56:33 - DaveJohnson
Main.OslcCoreSpecDRAFTJSONRepresentationExamples moved from Main.OslcCoreSpecDRAFJSONRepresentationExamples on 08 May 2010 - 14:05 by ScottBosworth - 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