- From: <leyla.garcia@ebusiness-unibw.org>
- Date: Mon, 30 Nov 2009 14:44:28 +0100 (CET)
- To: public-sparql-dev@w3.org
Hello there, I have an object property which can appear more than once. It defines min and max values for prices which should not overlap and I need to check it. <xxx:Toy rdf:ID="car_1"> <xxx:hasPrice> <xxx:Price rdf:ID="price_1"> <xxx:hasMinPrice>300.0</xxx:hasMinPrice> <xxx:hasMaxPrice>450.0</xxx:hasMaxPrice> </xxx:Price> </xxx:hasPrice> <xxx:hasPrice> <xxx:Price rdf:ID="price_2"> <xxx:hasMinPrice>100.0</xxx:hasMinPrice> <xxx:hasMaxPrice>200.0</xxx:hasMaxPrice> </xxx:Price> </xxx:hasPrice> </xxx:Toy> I think I can do it with SPARQL and loops. For each price I need to look at the others and see if values are overlapping so I coudl get the set of all overlapping elements. Something like: FOR EACH (SELECT * WHERE { ?sub xxx:hasPrice ?obj . ?obj xxx:hasMinPrice ?min . ?obj xxx:hasMaxPrice ?max . }) { SELECT * WHERE { ?sub1 xxx:hasPrice ?obj1 . ?obj1 xxx:hasMinPrice ?min1 . ?obj1 xxx:hasMaxPrice ?max1 . FILTER ((?sub = ?sub1?) && (obj <> ?obj1) && (?min1 >= ?min) && (?max1 <= ?max)) } Is something like that possible? How can I accomplish this check? do I have to do it programatically, perhaps in Java, with regular loops? Thanks in advanced, LG
Received on Monday, 30 November 2009 15:45:37 UTC