Replies: 4 comments 1 reply
-
If you generate a query like: SELECT ?s ?o {
?s rdfs:label ?o
} it is normal to have a large union if you used the property Note that classes are not involved at all in this kind of query. In RDF, unlike in OOP, individuals are not required to have classes assigned to them. Also properties are independent from classes. It is not clear to me what you want to achieve. Perhaps, do you have a concrete SPARQL query in mind? |
Beta Was this translation helpful? Give feedback.
-
Let's say we have 2 classes, A and B. Both share some very common properties (name, description, etc) but are otherwise disjointed. We are aware we can use the disjointWith to separate individuals of these 2 classes, but when defining a large set of classes, each one explicitly list a set of disjointed classes is just not practical. Getting back to the SPARQL example at hand, classes are kind of involved in this because, in the query, we have something like: select ?name ?desc where{ ?object a :A; FILTER(?name="XYZ"). } The SQL translation ends up with A UNION ALL B, because both class A and B have the same data properties. I think I may have an acceptable solution, by basically defining an "abstract" parent data property and each domain/class owl defines a subclass data property from the abstract one, and only use the child property in mappings. Let me know if you think this is a sound solution. Thanks! |
Beta Was this translation helpful? Give feedback.
-
We do have control of the IRI templates, but can you explain a bit what you meant by “you use IRI templates that are mutually incompatible”? Is http://abc.org/xzy/A mutually incompatible with http://abc.org/xzy/B ? What about http://abc.org/xzy#A and http://abc.org/xzy#B ? Thank you!
From: Benjamin Cogrel ***@***.***>
Sent: Thursday, February 23, 2023 10:18 AM
To: ontop/ontop ***@***.***>
Cc: Yong H Jin ***@***.***>; Author ***@***.***>
Subject: Re: [ontop/ontop] Avoiding UNION ALL (Discussion #609)
Thanks for the example.
IRI templates in the mapping are the main vector for "disjointness information". If you use IRI templates that are mutually incompatible (they cannot generate the same IRIs), then most of these unions are pruned.
So in most cases, filtering by class (like in "object a :A") helps selecting the relevant IRI templates to consider.
Are you free to choose different IRI templates in your setting?
—
Reply to this email directly, view it on GitHub<#609 (reply in thread)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/A5F4SEOVFXHO5SFYNTRU6NDWY6SULANCNFSM6AAAAAAVDVZ5EY>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Sure. With the following mapping entries
SELECT * {
?c a :Car ; :has_name ?name ; :has_description ?desc
} is translated in a SQL with no UNION (and no join if there is a unique constraint SELECT * {
?e :has_name ?name ; :has_description ?desc
} is translated in a SQL with a single UNION (and no join if there are unique constraints over
If we add the following third mapping entry queries keeps getting well-optimized because |
Beta Was this translation helpful? Give feedback.
-
I am running into the "UNION ALL" problem described on this thread. I understand this is caused by shared properties. Coming from object oriented program, I naturally like to have parent class defines commonly used attributes such as name and description, and extend it to have domain specific attributes. However, this is causing problem where OnTop tries to generate SQLs using UNION ALL with completely unrelated tables/databases.
I understand the simplest solution will be using unique IRIs for the properties, but that defeats the purpose of having common attributes among classes, where I may query for "all individuals with certain attribute". I don't know if owl:disjointWith has been implemented in OnTop since the original discussion in 2021, but I don't see it as a scalable solution even if OnTop has, since explicitly disjoint hundreds and thousands of classes will be next to impossible.
In OWL (and recognized by OnTop), is there a way to have a class disjoint other classes automatically except its own child classes? Is there a way in OnTop to hint and prevents it from generate SQLs that UNION ALL unnecessary? Thank you!
Beta Was this translation helpful? Give feedback.
All reactions