Ok lets assume I have 5 datatype properties with integers as values. These properties are asserted to individuals belonging to class "WWS". This class has like 4 individuals. But only some of the datatype properties exist in these individuals. How can I query the individuals of this class that satisfy like the value 5. I want the variable to show only those individuals whose properties are satisfied, rest shouldnt appear.
I hope this is more clear!
Thank you!
Data:
datatype properties (range:integers): #greaterthantoc #lessthantoc #lowerlimtoc #upperlimtoc #equalstoc
individuals: #ww1, #ww2, #ww3 , #ww4 belong to class #WWS
#ww1 has #greaterthantoc "0"^^xsd:integer
#ww2 has #lessthantoc "5"^^xsd:integer
#ww3 has #greaterthantoc "5"^^xsd:integer
#ww4 has #lowerlimtoc "9"^^xsd:integer and #upperlimtoc "10"^^xsd:integer
Conditions for each property (filter?):
#greaterthantoc <= "a number"
#lessthantoc >= "a number"
#lowerlimtoc <= "a number" && #upperlimtoc >= "a number"
#equalstoc = "a number"
Results should be the WWS individuals who satisfy some of these conditions. For example when number is 4 then results should be WW1 and WW2
I suspect I need something like this for my case, but it still wont return results:
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ww:<#>
SELECT ?str
WHERE {?str rdf:type ww:WWS .
OPTIONAL { ?str ww:greaterthantoc ?gr; ww:lessthantoc ?les ; ww:lowerlimtoc ?low ; ww:upperlimtoc ?up ; ww:equalstoc ?eq . }
FILTER ( ?les >= 3 || ?gr <= 3 || (?low <= 3 && ?up >=3) || ?eq = 3)
}
ww:
in the difference examples is a big red flag, though. Until it's edited, this question could be closed for the reason: "This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself." – Continuatefilter ( ... || ... || ... )
, which means "keep solutions that satisfy x or y or z". Now you've gotfilter ... filter ... filter ...
, which means "keep solutions that satisfy x and y and z", which is very different. You need to show the data and the results you're trying to achieve, and you haven't done that yet. – Continuate