Hi Pantelis,

You have to combine the recipes

“Example: Property bridge using information from another database table”
“Example: Joining a table to itself using d2rq:alias”

from the manual at
http://www4.wiwiss.fu-berlin.de/bizer/d2rq/spec/

Note in particular the use of d2rq:alias.

Hope that helps,
Richard


On 10 Mar 2011, at 18:16, Pantelis N. Karamolegkos wrote:

> Hi,
>  
> I am using the attached MySQL db schema.
> I want to add a property bridge to the Person Class (derived from the Person 
> table) that will list the persons that each person has interacted with (i.e. 
> the pairings of each person in the TracesOfContacts table).
>  
> I added the following section in the mapping file but it does not seem to 
> work (I don’t even see the property InteractsWith appearing in the web 
> browser), although it does appear in the respective rdf dump
> <http://localhost:2020/vocab/resource/person_InteractsWith> 
> <http://www.w3.org/2000/01/rdf-schema#label> "Has Interacted With the 
> following" .
> <http://localhost:2020/vocab/resource/person_InteractsWith> 
> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> 
> <http://www.w3.org/1999/02/22-rdf-syntax-ns#Property> .
>  
>  
> I have also used the (now in comment) sql statement (after also commenting 
> the d2rq:column "person.ID"; statement) but I get the following error message
> Subquery returns more than 1 row: SELECT DISTINCT `person`.`ID`, (SELECT 
> `tracesofcontacts`.`PersonB` from tracesofcontacts, person WHERE 
> `tracesofcontacts`.`PersonA` = `person`.`ID`) AS expr9eb38d53 FROM 
> `tracesofcontacts`, `person` (E0)
>  
>  
>  
> Any ideas?
>  
> Thanx,
>  
>  
> map:person_InteractsWith a d2rq:PropertyBridge;
>                 d2rq:belongsToClassMap map:person;
>                 d2rq:property vocab:person_InteractsWith;
>                 d2rq:column "person.ID";
>                 #d2rq:sqlExpression "SELECT tracesofcontacts.PersonB from 
> tracesofcontacts, person WHERE tracesofcontacts.PersonA = person.ID";
>                 d2rq:join "tracesofcontacts.PersonA => person.ID";
>                 d2rq:join "tracesofcontacts.PersonB <= person.ID";
>                 d2rq:datatype xsd:integer;
>                 d2rq:propertyDefinitionLabel "Has Interacted With the 
> following";
> <test_db.pdf>------------------------------------------------------------------------------
> Colocation vs. Managed Hosting
> A question and answer guide to determining the best fit
> for your organization - today and in the future.
> http://p.sf.net/sfu/internap-sfd2d_______________________________________________
> d2rq-map-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/d2rq-map-devel


------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
d2rq-map-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/d2rq-map-devel

Reply via email to