Thanks for the suggestion on the Ant arg issue, that worked.
With passing the tdb:unionDefaultGraph=true, without any FROM or FROM NAMED, I 
get no results.
I have tried numerous variations, trying to get results.
I have two graphs, call them P and I.
I have annotated lines in the following query.

select distinct ?subjid
where {
                ?subj p:hasDiagnosis ?diag .      #1: in graph P
                ?subj p:hasPatientID ?subjid .  #2: in graph P
                ?diag rdf:type ?diagType .         #3: in graph I
        FILTER ( ?diagType = HOM_ICD9:HOM_ICD_1224) .   #4: in graph I
}

I have tried this query 3 ways: no FROM or FROM NAMED, use FROM, use FROM NAMED.
None of them work (I get no results).

I have also tried using GRAPH in the query, but that yields no results either.
I read somewhere that a variable in different GRAPH sections of a query are not 
shared.

I can query for triples in the individual graphs, that produces expected 
results.
But I need to query across graphs P and I.


----Original Message-----
From: Dave Reynolds [mailto:[email protected]] 
Sent: Thursday, September 22, 2011 11:29 AM
To: [email protected]
Subject: Re: query on several models in TDB

Hi,

On Thu, 2011-09-22 at 13:56 +0000, David Jordan wrote: 
> I have my data in more than one model in TDB and I am trying to write a query 
> that spans across them.
> 
> I did try using the following FROM clause.
> FROM <urn:x-arq:UnionGraph>
> This worked, but there was a long delay in producing results (as compared to 
> running against one named graph).
> So I am guessing that what took so long was that a union was literally being 
> created before the query was executed.
> My hope was that this would just do the query across all the graphs in the 
> database.

I believe that is what happens. 

The slow down may be due to the query having a lot more data visible to it.

> Something else I am trying to get working is using the following in my Ant 
> script that runs tdbquery.
>         <target name="tdb.query" >
>                 <java classname="tdb.tdbquery" fork="true" >
>                         <classpath refid="tdb.classpath" />
>                         <arg value="--tdb=${assembler.file}" />
>                         <arg value="--set tdb:unionDefaultGraph=true" />
>                         <arg value="--query=${query}" />
>                 </java>
>         </target>
> 
> Executing 'C:\Program Files\Java\jdk1.6.0_21\jre\bin\java.exe' with arguments:
> '-classpath'
> 'C:\Documents and Settings\davjor\My 
> Documents\Jena\TDB-0.8.11-SNAPSHOT\lib\arq-
> Documents\Jena\TDB-0.8.11-SNAPSHOT\lib\jena-2.6.4.jar;C:\Documents and 
> Settings\                     I cut this off, too long.
> b\tdb-0.8.11-SNAPSHOT.jar;C:\Documents and Settings\davjor\My 
> Documents\Jena\TDB 'tdb.tdbquery'
> '--tdb=db.ttl'
> '--set tdb:unionDefaultGraph=true'
> '--query=query/haslungcancer.rq'
> 
> The ' characters around the executable and arguments are not part of the 
> command.
> Unknown argument: set tdb

Try with:
    <arg value="--set" />
    <arg value="tdb:unionDefaultGraph=true" />

Dave



Reply via email to