[英]How to classificate individuals in a class by specific condition on protege?
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. 我想对ag.hasTime> = ac.hasTime和ag.hasMoney> = ac.hasMoney等所有个人进行分类,以此类推,其中ag是Agent,ac是Action实例。
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. 我不想使用SWRL,因为我读到这不是标准,并且我可以始终使用SPARQL来做到这一点。
I guess with SPARQL can be do it, but I'm not sure how. 我想用SPARQL可以做到,但是我不确定如何做到。 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; 您唯一需要指定的是YES和NO。 What you want to do with it. 您想用它做什么。 You will need to use the Command CONSTRUCT to assign to the class AgentRestrictions. 您将需要使用命令CONSTRUCT分配给类AgentRestrictions。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.