I have an ontology that has:
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:
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.
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.