Yes, if table2.table1_id is declared as a foreign key in the database schema, 
then generate_mapping will automatically produce the output you want.

Maybe your database doesn't declare any foreign keys? This is common in MySQL 
databases, because until a few years ago MySQL didn't support checking of 
foreign keys. You should be able to check by running “SHOW CREATE TABLE 
table2;” in MySQL.

Best,
Richard


> On 20 Dec 2013, at 07:59, "Fabian Cretton" <fabian.cret...@hevs.ch> wrote:
> 
> Thank you Richard, maybe I don't see it.
> 
> I have a situation like this:
> table1.id (the primary key)
> table1.name
> 
> table2, which primary key is:
> table1.id
> timestamp
> 
> It does generate (simplified example):
> map:table2_table1_id a d2rq:PropertyBridge;
> d2rq:column "table2.table1_id";
> d2rq:datatype xsd:integer;
> 
> 
> Here is a very standard SPARQL query for me:
> select *
> {
> ?aTable2Instance a table2;
> hereALinkToTable1 ?table1Instance.
> ?table1Instance name ?name.
> }
> 
> In order to do such a query, I obviously can't use the "table2_table1_id" 
> property bridge which just gives me an ID.
> 
> I thus linked the table 2 to table 1 manually, by defining:
> map:table2_table1 a d2rq:PropertyBridge;
> d2rq:property vocab:table2_table1;
> d2rq:refersToClassMap map:table1;
> d2rq:join "table2.table1_id => table1.id";
> 
> Do you mean that the generate-mapping tool handle this automatically and I 
> didn't find it ?
> 
> Thank you
> Fabian
> 
> 
> 
>>>> Richard Cyganiak <rich...@cyganiak.de> 19.12.2013 11:58 >>>
> Fabian, 
> 
> On 19 Dec 2013, at 09:40, "Fabian Cretton" <fabian.cret...@hevs.ch> wrote:
> 
> 
> 
> As far as I can see, the default generate-mapping tool don't link the 
> instances of the tables which are linked by foreign keys.
> 
> 
> It does generate links for any foreign keys declared in the DB schema.
> 
> Best,
> Richard
> 
> 
> 
> 
> 
> 
> Is it right that we have to manually create all those links as described 
> here: 
> http://d2rq.org/d2rq-language#example-refers 
> 
> Is it something that could be easily automated, but was just not useful so 
> far ?
> 
> Thank you
> Fabian
> 
> 
> ------------------------------------------------------------------------------
> Rapidly troubleshoot problems before they affect your business. Most IT 
> organizations don't have a clear picture of how application performance 
> affects their revenue. With AppDynamics, you get 100% visibility into your 
> Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
> http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk 
> 
> 
> _______________________________________________
> d2rq-map-devel mailing list
> d2rq-map-devel@lists.sourceforge.net 
> https://lists.sourceforge.net/lists/listinfo/d2rq-map-devel 
> 

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
d2rq-map-devel mailing list
d2rq-map-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/d2rq-map-devel

Reply via email to