Warning:
This wiki has been archived and is now read-only.

TF-Graphs-UC/Changes over time

From RDF Working Group Wiki
Jump to: navigation, search

This is an example for a use case from TF-Graphs-UC.

Here is a quick TRiG (assuming g-snap support) example showing two graph snapshots. The home page changes between the two snapshots:

G-SNAP #1 (TRiG):

G1 {
_:bnode1 rdf:type <foaf:Person> ;
         foaf:name "Manu Sporny" ;
         foaf:homepage <http://linkedin.com/in/manusporny> . 
}
G1 dc:date "2010-04-18T01:24Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .

G-SNAP #2 (TRiG):

G1 {
_:bnode1 rdf:type <foaf:Person> ;
         foaf:name "Manu Sporny" ;
         foaf:homepage <http://manu.sporny.org/> . 
}
G1 dc:date "2011-02-01T18:32Z"^^<http://www.w3.org/2001/XMLSchema#dateTime> .

The two examples above look like this in JSON-LD:

G-SNAP #1 (JSON-LD):

{
   "@":
   {
      "a": "<foaf:Person>",
      "foaf:name": "Manu Sporny",
      "foaf:homepage": "<http://linkedin.com/in/manusporny>"
   }
   "dc:date": "2010-04-18T01:24Z^^<http://www.w3.org/2001/XMLSchema#dateTime>"
}

G-SNAP #2 (JSON-LD):

{
   "@":
   {
      "a": "<foaf:Person>",
      "foaf:name": "Manu Sporny",
      "foaf:homepage": "<http://manu.sporny.org/>"
   }
   "dc:date": "2011-02-01T18:32Z^^<http://www.w3.org/2001/XMLSchema#dateTime>"
}

A more complex example involves supporting decentralized product listings via PaySwarm. That is, in PaySwarm products for sale (access to particular post in a blog, or a particular Web App) are expressed in a decentralized manner on a website. The expression of what is for sale is encapsulated in a graph of information about the asset for sale, pricing information and licensing information that is associated with the sale. The combination of this information is effectively an offer of sale:

Here is the example in TRiG format:

G1 {
<http://wordpress.payswarm.dev/?p=65#listing> 
   rdf:type gr:Offering, ps:Listing ;
   com:payee <http://wordpress.payswarm.dev/?p=65#listing-payee> ;
   com:payeeRule [
      rdf:type com:PayeeRule ;
      com:destinationOwnerType ps:Authority ;
      com:maximumRate "10" ;
      com:rateType com:InclusivePercentage ] ;
   ps:assetHash "905ab5980931053792fc63e40fb4afd0a2f55e02" ;
   ps:forAsset <http://wordpress.payswarm.dev/?p=65#asset> ;
   ps:license <http://payswarm.com/licenses/blogging> ;
   ps:licenseHash "0d8866836917f8ef58af44accb6efab9a10610ad" ;
   ps:validFrom "2011-02-26T00:00:00+0000"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
   ps:validUntil "2011-02-27T00:00:00+0000"^^<http://www.w3.org/2001/XMLSchema#dateTime> ;
   ps:signature [
      rdf:type ps:JsonldSignature ;
      dc:created "2011-02-26T00:00:00Z^^<http://www.w3.org/2001/XMLSchema#dateTime>" ;
      dc:creator "https://payswarm.com/i/johnsmith/keys/4" ;
      ps:signatureValue "hluj7gTcjGOhxAfTmr04DXZNYwErXKcNBWqwYnjZCxAPlkl7EUl7H4=" ] .

<http://wordpress.payswarm.dev/?p=65#listing-payee>
   rdf:type com:Payee ;
   com:currency "USD" ;
   com:destination <https://payswarm.com/i/johnsmith/accounts/1> ;
   com:rate "0.05" ;
   com:rateType com:FlatAmount ;
   rdfs:comment "Payment for Intro Blog Article by John Smith." .
}

Here is the same example in JSON-LD format:

{
   "@": "http://wordpress.payswarm.dev/?p=65#listing",
   "a": ["gr:Offering", "ps:Listing"],
   "com:payee": 
   [{
      "@": "http://wordpress.payswarm.dev/?p=65#listing-payee",
      "a": "com:Payee",
      "com:currency": "USD",
      "com:destination": "https://payswarm.com/i/johnsmith/accounts/1",
      "com:rate": "0.05",
      "com:rateType": "<com:FlatAmount>",
      "rdfs:comment": "Payment for Intro Blog Article by John Smith."
   }],
   "com:payeeRule": 
   [{
      "a": "com:PayeeRule",
      "com:destinationOwnerType": "<ps:Authority>",
      "com:maximumRate": "10",
      "com:rateType": "<com:InclusivePercentage>"
   }],
   "ps:assetHash": "905ab5980931053792fc63e40fb4afd0a2f55e02",
   "ps:forAsset": "http://wordpress.payswarm.dev/?p=65#asset",
   "ps:license": "http://payswarm.com/licenses/blogging",
   "ps:licenseHash": "0d8866836917f8ef58af44accb6efab9a10610ad",
   "ps:validFrom": "2011-02-26T00:00:00+0000^^<http://www.w3.org/2001/XMLSchema#dateTime>",
   "ps:validUntil": "2011-02-27T00:00:00+0000^^<http://www.w3.org/2001/XMLSchema#dateTime>",
   "ps:signature":
   {
      "a": "ps:JsonldSignature",
      "dc:created": "2011-02-26T00:00:00Z^^<http://www.w3.org/2001/XMLSchema#dateTime>",
      "dc:creator": "https://payswarm.com/i/johnsmith/keys/4",
      "ps:signatureValue": "hluj7gTcjGOhxAfTmr04DXZNYwErXKcNBWqwYnjZCxAPlkl7EUl7H4="
   }
}

Note the "ps:validFrom" and "ps:vaildUntil" dates - that information changes once a day. Since that information in the graph changes, the signatures on the graph change as well. Because of the daily changes, it is important that one is able to track snapshots of this graph as it changes from day to day. Storing this data in a graph store is particularly challenging w/o the fundamental concept of a graph snapshot (Graph Literal).