On 14/04/13 12:32, Diogo FC Patrao wrote:
Hi Andy!


Nowadays ARQ supports date/duration arithmetic (not ARQ 2.8.8)

"2012-03-22"^^xsd:date + "-P30D"^^xsd:duration
    ==>
"2012-02-21"^^xsd:date

You may not need the custom function.


That's awesome! In which version was it available? From what I see, it
doesn't work on jena-arq-2.9.0.

2.9.0 was several releases ago - this is quite recent.

It's in 2.10.0.

The use of a custom functions inside SERVICE isn't ideal.


That's a thing I do for limiting the number of results the service returns,
as there's tens of million triples per service, ARQ would need lots of
memory (for me, 16G or more) to join results. And, as the services are
based on D2R, which is using ARQ 2.9.0, I still need the custom functions =/

I see - yes - necessary.

        Andy

>
I agree that it isn't ideal, as I need to add to the CP of the endpoints.
And, as it's a different ARQ, I ended up with two versions of this
functions, each compiled against one jena version!

Thanks!

dfcp




         Andy




On 12/04/13 22:12, Diogo FC Patrao wrote:

Hello all,

I'm trying to run a SPARQL query specifiying a custom function (that does
date arithmetics). On ARQ 2.8.8, the following code worked perfectly:

PREFIX : 
<http://www.cipe.accamargo.**org.br/ontologias/h2tc.owl#<http://www.cipe.accamargo.org.br/ontologias/h2tc.owl#>

PREFIX xmls: 
<http://www.w3.org/2001/**XMLSchema#<http://www.w3.org/2001/XMLSchema#>


select  * {

SERVICE <http://0.0.0.0:2023/sparql> {
                  :patient1 :hasDocument ?docX .

                  ?docX :documentType "PRESCRIPTION" .
                  ?docX :documentDateOfCreation ?docDateX .
                 FILTER ( xmls:date(?docDateX) >
:xmls:date(<java:dateadd.lib.**pkgfor.arq.DateaddLibForARQ>("**
2012-03-22",
"-P30D")) )

          }
}
limit 10

However, when specifying this function using arq 2.10.1-snapshot (4/3)
(recompiled the library and updated cp), it complains :

18:00:53 WARN  Loader               :: Class not found:
dateadd.lib.pkgfor.arq.**DateaddLibForARQ
18:00:53 WARN  exec                 :: URI
<java:dateadd.lib.pkgfor.arq.**DateaddLibForARQ> has no registered
function
factory


I could get the query working that way:

select  * {

   SERVICE <http://0.0.0.0:2023/sparql> {
                  :patient1 :hasDocument ?docX .

                  ?docX :documentType "PRESCRIPTION" .
                  ?docX :documentDateOfCreation ?docDateX .
          BIND( <java:dateadd.lib.pkgfor.arq.**
DateaddLibForARQ>("2012-03-22"**,
"-P30D") as ?teste )

          FILTER ( ?docDateX >  ?teste )

          }
}
limit 10


Thanks a lot!


--
diogo patrĂ£o





Reply via email to