- From: Richard Cyganiak <richard@cyganiak.de>
- Date: Tue, 2 Aug 2011 21:18:12 +0100
- To: Souripriya Das <souripriya.das@oracle.com>
- Cc: public-rdb2rdf-wg@w3.org, "Sundara,Seema" <seema.sundara@oracle.com>
Souri, Seema, I agree that what you write below is certainly one way of mapping the given schema to RDF. But what if I have to map the schema to an existing target ontology that doesn't have a class for enrolments? But only has classes for students and courses, plus an enrolledIn property to connect them? I feel that this doesn't really answer the question I was asking. Best, Richard On 2 Aug 2011, at 16:53, Souripriya Das wrote: > 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 20:19:01 UTC