Re: ISSUE-19: Reuse a SQL query as a sub-query

[Copy of a note I placed here:
http://www.w3.org/2001/sw/rdb2rdf/track/issues/19]

This is an example of how the Revelytix Spyder product supports combining
SQL statements. The TriplesMap below has multiple sources (each of which is
a logical table with a name/label). The TriplesMap includes a "joinString"
property defining how to join these two sub-queries. One way to think of
this is that a TriplesMap is also an RDF representation of a SQL query.

This is just one example, there are other mapping properties used for things
like specifying "opaque" SQL statements (i.e. db vendor specific SQL) and
joining on simple criteria. The full power of SQL is not exposed in RDF
properties (e.g. HAVING is not supported in the RDF representation of a
query, although it is supported in the SQL patterns themselves). If there is
interest I can provide more examples of how these properties are used.

The Revelytix mapping language constructs are described here:
* http://www.knoodl.com/ui/groups/Mapping_Ontology_Community
*
http://www.knoodl.com/ui/groups/Mapping_Ontology_Community/wiki/RDB_Mapping_Language_Specification_v0.2;jsessionid=C12F6F58064DE95E4F519DA73B700F5A

-David

----

@prefix rr: <http://www.w3.org/ns/r2rml#> .
@prefix map: <http://revelytix.com/spyder/vocab/mapping/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .

<http://mine/Person>
   a <http://www.w3.org/2000/01/rdf-schema#Class>, <
http://www.w3.org/2002/07/owl#Class>
.

<http://mine/SQLPattern>
   a map:SQLPattern;
   rdfs:label "job_query";
   map:pattern "SELECT * FROM JOB";
   map:opaque "true";
  map:columns "JOB_ID ASSIGNED_ID";
.

<http://mine/SubjectMap>
   rr:template "{EMPLOYEE_ID}-{job_query.JOB_ID}";
   rr:class <http://mine/Person>
.

<http://mine/TriplesMap>
   a rr:TriplesMapClass;
  map:source <http://db/Table/EMPLOYEE>;
   map:source <http://mine/SQLPattern>;
  map:joinString "EMPLOYEE join job_query on EMPLOYEE.EMPLOYEE_ID =
job_query.ASSIGNED_ID";
   rr:subjectMap <http://mine/SubjectMap>;
.

Received on Wednesday, 20 April 2011 13:24:50 UTC