Diogo,

This looks like a bug to me. Can you log a report in the D2RQ bug  
tracker on SourceForge?
http://sourceforge.net/tracker/?group_id=111002&atid=657968

An especially important question is whether the translation tables  
have anything to do with the problem. What happens without them?

That being said: Having two d2rq:Databases in a single mapping file  
isn't really supported by the D2RQ SPARQL-to-SQL engine. It may or may  
not work, depending on rather random factors. But still, the choice of  
expansion for the "map:" prefix shouldn't affect the generated query.

Best,
Richard



On 26 Nov 2010, at 16:45, Diogo FC Patrao wrote:

> Hello
>
> Well, I just ran into a rather strange behavior. I'm using the
> translationClass to populate the class vocab:Paciente by two different
> databases. However, depending on the @prefix, it will have different
> behavior to this query:
>
> SELECT DISTINCT * WHERE {
>  ?s a vocab:Paciente.
>  ?s vocab:temMicrofilme ?micro.
>
> }
> LIMIT 10
>
>
> 1) if @prefix map: points to "a.n3", it will try to solve one query  
> that
> join two different databases:
>
> 14:28:06 INFO  ResponseHttp         :: Error: URI = sparql : Table
> 'DBAMV.PACIENTE' doesn't exist: SELECT DISTINCT `T2_prontuario`.`id`,
> `T2_prontuario`.`microfilmado` FROM `DBAMV`.`PACIENTE` AS
> `T1_DBAMV_PACIENTE`, `prontuario` AS `T2_prontuario` WHERE
> `T1_DBAMV_PACIENTE`.`CD_PACIENTE` = `T2_prontuario`.`id` (E0)
>
> 2) if @prefix map: points to "b.n3", or any file that don't exists,  
> it will
> work perfectly:
>
> 14:37:39 DEBUG QueryExecutionIterator :: SELECT DISTINCT
> `T2_prontuario`.`id`, `T2_prontuario`.`microfilmado` FROM  
> `prontuario` AS
> `T1_prontuario`, `prontuario` AS `T2_prontuario` WHERE  
> `T1_prontuario`.`id`
> = `T2_prontuario`.`id`
>
>
> I tried to create a b.n3, which only difference from the file below  
> is the
> mentioned @prefix.
>
> I'll appreciate any help, I'm clueless!
>
>
> Below is my /opt/d2r-server-0.7/a.n3 file.
>
> @prefix map: <file:/opt/d2r-server-0.7/a.n3#> .
> @prefix db: <> .
> @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
> @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
> @prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
> @prefix d2rq: <http://www.wiwiss.fu-berlin.de/suhl/bizer/D2RQ/0.1#> .
> @prefix jdbc: <http://d2rq.org/terms/jdbc/> .
> @prefix vocab: <http://localhost:2020/vocab/resource/> .
>
> map:database_s1 a d2rq:Database;
>    d2rq:jdbcDriver "oracle.jdbc.OracleDriver";
>    d2rq:jdbcDSN "jdbc:oracle:thin:@xxxxxxx/xxxx";
>    d2rq:username "xxxxxx";
>    d2rq:password "xxxxxx";
>    .
>
> map:minha_translation_table a d2rq:TranslationTable;
>    d2rq:javaClass "meuteste.teste2".
>
> map:minha_translation_table_2 a d2rq:TranslationTable;
>    d2rq:javaClass "meuteste.teste3".
>
>
> map:Paciente a d2rq:ClassMap;
>        d2rq:dataStorage map:database_s1;
>        d2rq:uriPattern "PACIENTE/@@XXXXX.PACIENTE.CD_PACIENTE@@";
>        d2rq:class vocab:Paciente;
>        d2rq:classDefinitionLabel "Paciente";
>    d2rq:translateWith map:minha_translation_table;
>        .
>
>
> map:paciente_rgh a d2rq:PropertyBridge;
>        d2rq:belongsToClassMap map:Paciente;
>        d2rq:property vocab:temRghEstiloMv;
>        d2rq:column "XXXX.PACIENTE.CD_PACIENTE";
>        d2rq:datatype xsd:int;
>        .
>
> map:database_same2 a d2rq:Database;
>    d2rq:jdbcDriver "com.mysql.jdbc.Driver";
>    d2rq:jdbcDSN "jdbc:mysql://XXXX:3306/XXXX";
>    d2rq:username "xxxx";
>    d2rq:password "xxxx";
>    .
>
>
> map:PacienteSame2 a d2rq:ClassMap;
>        d2rq:dataStorage map:database_same2;
>        d2rq:uriPattern "PACIENTE/@@prontuario.id@@";
>        d2rq:class vocab:Paciente;
>        d2rq:classDefinitionLabel "Paciente";
>    d2rq:translateWith map:minha_translation_table_2;
>        .
>
> map:paciente_tem_microfilme a d2rq:PropertyBridge;
>        d2rq:belongsToClassMap map:PacienteSame2;
>        d2rq:property vocab:temMicrofilme;
>        d2rq:propertyDefinitionLabel "microfilmado?";
>        d2rq:column "prontuario.microfilmado";
>        .
>
>
>
>
> Diogo F.C. Patrão
> Manager of Medical Informatics
> Biotechnology Laboratory
> Hospital A.C. Camargo
> http://www.accamargo.org.br/
>
>
> On Fri, Nov 26, 2010 at 9:06 AM, Richard Cyganiak  
> <[email protected]>wrote:
>
>> On 25 Nov 2010, at 20:32, Diogo FC Patrao wrote:
>>
>>> Murphy's law #1: just after you bother someone, the answer pops up!
>>>
>>> map:minha_translation_table a d2rq:TranslationTable;
>>>      d2rq:javaClass "meuteste.teste2".
>>>
>>> it worked !
>>>
>>
>> Great to hear that!
>>
>> Best,
>> Richard
>>
>>
>>
>>
>>>
>>>
>>> Diogo F.C. Patrão
>>> Manager of Medical Informatics
>>> Biotechnology Laboratory
>>> Hospital A.C. Camargo
>>> http://www.accamargo.org.br/
>>>
>>>
>>> On Thu, Nov 25, 2010 at 5:53 PM, Diogo FC Patrao <[email protected]
>>>> wrote:
>>>
>>> Hello all
>>>>
>>>> I'm building a data integration system for three patient  
>>>> databases: one
>>>> in
>>>> Oracle, other in Interbase, other in MySQL.
>>>>
>>>> Each one identifies the same patient by a somewhat different ID,  
>>>> so we
>>>> wrote a Java function that maps all IDs to a new, unified, code  
>>>> (let's
>>>> call
>>>> it the unified id, and the others the local ids).
>>>>
>>>> The perfect situation would be to get the unified id directly  
>>>> from the
>>>> database, so I would unify all patient data with it. However
>>>>
>>>> - The function is pretty extensive and I would like to avoid to
>>>> reimplement
>>>> it on the different dialects of SQL above;
>>>>
>>>> - I don't control 2 of the 3 databases, so I can't easily add some
>>>> library
>>>> that allows the database to access the Java function (and I don't  
>>>> even
>>>> know
>>>> if there is such thing! for mysql, afaik*, is no picnic);
>>>>
>>>>
>>>> Alternative 1) So, is there a way I can refer to this function in  
>>>> the
>>>> mapping file, like:
>>>>
>>>> map_xunfa:Conversor a d2rq:ClassMap;
>>>>      d2rq:dataStorage  map_xunfa:database;
>>>>      d2rq:uriPattern "Patient/@@br.accamargo.my_function(
>>>> PACIENTE.LOCAL_ID )@@";
>>>>      d2rq:class vocab:Patient;
>>>>      .
>>>>
>>>>
>>>> Alternative 2) I would map the results of the function into a  
>>>> class.
>>>> Imagine that I produce a table with static contents produced by the
>>>> function:
>>>>
>>>> Unique_id   local_id_1    local_id_2   local_id_3
>>>> 99999999   9                 2828123      42341235
>>>> ...
>>>>
>>>> when in fact my_function_1(local_id_1 ) =  
>>>> my_function_2(local_id_2 )  =
>>>> my_function_3(local_id_3 ) = unique_id.
>>>>
>>>> Then I could map each patient to the same class *Patient*, but  
>>>> would rely
>>>> on SPARQL to integrate information, like
>>>>
>>>> SELECT * WHERE
>>>> {
>>>> ?patient a vocab:Patient.
>>>> ?unique_id vocab:mapsToLocalId ?local_id.
>>>>  FILTER (
>>>>          ?unique_id = 9999999
>>>>  )
>>>>
>>>> }
>>>>
>>>> Or something.
>>>>
>>>> I could create a table with all possible values, but then I would  
>>>> have to
>>>> keep it up-to-date, as the databases are live. So it's possible to
>>>> perform
>>>> such a mapping from a function, instead of a database table?
>>>>
>>>>
>>>> Thanks!
>>>>
>>>> dfcp
>>>>
>>>>
>>>>
>>>>
>>>> *http://planet.mysql.com/entry/?id=13420
>>>>
>>>> Diogo F.C. Patrão
>>>> Manager of Medical Informatics
>>>> Biotechnology Laboratory
>>>> Hospital A.C. Camargo
>>>> http://www.accamargo.org.br/
>>>>
>>>> ------------------------------------------------------------------------------
>>> Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
>>> Tap into the largest installed PC base & get more eyes on your  
>>> game by
>>> optimizing for Intel(R) Graphics Technology. Get started today  
>>> with the
>>> Intel(R) Software Partner Program. Five $500 cash prizes are up  
>>> for grabs.
>>>
>>> http://p.sf.net/sfu/intelisp-dev2dev_______________________________________________
>>> d2rq-map-devel mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/d2rq-map-devel
>>>
>>
>>


------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
d2rq-map-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/d2rq-map-devel

Reply via email to