[英]How to classificate individuals in a class by specific condition on protege?
我有一個本體,具有:
我想對ag.hasTime> = ac.hasTime和ag.hasMoney> = ac.hasMoney等所有個人進行分類,以此類推,其中ag是Agent,ac是Action實例。
我想說明一下這些條件有幾件事:
我不想使用SWRL,因為我讀到這不是標准,並且我可以始終使用SPARQL來做到這一點。
我想用SPARQL可以做到,但是我不確定如何做到。 但我更喜歡點擊即可解決的解決方案。 或使用公理制定規范。
我認為您的意思是這樣的:
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
您唯一需要指定的是YES和NO。 您想用它做什么。 您將需要使用命令CONSTRUCT分配給類AgentRestrictions。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.