Hi,
We have the following tree ontology model:
Item, Category and Product are classes
Category and Product are subclasses of Item
Item has a "parent" property and Category has "child" property
We want to query the sub-tree of a category and level of each
sub-node. We achieved that with the query below:
PREFIX itemTree:<http://itemTree/>
SELECT ?itemChildren (COUNT(?itemChildrensParents) AS
?level) WHERE
{?itemChildren itemTree:parent+ itemTree:Giyim.
?itemChildrensParents itemTree:child+
?itemChildren. }
GROUP BY ?itemChildren ORDER BY ?level
We want to use this query as a subquery of another one to union the
results with other results. But, if we use the query above as a
subquery (as seen below), ?level values returns null.
PREFIX itemTree:<http://itemTree/>
SELECT ?itemChildren ?level WHERE {
{SELECT ?itemChildren (COUNT(?itemChildrensParents)
AS ?level) WHERE
{?itemChildren itemTree:parent+ itemTree:Giyim.
?itemChildrensParents itemTree:child+
?itemChildren. }
GROUP BY ?itemChildren ORDER BY ?level" }
}
If we don't use property path in the subquery (removing + sign from
the predicates), the query returns 1 for all ?level values as you can
predict. But, we need the count of property path.
We use arq 2.8.8. Is it not allowed to use property path in subqueries?
Thank you.
Tayfun