Defining a property whose range is an ordered list

女生的网名这么多〃 提交于 2019-12-13 20:09:01

问题


Given two classes Container and Element, I would like to define a property contains to describe the contents of a Container.

However, the order of Elements is important, so I can't simply write

_:container :contains _:element1, _:element2, _:element3 .

How can I define the contains property correctly?

I've looked at rdf:List and owl:Seq but I don't know how to translate that into my ontology.


回答1:


You can define your property in many ways depending on what your requirements and your use cases are.

First, it is sometimes possible to avoid using lists or sequences completely, and yet keep the ordering of things. This can be done if the elements that you are ordering have an intrinsic order. For instance, if you want to name the children of someone from the oldest to the youngest, you can just use a hasChild relation:

ex:someone  onto:hasChild  ex:child3, ex:child1, ex:child2 .
ex:child1  onto:birthDay  "1995-10-25"^xsd:date .
ex:child2  onto:birthDay  "1997-03-10"^xsd:date .
ex:child3  onto:birthDay  "2003-01-14"^xsd:date .

If you do not have the exact dates, it is also possible to use a relation isOlderThan to make the order explicit. However, this cannot work in many cases. If you want to say in which order participants to a race arrived at the finish line, you cannot say:

ex:runner1  onto:arrivedBefore  ex:runner2 .
# etc.

because this only applies to this particular race. One solution is to use an RDF list like so:

ex:race42  onto:arrival  (ex:runner1 ex:runner2 ex:runner3) .

However, RDF lists cannot be used like this in OWL DL. The typical way of dealing with such lists in OWL is what is described in the document that AKSW links to in his comment. That is, you define a class and properties that mimic the RDF list constructs:

ex:container42  onto:contains  [
    a  listonto:OWLList;
    listonto:hasElement  ex:element1;
    listonto:hasNext  [
        a  listonto:OWLList;
        listonto:hasElement  ex:element2;
        listonto:hasNext  [
            a  listonto:OWLList;
            listonto:hasElement  ex:element3;
            listonto:hasNext  listonto:emptylist
        ]
    ]
] .

This is not the only solution. Using rdf:Seq is also an option (though usually discouraged by many people). Again, this cannot be used in OWL DL. However, one can introduce an ontology that partially mimics the way rdf:Seq works:

ex:container42  onto:contains  [
    a  seqonto:Sequence;
    seqonto:hasSlots
        [ a seqonto:Slot; seqonto:content ex:element1; seqonto:position 1 ],
        [ a seqonto:Slot; seqonto:content ex:element2; seqonto:position 2 ],
        [ a seqonto:Slot; seqonto:content ex:element3; seqonto:position 3 ],
    seqonto:numberOfElements 3
] .

The property position with its number are used to mimic the properties rdf:_1, rdf:_2, etc. from the RDF vocabulary. Other ways of identifying the last slot could be a special seqonto:lastSlot property. Note that this is what the ordered list ontology does.

There may be other options, probably as involved as the ones discussed here, but I think it covers most possibilities well enough.




回答2:


Perhaps can you find a partial answer in this paper :

P. Ciccarese ans S. Peroni, The Collections Ontology: creating and handling collections in OWL 2 DL frameworks, 2013 Source



来源:https://stackoverflow.com/questions/51786379/defining-a-property-whose-range-is-an-ordered-list

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!