Closed cygri closed 12 years ago
Preliminary support for the Direct Mapping has been contributed by @luiseufrasio and for now lives in the direct-mapping
branch: da50a6fc51b9552340828f916639406e992a9710
@luiseufrasio's work has been merged into master
: d84d66e6f0a88784f1d1de946b3e760b75d603dd
Direct Mapping (in its non-duplicate-preserving flavour) is now available via --w3c
switch. We pass all the tests except the duplicate-preservation tests, but still need to incorporate the tests into the standard D2RQ test suite (#135).
Testing with one w3c test case:
Creating the test data:
CREATE TABLE Sport ( ID integer, Name varchar2 (50), PRIMARY KEY (ID) );
CREATE TABLE Student ( ID integer, Name varchar2(50), Sport integer, PRIMARY KEY (ID), FOREIGN KEY(Sport) REFERENCES Sport(ID) );
INSERT INTO Sport (ID, Name) VALUES (100,'Tennis'); INSERT INTO Student (ID, Name, Sport) VALUES (10,'Venus Williams', 100); INSERT INTO Student (ID, Name, Sport) VALUES (20,'Demi Moore', NULL);
commit;
Generating the mapping: (note: this is in the usual d2rq format, yet with the right definitions for the produced output to match the direct mapping standard)
generate-mapping -u uuu -p ppp -d oracle.jdbc.OracleDriver --schemas BROL -o .\configs\prez_dm.ttl --w3c --verbose jdbc:oracle:thin:@srv:1521:db
givs a.o.:
map:BROL_SPORT a d2rq:ClassMap; d2rq:dataStorage map:database; d2rq:uriPattern "BROL/SPORT/ID=@@BROL.SPORT.ID@@"; d2rq:class <BROL/SPORT>; . map:BROL_SPORT_ID a d2rq:PropertyBridge; d2rq:belongsToClassMap map:BROL_SPORT; d2rq:property <BROL/SPORT#ID>; d2rq:column "BROL.SPORT.ID"; d2rq:datatype xsd:decimal; . map:BROL_SPORT_NAME a d2rq:PropertyBridge; d2rq:belongsToClassMap map:BROL_SPORT; d2rq:property <BROL/SPORT#NAME>; d2rq:column "BROL.SPORT.NAME"; .
Obtaining the triples: dump-rdf -o .\dumps\prez_dm_dump.ttl .\configs\prez_dm.ttl
gives a.o.:
file:///C:/d2rq-0.8.1/prez_dump_d2rq.ttl#BROL/STUDENT/10 file:///C:/d2rq-0.8.1/vocab/BROL_STUDENT_SPORT file:///C:/d2rq-0.8.1/prez_dump_d2rq.ttl#BROL/SPORT/100 . file:///C:/d2rq-0.8.1/prez_dump_d2rq.ttl#BROL/STUDENT/10 file:///C:/d2rq-0.8.1/vocab/BROL_STUDENT_NAME "Venus Williams" . file:///C:/d2rq-0.8.1/prez_dump_d2rq.ttl#BROL/STUDENT/10 file:///C:/d2rq-0.8.1/vocab/BROL_STUDENT_ID "10"^^http://www.w3.org/2001/XMLSchema#decimal . file:///C:/d2rq-0.8.1/prez_dump_d2rq.ttl#BROL/STUDENT/10 http://www.w3.org/2000/01/rdf-schema#label "STUDENT #10" . file:///C:/d2rq-0.8.1/prez_dump_d2rq.ttl#BROL/STUDENT/10 http://www.w3.org/1999/02/22-rdf-syntax-ns#type
Add a
--w3c
switch ongenerate-mapping
that produces a mapping file compatible with W3C's Direct Mapping.Here's a rough plan for implementing it:
Add another encoding form to URI patterns, in addition toDoneurlencode
andurlify
:encode
simply applies %-encoding as defined in the specAdd aDoneW3CMappingGenerator
parallel to the existingMappingGenerator
Make sure that in this one, instance/property/class URIs are constructed as defined in the specDoneMake sure that in this one, table and column names are properly encoded as defined under “percent-encode” in the specDoneROWID
makes this easy). (see also this issue in the W3C working group tracker where I try to argue that maybe this should be changed in the spec)