Is this any better?
SELECT DISTINCT ?s ?p ?o WHERE {
GRAPH <http://www.lingsoft.fi/resource-meta/> {
?s <http://purl.org/dc/terms/isPartOf>
<http://www.lingsoft.fi/rdf/uid/574ef1a40236a> .
?s <http://purl.org/dc/terms/subject> ?child .
?s ?p ?o
}
GRAPH <http://www.lingsoft.fi/> {
SELECT DISTINCT ?child WHERE {
{<http://www.lingsoft.fi/c16e9937a515bda6> skos:narrower* ?child}
UNION {<http://www.lingsoft.fi/e56f6309f0d86b95> skos:narrower* ?child} UNION
{<http://www.lingsoft.fi/b393055ac0f3a0bc> skos:narrower* ?child} UNION
{<http://www.lingsoft.fi/642194686a67f935> skos:narrower* ?child} UNION
{<http://www.lingsoft.fi/a9beeb4bf0b0af70> skos:narrower* ?child} UNION
{<http://www.lingsoft.fi/ce3598292f301cec> skos:narrower* ?child} UNION
{<http://www.lingsoft.fi/26aa300e4c033981> skos:narrower* ?child} UNION
{<http://www.lingsoft.fi/bd07d765f36ea88f> skos:narrower* ?child} UNION
{<http://www.lingsoft.fi/bcf9e082e2ae8c9b> skos:narrower* ?child} UNION
{<http://www.lingsoft.fi/78d3955357a8ac10> skos:narrower* ?child} UNION
{<http://www.lingsoft.fi/369b1a9c822f55db> skos:narrower* ?child} UNION
{<http://www.lingsoft.fi/7098a84669b9feca> skos:narrower* ?child} UNION
{<http://www.lingsoft.fi/b7cb30c4efed996a> skos:narrower* ?child}
}
}
}
Regards,
Håvard M. Ottestad
> On 08 Aug 2016, at 11:25, Mikael Pesonen <[email protected]> wrote:
>
>
> Hi,
>
> I'm not if this is the correct forum to ask but hope you can help. This query
> takes over 20 seconds with jena:
>
> SELECT DISTINCT ?s ?p ?o WHERE { GRAPH <http://www.lingsoft.fi/> { SELECT
> DISTINCT ?child WHERE { {<http://www.lingsoft.fi/c16e9937a515bda6>
> skos:narrower* ?child} UNION {<http://www.lingsoft.fi/e56f6309f0d86b95>
> skos:narrower* ?child} UNION {<http://www.lingsoft.fi/b393055ac0f3a0bc>
> skos:narrower* ?child} UNION {<http://www.lingsoft.fi/642194686a67f935>
> skos:narrower* ?child} UNION {<http://www.lingsoft.fi/a9beeb4bf0b0af70>
> skos:narrower* ?child} UNION {<http://www.lingsoft.fi/ce3598292f301cec>
> skos:narrower* ?child} UNION {<http://www.lingsoft.fi/26aa300e4c033981>
> skos:narrower* ?child} UNION {<http://www.lingsoft.fi/bd07d765f36ea88f>
> skos:narrower* ?child} UNION {<http://www.lingsoft.fi/bcf9e082e2ae8c9b>
> skos:narrower* ?child} UNION {<http://www.lingsoft.fi/78d3955357a8ac10>
> skos:narrower* ?child} UNION {<http://www.lingsoft.fi/369b1a9c822f55db>
> skos:narrower* ?child} UNION {<http://www.lingsoft.fi/7098a84669b9feca>
> skos:narrower* ?child} UNION {<http://www.lingsoft.fi/b7cb30c4efed996a>
> skos:narrower* ?child} } } GRAPH <http://www.lingsoft.fi/resource-meta/> { ?s
> <http://purl.org/dc/terms/subject> ?child . ?s
> <http://purl.org/dc/terms/isPartOf>
> <http://www.lingsoft.fi/rdf/uid/574ef1a40236a> . ?s ?p ?o } }First graph
> query is for getting keywords from an ontology graph, second is for querying
> documents having those keywords. Is there better way/order to make this
> query? Thank you for the help, Mikael
>
> --
> www.lingsoft.fi
>
> Speech Applications - Language Management - Translation - Reader's and
> Writer's Tools - Text Tools - E-books and M-books
>
> Mikael Pesonen
> System Engineer
>
> e-mail: [email protected]
> Tel. +358 2 279 3300
>
> Time zone: GMT+2
>
> Helsinki Office
> Eteläranta 10
> FI-00130 Helsinki
> FINLAND
>
> Turku Office
> Linnankatu 10 A
> FI-20100 Turku
> FINLAND
>