[英]Ordering of entities in an ontology
I have a system that models some domain data in an ontology, the usual sort of triplestore. 我有一个系统可以在本体中建模一些域数据,通常是三元组。
I've been looking around for a way to express plurality and ordering but haven't found anything via the googles. 我一直在寻找一种表达多元化和排序的方法,但是没有通过谷歌找到任何东西。 My main use case is something like one entity in the domain can be a list of tasks, (get groceries, cook meal, eat meal, something like that) but in general I feel like having the ability to 'weight' your edges might be useful across the board.
我的主要用例就像域中的一个实体可以是一个任务列表,(获得杂货,做饭,吃饭,类似的东西),但总的来说,我觉得有能力“重量”你的边缘可能是全面有用。
Is there an accepted way of doing this? 这是否有可接受的方式? Just go to a quadstore?
去四元店? Intermediary items (list → listitem) with edges to an ordinality and a domain entity?
中间项目(列表→列表项目)与边界到一个正常和一个域实体? Predicates from predicates to Weights?
从谓词到权重的谓词?
Here's an example: 这是一个例子:
To represent something like what you've shown in your figure, you'd typically treat it as an n-ary relation. 为了表示你在图中所展示的内容,你通常将其视为一种非关系。 You should have a look at the W3C working note Defining N-ary Relations on the Semantic Web , but the short version is that you've got a 3-ary relation, and you're expressing
您应该看看W3C工作说明在语义Web上定义N元关系 ,但简短版本是您有一个3元关系,并且您正在表达
hasTask(list,1,socks)
hasTask(list,2,shoes)
hasTask(list,3,leash)
For each one of those, you'd have a resource, usually a blank node, but it could be a URI, too, and have properties relating it to the various components, and perhaps a type: 对于其中的每一个,您都有一个资源,通常是一个空白节点,但它也可以是一个URI,并且具有将其与各种组件相关联的属性,并且可能是一个类型:
_:rel1 rdf:type :taskItem ;
:hasList :list ;
:hasord 1;
:hasTask :socks .
_:rel2 rdf:type :taskItem ;
:hasList :list ;
:hasord 2;
:hasTask :shoes .
_:rel3 rdf:type :taskItem ;
:hasList :list ;
:hasord 3;
:hasTask :leash .
There's some variability here, of course. 当然,这里有一些变化。 Rather than having the reified relation have the list, number, and task as property values, the list could be related to each task item:
列表可以与每个任务项相关,而不是使具体化的关系具有列表,数字和任务作为属性值。
:list :hasTaskItem [ rdf:type :taskItem ;
:hasord 1;
:hasTask :socks ] ,
[ rdf:type :taskItem ;
:hasord 2;
:hasTask :shoes ] ,
[ rdf:type :taskItem ;
:hasord 3;
:hasTask :leash ] .
The basic idea is the same though. 但基本思路是一样的。 Alternatively, you could use a list.
或者,您可以使用列表。 In pure RDF, you can use RDF lists and leave the numbers implicit, like:
在纯RDF中,您可以使用RDF列表并隐含数字,例如:
:list :hasTasks ( :socks :shoes :leash ) .
That's just shorthand for 这只是简写
:list :hasTasks [ rdf:first :socks ;
rdf:rest [ rdf:first :shoes ;
rdf:rest [ rdf:first :leash ;
rdf:rest rdf:nil ]]].
In OWL, you can't use rdf:first and rdf:rest, but you can define your own analogous properties and implement the same structures. 在OWL中,您不能使用rdf:first和rdf:rest,但您可以定义自己的类似属性并实现相同的结构。 There's an example of specifying a list class in my answer ot Can I specify a range for rdf:List members?
在我的答案中有一个指定列表类的例子我可以为rdf:List成员指定一个范围吗? (where someone wanted a list all of whose elements had to be a certain type).
(有人想要一个列表,其中所有元素都必须是某种类型)。 If you do take this route, and you want to recover the position of each element in the list, you can actually do it using a SPARQL query over the RDF, as I've described in an answer to Is it possible to get the position of an element in an RDF Collection in SPARQL?
如果您确实采用了这条路线,并且想要恢复列表中每个元素的位置,您实际上可以使用RDF上的SPARQL查询来执行此操作,正如我在回答中所描述的那样是否可以获得该位置SPARQL中RDF集合中的元素? .
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.