How to query triples from earlier construct queries?

32 views
Skip to first unread message

Johan W. Klüwer

unread,
Sep 5, 2017, 2:57:31 PM9/5/17
to Tarql
Hi,

On the Tarql homepage, it says "In Tarql mappings with multiple CONSTRUCT queries, the triples generated by previous CONSTRUCT clauses can be queries in subsequent WHERE clauses to retrieve additional data." Somehow I can't get this to work.

Using this table of data

| col1     | col2         |
|----------+--------------|
| ex:Horse | ex:Vegetable |
| ex:Cat   | ex:Mouse     |
| ex:Dog   | ex:Cat       |
|----------+--------------|


and a query with two construct's

PREFIX ex: <http://example.org/>
construct { ?a ex:p ?b }
{
bind (tarql:expandPrefixedName(?col1) as ?a)
bind (tarql:expandPrefixedName(?col2) as ?b)
}

construct { ex:Cat ex:p ?x }
{
ex:Dog ex:p ?x
}


what I get is

@prefix rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix ex:  <http://example.org/> .

ex:Horse  ex:p  ex:Vegetable .

ex:Cat  ex:p    ex:Mouse .

ex:Dog  ex:p    ex:Cat .

but I was hoping to see

ex:Cat ex:p ex:Dog

as well.


I'm confused -- any hints?

Cheers

Johan

Richard Cyganiak

unread,
Sep 6, 2017, 12:53:39 PM9/6/17
to "Johan W. Klüwer", Tarql
Hi Johan,

This ability got broken in v1.1.

The reason is that we introduced streaming. Constructed triples are now written straight to the output. The change was made to allow processing of very large files. Previously, the triples were added to an in-memory graph, and so could be queried by later CONSTRUCTs.

The fact that streaming breaks this useful feature seems to have entirely escaped our attention.

I’m not quite sure what to do about this. We could just remove the paragraph from the documentation and thereby sweep the issue under the rug. Or maybe disable streaming if a subsequent query has a triple pattern in the WHERE clause. Or maybe something else.

I’ve created an issue for further discussion:

Richard



--
You received this message because you are subscribed to the Google Groups "Tarql" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tarql+un...@googlegroups.com.
To post to this group, send email to ta...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/tarql/27e8389e-9a01-4e9d-985c-a4d2e55a1719%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Johan W. Klüwer

unread,
Sep 6, 2017, 1:28:45 PM9/6/17
to Richard Cyganiak, Tarql
Hi Richard,

Many thanks for the fast response. I'm happy to hear this will be followed up, and of course would vote for the feature being added back in. What I had in mind was to use aggregates in construct queries, and I believe this requires sub-selects -- which are presumably not really possible with the "going through row values" approach. I.e., triples from the first construct could be subject to aggregate querying in later constructs.

Johan

To unsubscribe from this group and stop receiving emails from it, send an email to tarql+unsubscribe@googlegroups.com.

To post to this group, send email to ta...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/tarql/27e8389e-9a01-4e9d-985c-a4d2e55a1719%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Tarql" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tarql+unsubscribe@googlegroups.com.

To post to this group, send email to ta...@googlegroups.com.

Richard Cyganiak

unread,
Sep 6, 2017, 1:38:58 PM9/6/17
to "Johan W. Klüwer", Tarql
On 6 Sep 2017, at 18:28, Johan W. Klüwer <johan.w...@gmail.com> wrote:

What I had in mind was to use aggregates in construct queries, and I believe this requires sub-selects -- which are presumably not really possible with the "going through row values" approach. I.e., triples from the first construct could be subject to aggregate querying in later constructs.

Yes, aggregates are an excellent use case for this feature.

(Another proposal that would help with aggregation is this: https://github.com/tarql/tarql/issues/26 )

Thanks for sharing.

Richard
Reply all
Reply to author
Forward
0 new messages