Reputation: 215
I'm trying to do a query with a cardinality restriction. The query looks like
ClassA and (roleA min 2 ClassB)
but this returns an empty set. On the other hand when I do the query
ClassA and (roleA some ClassB)
it returns some individuals of ClassA. Why does the cardinality query not work when I know there are definitely a least two roleAs on some ClassA individuals?
To be more specific, I have the classes Team, Player and Position, and object properties employs (which relates Teams and Players), and hasPosition (which relates Players and Positions). I'm trying to do the query
Team and employs min 2 (Player and hasPosition some { Striker**}**)
which should return the teams with two or more Strikers but obviously because OWL doesn't make the unique name assumption it returns an empty set. I have tried to declare that some of my individuals are distinct, but when I execute the query with the distinct individuals in place it causes Protégé to crash. Protégé does not crash when running the query without the distinct individuals.
Edit:
Error Message from Pellet in Protege Striker shown in Ontology XML
Upvotes: 2
Views: 2024
Reputation: 85813
There's not enough information in this question yet to determine why you're not getting the results that you're looking for, but we can reproduce the scenario well enough to show that this achievable. Consider an ontology with three classes and some individuals:
and the axioms
Then the query
returns the individual team1. (This works with “hasPosition some {Striker}”, too, but for just one value, I think that the value keyword is a better fit.)
Here's the ontology:
@prefix : <http://stackoverflow.com/q/22688901/1281433/competitions#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
<http://stackoverflow.com/q/22688901/1281433/competitions>
a owl:Ontology .
:Player a owl:Class .
:Position a owl:Class .
:Team a owl:Class .
:hasPosition a owl:ObjectProperty .
:Striker a owl:NamedIndividual , :Position .
:p1 a owl:NamedIndividual , :Player ;
:hasPosition :Striker .
:p2 a owl:NamedIndividual , :Player ;
:hasPosition :Striker .
[ a owl:AllDifferent ;
owl:distinctMembers ( :p1 :p2 )
] .
:team1 a owl:NamedIndividual , :Team ;
:employs :p1 , :p2 .
Upvotes: 1