You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by Steven Blanchard <st...@microbiome.studio> on 2023/01/21 09:11:56 UTC
launch a tdbquery on multiple location
Hello,
I would like to know if it is possible to perform a query with
tdb2.tdbquery on multiple tdb folder?
It is possible to put several times the --loc argument in the command
line but in the results, I have only the triple matches to the 2nd
folder.
example with Order 1 :
```bash
apache-jena-4.7.0/bin/tdb2.tdbquery --loc Demo_2/ --loc Demo_1/ --query
demo.sparql
?s ?p ?o
<<http://example.org/#spiderman>> <<http://www.perceive.net/schemas/relationship/enemyOf>> <<http://example.org/#green-goblin>>
```
example with Order 2:
```bash
apache-jena-4.7.0/bin/tdb2.tdbquery --loc Demo_1/ --loc Demo_2/ --query
demo.sparql
?s ?p ?o
<<http://example.org/#spiderman>> <<http://www.perceive.net/schemas/relationship/loveOf>>
<<http://example.org/#lois_lane>>
```
demo.sparql:
```sparql
SELECT *
WHERE {?s ?p ?o}
```
I would like that the data available in both folder are merged to form
a new default graph for the query.
Thanks,
Regards,
Steven
Re: launch a tdbquery on multiple location
Posted by Andy Seaborne <an...@apache.org>.
On 21/01/2023 09:11, Steven Blanchard wrote:
> Hello,
>
> I would like to know if it is possible to perform a query with
> tdb2.tdbquery on multiple tdb folder?
It is not possible.
>
> It is possible to put several times the --loc argument in the command
> line but in the results, I have only the triple matches to the 2nd folder.
That should be an error.
Could you file an issue please?
>
> example with Order 1 :
> ```bash
> apache-jena-4.7.0/bin/tdb2.tdbquery --loc Demo_2/ --loc Demo_1/ --query
> demo.sparql
>
> ?s ?p ?o
> <<http://example.org/#spiderman>>
> <<http://www.perceive.net/schemas/relationship/enemyOf>>
> <<http://example.org/#green-goblin>>
> ```
>
> example with Order 2:
> ```bash
> apache-jena-4.7.0/bin/tdb2.tdbquery --loc Demo_1/ --loc Demo_2/ --query
> demo.sparql
>
> ?s ?p ?o
> <<http://example.org/#spiderman>>
> <<http://www.perceive.net/schemas/relationship/loveOf>>
> <<http://example.org/#lois_lane>>
> ```
>
> demo.sparql:
> ```sparql
> SELECT *
> WHERE {?s ?p ?o}
> ```
>
> I would like that the data available in both folder are merged to form a
> new default graph for the query.
There is tdb2:unionDefaultGraph true ; for all named graphs in one
database as the default graph.
You can also define a general dataset and include (union) graphs from
several other storage units.
Another way is to use federated query (SERVICE)
https://jena.apache.org/documentation/query/service_enhancer.html
(The two TDB folders can't simply be used together because the internal
ids were allocated in such a way that they will overlap).
Andy
>
> Thanks,
> Regards,
>
> Steven
>
>