2

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 Error Message Striker shown in Ontology XML Striker shown in Ontology XML

ChrisDLFC
  • 215
  • 4
  • 9
  • You'll need to show your data. Otherwise, we have no way of knowing what the query *ought* to return. Remember that OWL doesn't make the unique name assumption: If I assert *p(a,b)* and *p(a,c)* and ask for *p min 2*, I won't get *a* unless I've asserted that *b ≠ c*. Otherwise, it could be that be *b = c*, in which case *a* doesn't necessarily have at least two values for *p*. – Joshua Taylor Mar 31 '14 at 14:18
  • You still haven't added your data; you've just added more text that describes it. Without a minimal ontology in which we can see the same problem occur, we can't really diagnose the problem. – Joshua Taylor Mar 31 '14 at 20:05
  • There's still not enough here for us to reproduce the problem (there's no data that we can download, open in Protégé locally, and see the crash ourselves). However, the stack trace and OWL snippet certainly makes this more interesting. It looks like this might be a Pellet bug, in which case the next step may well be to do to the Pellet mailing list… – Joshua Taylor Apr 01 '14 at 13:56
  • If it was just a Pellet bug why would that cause FaCT++ to crash every time I run the query and the HermiT reasoner to not initialise at all when pressing "Start Reasoner", both these other reasoners work fine on smaller ontologies? Should I provide a link so as you can download the ontology? – ChrisDLFC Apr 01 '14 at 14:34
  • Good point about the behavior of different reasoners. I'd still advise that you try using those reasoners outside of Protégé, too, and seeing what behavior you're getting. As to making the ontology available: yes, do that—I've been saying that since the very first comment! :) As it stands now, no one has any chance of reproducing this problem and taking a look at it until you share the data that actually causes the problem. This is standard debugging procedure; if one can't reproduce a bug, then it's much less likely to get fixed. – Joshua Taylor Apr 01 '14 at 15:06
  • OK, I've got the ontology. What players would I have to make different in order for some club to employ at least two strikers? – Joshua Taylor Apr 01 '14 at 15:34
  • it's already set on the ontology I think, Luis_Suarez and Daniel_Sturridge and Iago_Aspas are the 3 I have made different from each other, and the query should return Liverpool_FC. They are the only three I have made disjoint so far as I was just testing it. – ChrisDLFC Apr 01 '14 at 15:39
  • Just a note on terminology: classes (since they're essentially sets) are disjoint; individuals are distinct, or different. (Sorry, just a pet peeve that's been rubbing on me.) – Joshua Taylor Apr 01 '14 at 15:40
  • OK, so the query "inverse(employs) some (employs value Luis_Suarez) and hasPosition value Striker" asks for strikers employed by the same club that employs Luis Suarez, and we get the three results with Pellet that we'd expect (the individuals you mentioned). Other queries are hanging/crashing though… – Joshua Taylor Apr 01 '14 at 15:44
  • If you try with Pellet, it gives you an extensive exception message from the java compiler that might help diagnose the problem. – ChrisDLFC Apr 01 '14 at 15:53

1 Answers1

1

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:

  • Player {p1, p2}
  • Team {team1}
  • Position {Striker}

and the axioms

  • p1 ≠ p2
  • team1 employs p1
  • team1 employs p2
  • p1 hasPosition Striker
  • p2 hasPosition Striker

Then the query

  • Team and employs min 2 (Player and hasPosition value Striker)

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.)

results in Protege

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 .
Joshua Taylor
  • 84,998
  • 9
  • 154
  • 353
  • This is exactly what I have and id have before asking the question, just with more teams and players and positions in the ontology. When running the query Protege freezes each time though with no information as to why in the normal log. – ChrisDLFC Mar 31 '14 at 20:50
  • @ChrisDLFC If you post your data, perhaps we can identify where the difference is. Otherwise, it's not really reproducible, and you're not likely to get a useful answer from Stack Overflow, I'm afraid. – Joshua Taylor Mar 31 '14 at 20:54
  • How can I get a 'snapshot' of the problem area? I have over 5000 individuals so can't really post the ontology Xml file as you have done a few times. – ChrisDLFC Mar 31 '14 at 21:00
  • @ChrisDLFC Well, that's significant information: reasoning with lots of individuals is probably going to be harder for a reasoner (also, what reasoner are you using?) than reasoning with just a few. As the help center says, it's important to [create a Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve). In this case, try serializing your model in Turtle and cutting things out with a text editor until it works in Protégé. Then you can ask "why does this work with 517 individuals, but not 518?" Or maybe it would help to experiment with the command-line Pellet… – Joshua Taylor Mar 31 '14 at 21:23
  • @ChrisDLFC …tools, in which case you might get to a situation where you can ask "why does this work with Pellet on the command line, but not in Protege?" If you've actually got the same kind of structure that I've shown (which we can't guarantee, since we haven't seen your data), then it's not a problem with the OWL modeling or DL query, but with the reasoner or Protege. – Joshua Taylor Mar 31 '14 at 21:23
  • I've built the same Ontology with just one team, two players and one position and it has worked this time. Even though I have over 5000 individuals(mostly Players) so far I have only stated that two have the relationship hasPosition Striker. The reasoner works with all other queries I am trying so I will have to look into it more. I am using Fact++ as my reasoner. The only difference to the above structure is that I have Player subsumed by a Class called Staff. – ChrisDLFC Mar 31 '14 at 21:38
  • @ChrisDLFC Does the same thing happen with a different reasoner? – Joshua Taylor Mar 31 '14 at 21:40
  • I've just tried Pellet, it doesn't freeze but logs an error which says, Striker(shows the full XML link) is not found in the KB(Knowledge Base) but it is there otherwise the same query replacing with 'Some' with min 2 wouldn't work. – ChrisDLFC Mar 31 '14 at 21:50
  • I will edit the original post with some screenshots. – ChrisDLFC Mar 31 '14 at 21:55
  • In the screenshot it shows Striker is subsumed by Forward and then Forward is Subsumed by Position. The same query with both Position and with Forward work, just not with the nominal value 'Striker'. After more investigation it is all Nested Querys which reference nominals for example "Club and employs min 2 (Player and hasPosition value {Striker}) gives an error, but "Player and hasPosition value {Striker}" is fine. Similarly "Club and employs min 2 (Player and hasNationality value {Germany})" can't find the nominal 'Germany' but "Player and hasNationality value {Germany}" works fine. – ChrisDLFC Apr 01 '14 at 09:21
  • On the other hand any nested query which references a Class is fine such as "Club and employs min 2(Player and hasPosition some Forward)" – ChrisDLFC Apr 01 '14 at 09:26
  • I have no idea what fixed it, but after all the changes I've made to the ontology today, this problem appears to have resolved itself. – ChrisDLFC Apr 01 '14 at 20:28
  • Hmm, the query doesn't fail every time but still does sometimes. Could you see any problems with this? – ChrisDLFC Apr 01 '14 at 20:53