Hello

I was wondering if there's any way to translate complex date conditions to
SQL in d2rq-0.8.

Expanding a bit: I have this query

    SELECT DISTINCT ?patient
    {
    ?patient a :Patient;
             :patientHasDocument ?docX;
             :patientHasDocument ?docY.

    ?docX :documentType ?docTypeX;
          :documentDateOfCreation ?docDateX;
          .
    ?docY :documentType ?docTypeY;
          :documentDateOfCreation ?docDateY;
          .

    FILTER(
?docTypeX = "PRESCRIPTION"^^xsd:string &&
        ?docTypeY = "PROGRESS NOTE"^^xsd:string &&
        ?docDateX < ?docDateY &&
        ?docDateX > mylib:DateaddLibForARQ( ?docDateY, "-P3D" ) &&
        ?docDateX > mylib:DateaddLibForARQ( "2012-03-22", "-P30D" )
        )
    }


The problem are the last two sentences in FILTER. I'm using custom java
code to perform date operations such as "?docDateY minus three days" or "30
days before 22-mar-2012" (I know, I could substitute the second condition
for a fixed one, but that's not my point - and it wouldn't solve the issue
either, I just tried that).

Problem is, those conditions are not translated to MySQL, so it runs a SQL
query with the remaining conditions, mount results on memory and then
filter. Also, the generated SQL is inneficient (--fast is on), it is
running for 48 hours and counting!

When I wrote this piece of SPARQL with the custom functions, I wasn't aware
of any way of writing a timeframe condition that would be translated into
SQL code.  So I ask now,

Is there a way?

Thanks!

--
diogo patrĂ£o
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
d2rq-map-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/d2rq-map-devel

Reply via email to