0

I have an ontology that has:

  • Class Agent and Class Action
  • A list of data property (that inherit of a dataproperty restrictionProperties) has domain UNION of (Agent and Action) and Range primitive (Example hasMoney, hasTime)

I want to classify all individuals that ag.hasTime >= ac.hasTime and ag.hasMoney >= ac.hasMoney and so on, where ag is an Agent and ac is an Action instances.

I want to make a remark that these conditions have several things:

  • the comparison is always between the same property ag.hasTime >= ac.hasTime
  • All dataProperty that inherit of restrictionProperty will have the same treatment.
  • All agents that satisfy this condition will belong to, for example, Class AgentRestrictions

I don't want to use SWRL because I read that is not a standard and that I can do it always with SPARQL.

I guess with SPARQL can be do it, but I'm not sure how. But I prefer a solution that is clicking in protege. Or making specification with axioms.

Joshua Taylor
  • 84,998
  • 9
  • 154
  • 353
  • Regarding "ag.hasTime >= ac.hasTime and ag.hasMoney >= ac.hasMoney". To "classify" an individual (singular) usually means to assign it to some class (or to infer a class membership). What exactly do you mean by classifying a pair of individuals? Do you want to infer a relationship between them? You say that you want "All agents that satisfy this condition will belong to, for example, Class AgentRestrictions", but then what action are you talking about? If an agent's time is greater than *some* action's? Than *every* action's? What? – Joshua Taylor May 13 '14 at 13:42
  • Also, SWRL is a "standard," though it's not a "W3C recommendation", which is what many "standards" are. It's documented at http://www.w3.org/Submission/SWRL/, and Protégé supports it. If you're using a reasoner that supports SWRL rules (e.g., Pellet, HermiT), then you can type the rules in Protégé and run the reasoner and get the expected results. It's easier to use SWRL rules in Protégé than it is to use SPARQL. – Joshua Taylor May 13 '14 at 13:46
  • 1
    E.g., see some of these related question: [SWRL rules in protege 3.4.8](http://stackoverflow.com/q/21243879/1281433), [Ontology property definition in Protege-OWL / SWRL](http://stackoverflow.com/q/21499126/1281433), [Disjunction inside SWRL rule](http://stackoverflow.com/q/22534868/1281433), [SWRL rules don't infer new Object and Data Property Assertions](http://stackoverflow.com/q/21540839/1281433). Some of these have detailed explanations on how to use SWRL rules in Protege. – Joshua Taylor May 13 '14 at 13:48
  • @JoshuaTaylor I mean by classify all individual that satisfy those conditions. Yes a relation that I need to define in a SPARQL query. ac is an individual of the class Action. And what I meant about "is not a standard" is that I read that, SWRL is not going to be continuous like SPARQL. –  May 14 '14 at 11:28

1 Answers1

0

I think that you mean something like this:

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX urPrefx :<http://YOUR ONTOLOGY PATH HERE>
SELECT ?r (COUNT( DISTINCT ?r) AS ?countNo)
WHERE
{   
    #Query 1.1 Where urPrefx:greaterOrEqualThan is a restricted property
    ?data_property_individual_categorie rdfs:subPropertyOf urPrefx:greaterOrEqualThan.

    #Query 1.2 Get all the action classes with those restricted property
    {SELECT DISTINCT * WHERE {?individuals_actions rdf:type ?ActionsClasses.?individuals_actions ?data_property_individual_categorie ?values_action}}

    #Query 1.3 Get all the agents with those restricted property
    {SELECT DISTINCT * WHERE {?individuals_agents rdf:type ?AgentClasses. ?individuals_agents ?data_property_individual_categorie ?values_agent}}

    #Get all No and Yes
    BIND(if( ?values_agent >=?values_action, urPrefx:Yes, urPrefx:No) AS ?r).
}GROUP BY ?r

The only thing you need to specify is those YES and NO; What you want to do with it. You will need to use the Command CONSTRUCT to assign to the class AgentRestrictions.

titusfx
  • 1,896
  • 27
  • 36
  • @Joshua Taylor, be a standard and have one are different things. And doesn't work properly with all engines. – titusfx May 14 '14 at 11:10
  • is that what I want!!! And yes, with only one answer of NO will be enought to not belong to the AgentRestriction Class. Thanks a lot!!! –  May 14 '14 at 11:22
  • @Mauricio Well, there's a document that specifies what SWRL is and how it works. Whether it's a W3C recommendation is an entirely separate issue from whether or not people adopt it. There's plenty of variation in SPARQL implementations, too. For instance, note that if an implementation extends the functionality of `>=` (which it's permitted to do), the query that you've provided may not work as expected. Even with a standard, things aren't always clear cut. – Joshua Taylor May 14 '14 at 14:29