[英]How do I state in OWL that a Property must have a set of ordered values?
如何在OWL中聲明屬性必須具有一組有序值?
例如:一個程序必須有一個rdf:Seq of Series,而一個系列必須有一個rdf:Seq of Episodes?
http://purl.org/ontology/po/本體使用屬性http://purl.org/ontology/po/position代替。
哪種方法更好?
在OWL(和RDF)中很難表示序列,它更多的是關於無序的事物。 我找到的最好的方法是通過屬性分配一個數字,然后跟蹤這個索引並在需要時使用它來迭代。
表示你想要捕獲的OWL本體可以是這樣的(使用曼徹斯特語法 - 你可以保存為.owl文件並使用Protege打開 - #
是注釋):
Prefix: xsd: <http://www.w3.org/2001/XMLSchema#>
Prefix: owl: <http://www.w3.org/2002/07/owl#>
Prefix: : <brain#>
Prefix: xml: <http://www.w3.org/XML/1998/namespace>
Prefix: rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
Prefix: dc: <http://purl.org/dc/elements/1.1/>
Prefix: rdfs: <http://www.w3.org/2000/01/rdf-schema#>
Ontology: <brain.owl>
Datatype: xsd:int
ObjectProperty: has
Characteristics:
Transitive
# Property used to save the number in the sequence
DataProperty: episode-number
Range:
xsd:int
# Definition of a program: A program as at least a series
Class: Program
SubClassOf:
has some Series
Class: owl:Thing
# Definition of series: A series as at least one episode
Class: Series
SubClassOf:
has some Episode
Class: Episode
# Instance of episode
Individual: episode1
Types:
Episode
# Episode number
Facts:
episode-number "1"^^xsd:int
# Second instance of episode
Individual: episode2
Types:
Episode
Facts:
episode-number "2"^^xsd:int
讓我們說那么你想迭代劇集實例。 這可以通過OWL查詢Episode and episode-number value 1
。 您必須自己更新號碼。
如何在OWL中聲明屬性必須具有一組有序值? 例如:一個程序必須有一個rdf:Seq of Series,而一個系列必須有一個rdf:Seq of Episodes?
如果你在OWL(DL)工作,那么你不應該真正使用RDF集合。 loopasam的答案很好,如果你可以實現關系並包含位置編號,但你也可以在OWL中聲明自己的列表結構,類似於RDF列表(這只是單鏈表的RDF編碼)。 因此你可以擁有
:series hasEpisodeList [ ex:first :episodeA ;
ex:rest [ ex:first :episodeB ;
ex:rest [ :episodeC ;
ex:rest ex:nil ] ] ] .
但是,這種方法的缺點是數字信息只是隱含的,並且使用DL查詢很難重建(盡管使用SPARQL並不太難)。 表示序列的兩種方法在本體中的實體的排序以及它鏈接到的其他問題和答案中更詳細地描述。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.