Hi dear, The issue here is the monotonic level of owl, with sparql functions you can get this information, but with owl based rules, or inference not (in a set larger than 2).
The point is that to get that the reasoner (or function) should create a list, order it and extract the first or last element of the list. Luis El dom, 5 dic 2021 a las 14:24, Jakub Jałowiec (< [email protected]>) escribió: > Thanks, that solves the problem and I'll stick to it for now. > Nonetheless, is it possible to automatically infer being an instance of the > hypothetical class "YoungestPerson" ("the person with the lowest foaf:age > aggregate by house") in Apache Jena as described above? Ideally, I would > prefer to separate my conceptual/declarative model from raw data > manipulation using SPARQL. I am new to RDF & ontologies and I am not sure > to what extent keeping those two is possible and if it is worth to actually > invest a lot of time into that. > > Best regards, > Jakub > > niedz., 5 gru 2021 o 10:12 Lorenz Buehmann < > [email protected]> napisał(a): > > > Hi, > > > > > > the common pattern in SPARQL is to get the aggregated value in an inner > > query first, then in the outer query get the entity with the aggregated > > value: > > > > SELECT ?house ?person ?lowestAge { > > ?person foaf:age ?lowestAge . > > ?person covidepid:livesIn ?house . > > > > > > {SELECT ?house (min(?age) as ?lowestAge) > > WHERE { > > ?person foaf:age ?age . > > ?person covidepid:livesIn ?house . > > } > > GROUP BY ?house} > > } > > > > > > > > On 03.12.21 02:16, Jakub Jałowiec wrote: > > > Hi, > > > I would appreciate any help with the following problem. I have a bunch > of > > > (foaf:Persons, myOntology:livesIn, myOntology:Place) triples. I am > trying > > > to find the youngest person in each myOntology:Place (i.e. the person > > with > > > the earliest value of foaf:age for each myOntology:Place). > > > What I've tried so far were: > > > - OWL complex classes (Class Expression Syntax ( > protegeproject.github.io > > ) > > > <http://protegeproject.github.io/protege/class-expression-syntax/>) - > > per > > > my understanding they have too weak expressivity to express aggregates > > > among other individuals associated with them > > > - SPARQL query - something along those lines would work fine but I do > not > > > know how to retrieve the IRI of the youngest person: > > > > > >> SELECT ?house (min(?age) as ?lowestAge) > > >> WHERE { > > >> ?person foaf:age ?age . > > >> ?person covidepid:livesIn ?house . > > >> } > > >> GROUP BY ?house > > > > > > I am curious if extraction of the lowest foaf:age value among a group > of > > > people could be achieved using Apache Jena rules. From the > documentation > > ( > > > https://jena.apache.org/documentation/inference/#rules) it seems to me > > that > > > the closest it gets to it is to write my custom built-in function that > > > would do exactly that. Is that correct? > > > > > > Best regards, > > > Jakub > > > > > >
