- From: Souripriya Das <souripriya.das@oracle.com>
- Date: Tue, 02 Aug 2011 11:53:47 -0400
- To: public-rdb2rdf-wg@w3.org
- CC: "Sundara,Seema" <seema.sundara@oracle.com>
- Message-ID: <4E381D8B.4070707@oracle.com>
There are two constraints in this DB schema (note: changed the table
name from "Enrolled" to "Enrollment" to make it more intuitive):
- Student.s_id = Enrollment.s_id
- Course.c_id = Enrollment.c_id
Since Enrollment is a many-to-many table, the primary key and hence the subject (assuming no duplicates) is: <s_id, c_id>.
We can express the two constraints easily as follows:
<#LinkMapStudentToCourse>
rr:logicalTable [ rr:tableName "Enroll*ment*" ];
rr:subjectMap <#*EnrollmentSubjectMap*>;
* rr:predicateObjectMap [
rr:predicateMap [ rr:predicate rr:involedStudent ];
rr:objectMap [
rr:parentTriplesMap <#StudentTriplesMap>;
rr:join [ rr:child "s_id"; rr:parent "s_id" ];
]
];
* rr:predicateObjectMap [
rr:predicateMap [ rr:predicate rr:*involvedCourse* ];
rr:objectMap [
rr:parentTriplesMap <#CourseTriplesMap>;
rr:join [ rr:child "c_id"; rr:parent "c_id" ];
]
].
This is a clean mapping between DB constraints (which are virtual cols
whose values are primary key for the referenced table) and RDF predicates.
There is no need to try to create a constraint with the subject.
(Subject is a multi-col primary key, not just the s_id column.)
Thanks,
- Souri/Seema.
Received on Tuesday, 2 August 2011 15:54:33 UTC