简体   繁体   中英

Is it possible to implement it by OWL ontology?

Could you please tell me, is it possible to implement such case by just OWL ontology definitions? Or I need to create custom rules for it?

IF
  ?doc rdf:type :document
  AND ?doc :state :completed
  AND not exists { ?other-doc :replaces+ ?doc AND ?other-doc :state :completed }
THEN
  ?doc rdf:type :latest-document

So the idea is to assign inferred :latest-document type to all entities with rdf:type:document which have :state =:completed and there is no any newer entity with :state =:completed . And I am wondering, if this case is too complex to implement it just by OWL definitions or not.

Sure: The complicated part is probably how to best describe the relation of being replaced:

@prefix owl: <http://www.w3.org/2002/07/owl#> .

_:completed-thing a owl:Restriction ;
  owl:onProperty :state ;
  owl:hasValue :completed .

_:replaced-by a owl:TransitiveProperty ;
  owl:inverseOf :replaces .

_:replaced-thing a owl:Restriction ;
  owl:onProperty _:replaced-by ;
  owl:someValuesFrom :completed-thing .

_:latest-thing owl:complementOf _:replaced-thing .

This first identifies the class of all completed things via owl:hasValue , then defines _:replaced-by as the inverse of :replaces . This property is transitive (thus by extension :replaces is also made transitive).

Next we define a replaced thing, this is anything that is replaced by at least one completed thing defined above. Latest thing is simply anything that is not replaced.

I haven't included the intersection with :document that you specified, since it would complicate the core part of the answer. However, it is not needed if :replaces and :state are already valid only on documents, and it is a simple matter of using owl:intersectionOf anyway.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM