- From: Stian Soiland-Reyes <soiland-reyes@cs.manchester.ac.uk>
- Date: Mon, 20 Oct 2014 11:55:53 +0100
- To: Victor Porton <porton@narod.ru>
- Cc: SW-forum Web <semantic-web@w3.org>
Are these transformations basically a kind of provenance of how
something was created - or is it a plan of how something can be made?
For provenance, any of the serializations of the PROV model should be
a good fit:
http://www.w3.org/TR/prov-primer/
http://www.w3.org/TR/prov-overview/
Using the PROV Toolbox you can convert from/to your favourite and
standard RDF representations.
https://github.com/lucmoreau/ProvToolbox
As an example of how I would express a transformation, using PROV-O and JSON-LD:
{ "@context": { "prov": "http://www.w3.org/ns/prov#",
"prov:wasDerivedFrom": {"@type": "@id" },
"prov:agent": {"@type": "@id" },
"prov:hadPlan": {"@type": "@id" }
},
"@graph": [
{ "@id": "http://example.com/resource1",
"prov:wasDerivedFrom": "http://example.com/resource0",
"prov:wasGeneratedBy": {
"@id": "http://example.com/transformation/c97abb50-1beb-4af9-87b5-ecfcd273769a",
"prov:qualifiedAssociation": {
"prov:agent": "http://example.com/transformationService",
"prov:hadPlan": "http://example.com/script" }
}
},
{ "@id": "http://example.com/resource0",
"...": {}
}
]
}
Basically it says that resource1 was derived from resource0, and its
creation happened in a transformation involving a transformation
service and a script.
This allows you to build a transformation chain of arbitrary length.
You can use anonymous identifiers like "_:intermediate5" for
intermediate resources which don't have URIs. By using the identifiers
you don't need to do the nesting with deeper JSON objects - although
that is also an option.
(Note: In JSON-LD the @context can be externalized, e.g. you only need
"@context": "http://example.com/context" or even just a Link header )
You can tweak the context to make the JSON more natural for your
application, and thus do "Linked Data by stealth"
{ "@context": { "prov": "http://www.w3.org/ns/prov#",
"ex": "http://example.com/vocab#",
"transformedFrom": {"@type": "@id", "@id":
"prov:wasDerivedFrom" },
"transformation": {"@type": "@id", "@id":
"prov:wasGeneratedBy" },
"transformedBy": {"@type": "@id", "@id":
"prov:qualifiedAssociation" },
"script": {"@type": "@id", "@id": "prov:hadPlan" },
"service": {"@type": "@id", "@id": "prov:agent" },
"resources": "@graph",
"id": "@id"
},
"resources": [
{ "id": "http://example.com/resource1",
"transformedFrom": "http://example.com/resource0",
"transformation": {
"id": "http://example.com/transformation/c97abb50-1beb-4af9-87b5-ecfcd273769a",
"transformedBy": {
"service": "http://example.com/transformationService",
"script": "http://example.com/script" }
}
},
{ "id": "http://example.com/resource0",
"...": {}
}
]
}
Using a JSON-LD processor to translated to Turtle/N-Quads, this will
give you the triples:
<http://example.com/resource1>
<http://www.w3.org/ns/prov#wasDerivedFrom>
<http://example.com/resource0> .
<http://example.com/resource1>
<http://www.w3.org/ns/prov#wasGeneratedBy>
<http://example.com/transformation/c97abb50-1beb-4af9-87b5-ecfcd273769a>
.
<http://example.com/transformation/c97abb50-1beb-4af9-87b5-ecfcd273769a>
<http://www.w3.org/ns/prov#qualifiedAssociation> _:b0 .
_:b0 <http://www.w3.org/ns/prov#agent>
<http://example.com/transformationService> .
_:b0 <http://www.w3.org/ns/prov#hadPlan> <http://example.com/script> .
Or as PROV-XML:
<prov:document>
<entity prov:id="http://example.com/resource1"/>
<prov:wasDerivedFrom>
<prov:generatedEntity prov:ref="http://example.com/resource1"/>
<prov:usedEntity prov:ref="http://example.com/resource0"/>
</prov:wasDerivedFrom>
<prov:wasGeneratedBy>
<prov:entity prov:ref="http://example.com/resource1"/>
<prov:activity
prov:ref="http://example.com/transformation/c97abb50-1beb-4af9-87b5-ecfcd273769a"/>
</prov:wasGeneratedBy>
<prov:wasAssociatedWith>
<prov:activity
prov:ref="http://example.com/transformation/c97abb50-1beb-4af9-87b5-ecfcd273769a"/>
<prov:agent prov:ref="http://example.com/transformationService"/>
<prov:plan prov:ref="http://example.com/script"/>
</prov:wasAssociatedWith>
</prov:document>
Note that you can often avoid the distinction between the activity (a
particular transformation), the agent (a transformation service) and a
script (what the agent did) - but I have here separated out the agent
with a script as a plan - therefore the transformation service could
deal with multiple scripts (e.g. in different versions).
On 20 October 2014 00:13, Victor Porton <porton@narod.ru> wrote:
> I need to feed a program I am writing a finite ordered list whose members may be:
>
> * A pair of URLs which denotes a transformation
>
> * A pair of URLs which denotes a script
>
> * A set of URLs (which also describe a kind of transformation)
>
> In short, I need a finite ordered list, which consist of URLs together with information how to use these URLs (e.g. to differentiate between scripts and transformations, each represented as a pair of URLs)
>
> In which file format would you recommend to write this kinds of information?
>
> Should I describe this in RDF?
>
> Are there lists in Turtle?
>
> Or should I recommend users to use RDF/XML because of its explicit loops?
>
> Maybe even to switch from RDF to plain XML?
>
> --
> Victor Porton - http://portonvictor.org
>
--
Stian Soiland-Reyes, myGrid team
School of Computer Science
The University of Manchester
http://soiland-reyes.com/stian/work/ http://orcid.org/0000-0001-9842-9718
Received on Monday, 20 October 2014 10:56:42 UTC