Strawman for a custom R2RML syntax

Orri has asserted in a previous thread that RDF and XML are both  
unsuitable for being read or written by humans, and that a custom  
syntax is needed. I don't agree with these viewpoints, but I'm curious  
about the potential of a custom syntax, so today spent a few hours on  
a plane to come up with a strawman of my own.

This custom syntax combines ideas from Souri's approach (use a full- 
blown SQL query for transformations) with ideas from Virtuoso RDF  
Views (Turtle-like templates in the spirit of SPARQL CONSTRUCT;  
definition of URI patterns as “functions”). The general flavour of the  
RDF Views syntax is quite SQL-like; I tried to give it a more SPARQL- 
like feel.

The strawman is here:

http://www.w3.org/2001/sw/rdb2rdf/wiki/R2RML_in_a_custom_syntax

It's indeed quite concise, which is nice.

I'm NOT proposing any concrete action related to this, but thought it  
might be interesting for those who want to explore different  
alternatives in the syntax area.

An example that is roughly equivalent to Souri's latest XML example is  
attached at the end of this mapping. Can you read it and understand  
what's going on? Think about SPARQL's CONSTRUCT queries when reading  
it ...

Best,
Richard




PREFIX biz: <http://biz.example.org/biz-ontology#>
BASE <http://example.com/>

IRIPATTERN deptIRI AS <dept/{1}>
IRIPATTERN empIRI AS <emp/{1}>

ID :empMap
SQL {
     Select deptno, dname, loc from dept
}
UNIQUE KEY ?deptno
GRAPH <data/departments>
TEMPLATE {
     deptIRI(?deptno) a biz:Department;
         biz:name ?dname;
         biz:location ?loc .
}

ID :deptMap
SQL {
     Select empno, job, etype, ename, deptno from emp
}
UNIQUE KEY ?empno
FOREIGN KEY ?deptno REFERENCES ID :empMap(?deptno)
GRAPH <data/{?job}/{?etype}>
TEMPLATE {
     empIRI(?empno) a biz:Employee;
         a <jobs/{?job}>;
         a <etypes/{?etype}>;
         biz:employeeNumber ?empno;
         biz:name ?ename;
         biz:department deptIRI(?deptno);
}

Received on Sunday, 29 August 2010 14:45:14 UTC