Re: [TURTLE] Turtle Inverse Properties

On Tue, Aug 21, 2012 at 07:50:32PM +0100, Andy Seaborne wrote:
> 
> 
> On 21/08/12 13:38, Yves Raimond wrote:
> >As I see it, it is syntactic sugar that would make Turtle much easier
> >to use for some cases - in particular converting legacy data
> >structures.
> 
> Interesting - do you have an example of this you can show the list?

Sure (although I do think I posted it before), and this use-case was also mentioned in Tim's first email:

"""
 It is convenient for machine turtle writers.  If you can use the
is ...of syntax, then you can serialize any acyclic graph of bnodes without
having up make up nodeids for the serialzation, just using [brackets].
"""

We do use https://github.com/moustaki/bbc-serialiser in various places on the BBC website to generate a set of machine-readable representations for our pages. The input for that is a JSON data structure, which is out of our control. For example that JSON might look like:

{
  "type":"episode",
  "id":"episode1",
  "brand":{
    "type":"series",
    "id""series1"
  }
}

When wanting to convert that to RDF, the ontology we use might only define a po:episode predicate, linking a series to an episode. As we reuse quite a lot of external ontologies, it is often the case that the predicates defined in those do not match exactly that first data structure. If we have a way to write inverse properties in Turtle, then in one pass of that data structure, given a simple declarative mapping, we can generate a valid Turtle string like:

:episode1 a po:Episode ; ^po:episode :series1 .
:series1 a po:Series .

Otherwise, we have to generate a proper RDF model out of that data structure, and then generate the Turtle out of it. That's what we're doing right now (using EasyRDF), but it does make things significantly more complex.

Hence, I do think syntactic sugar for inverse properties is useful to translate legacy data structures in RDF without having to use a full-fledged RDF library. It's really quite a similar use-case to @rev in RDFa, really. The way the data ends up being formatted might not match exactly the predicates defined in external ontologies (e.g. wanting to annotate a product-centric rather than offering-centric page with GoodRelations) so there's a need for some syntactic flexibility there.


Best,
Yves

> 
> 	Andy
> 

Received on Wednesday, 22 August 2012 13:22:29 UTC