- From: Ivan Herman <ivan@w3.org>
- Date: Mon, 10 Apr 2017 14:49:20 +0200
- To: Phil Archer <phila@w3.org>
- Cc: W3C POE WG <public-poe-wg@w3.org>
- Message-Id: <091ACD93-E804-478A-B86E-E58C77CAA251@w3.org>
> On 10 Apr 2017, at 14:22, Phil Archer <phila@w3.org> wrote: > > Dear all, > > During last week's meeting, I volunteered to start collecting examples that can go into a test suite. > > Good news - the vocabulary document already includes 12 examples, each of which is available in multiple serialisations (JSON-LD, TTL, NT, HTML and XML). > > First question - can someone kindly walk me through how these are being generated? I see tools in the directory. Can I start from any serialisation? > > Presumably, given that these files all exist, the plan is to include them as external files with the vocabulary document? That can certainly be done, with content negotiation all set up. > > To show one possible method using ReSpec, I've set up an example at > https://philarcher1.github.io/poe/vocab/#targetAsset > > The relevant markup is: > > <pre class="example hljs xquery" title='(<a href="examples/example1">Canonical</a>, <a href="examples/example1.xml">XML</a>, <a href="examples/example1.json">JSON-LD</a>, <a href="examples/example1.ttl">Turtle</a>, <a href="examples/example1.nt">NT</a>, <a href="examples/example1.html">HTML</a>)'> > > Turning to the Model document, it has a lot of examples - 27 in all. These have not yet been turned into discrete files AFAICT. > > Looking at Example 1, I see > > { > "@context": { > "odrl": "http://www.w3.org/ns/odrl/2/" > }, > "@type": "odrl:Set", > "@id": "http://example.com/policy:1010", > "permission": [{ > "target": "http://example.com/asset:9898", > "action": "odrl:read" > }], > "prohibition": [{ > "target": "http://example.com/asset:9898", > "action": "odrl:reproduce" > }] > } > > If I put that through a converter, I get just one triple: > > <http://example.com/policy:1010> a odrl:Set . > > All the permissions appear to be absent. So there's an error somewhere and I fiddled around That is because the @context part is incomplete. If you do something like: { "@context": { "odrl": "http://www.w3.org/ns/odrl/2/", "permission" : "odrl:permission", "target":"odrl:target", "action":"odrl:action", "prohibition": "odrl:prohibition" }, "@type": "odrl:Set", "@id": "http://example.com/policy:1010", "permission": [{ "target": "http://example.com/asset:9898", "action": "odrl:read" }], "prohibition": [{ "target": "http://example.com/asset:9898", "action": "odrl:reproduce" }] } I believe we get what we want. Ideally, we should use an external context document that we would refer to. Ivan > and, well, first I need to go back to Turtle so I can see what I'm doing. I get this: > > @prefix odrl: <http://www.w3.org/ns/odrl/2/> . > > <http://example.com/policy:0231> > a odrl:Set ; > odrl:permission [ > a odrl:Permission; > odrl:target <http://example.com/asset:9898>; > odrl:action odrl:read > ]; > odrl:prohibition [ > a odrl:Prohibition; > odrl:target <http://example.com/asset:9898>; > odrl:action odrl:reproduce > ] . > > > Which converts to JSON-LD as > > { > "@context": { > "odrl": "http://www.w3.org/ns/odrl/2/", > "rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#", > "rdfs": "http://www.w3.org/2000/01/rdf-schema#", > "xsd": "http://www.w3.org/2001/XMLSchema#" > }, > "@graph": [ > { > "@id": "http://example.com/policy:0231", > "@type": "odrl:Set", > "odrl:permission": { > "@id": "_:ub6bL4C18" > }, > "odrl:prohibition": { > "@id": "_:ub6bL9C20" > } > }, > { > "@id": "_:ub6bL9C20", > "@type": "odrl:Prohibition", > "odrl:action": { > "@id": "odrl:reproduce" > }, > "odrl:target": { > "@id": "http://example.com/asset:9898" > } > }, > { > "@id": "_:ub6bL4C18", > "@type": "odrl:Permission", > "odrl:action": { > "@id": "odrl:read" > }, > "odrl:target": { > "@id": "http://example.com/asset:9898" > } > } > ] > } > > > I'll see if I can simplify that into something more readable but the my basic question is do the 27 examples in the model document and the 12 in the vocab document give a good spread and therefore can provide the basis of a test suite? > > This also addresses my action-43 which is about invalid JSON-LD examples. > > Phil > > > -- > > > Phil Archer > Data Strategist, W3C > http://www.w3.org/ > > http://philarcher.org > +44 (0)7887 767755 > @philarcher1 > ---- Ivan Herman, W3C Publishing@W3C Technical Lead Home: http://www.w3.org/People/Ivan/ mobile: +31-641044153 ORCID ID: http://orcid.org/0000-0003-0782-2704
Received on Monday, 10 April 2017 12:49:33 UTC