可以使用哪些RDF模式来表示组件及其所占的百分比? [英] What RDF patterns can be used to represent components and the percentage they make up?

查看:62
本文介绍了可以使用哪些RDF模式来表示组件及其所占的百分比?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用RDF盘点我的葡萄酒收藏,但不确定如何指定葡萄酒可以包含几种葡萄品种的百分比.以下是尝试使用rdf:bag以Turtle语法实现此目的的方法.

I'd like to inventory my wine collection using RDF but am not sure how to specify that wine can contain percentages of several grape varietals. Below is an attempt to do so in Turtle syntax using rdf:bag.

@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix vin: <http://example.org/wine#> .

<http://example.org/wine/id#1001>
  a <http://example.org/wine/ns#red> ;
  vin:name "Quilceda Creek CVR" ;
  vin:vintage "2014"^^xsd:gYear ;
  vin:winery "Quilceda Creek"@en ;
  vin:alcoholContent "0.15"^^xsd:decimal  ;
  vin:agedIn "French Oak"@en ;      

  vin:varietals rdf:_1, rdf:_2, rdf:_3, rdf:_4, [
    a rdf:Bag ;
    rdf:_1 "Cabernet Sauvignon"@en ;
    rdf:_1 "0.76"^^xsd:decimal ;
    rdf:_2 "Merlot"@en ;
    rdf:_2 "0.20"^^xsd:decimal ;
    rdf:_3 "Petit Verdot"@en ;
    rdf:_3 "0.03"^^xsd:decimal ;
    rdf:_4 "Malbec"@en ;
    rdf:_4 "0.01"^^xsd:decimal ;
  ] .

当我将其转换为XML/RDF时,带有百分比的三元组被删除.这使我认为您不应该/不能多次使用bag item谓词(例如rdf:_1).

When I convert this to XML/RDF, the triples with percentages get dropped. This makes me think you shouldn't/can't use the bag item predicates (ex. rdf:_1) more than once.

我还考虑过制作一个袋子袋,每个品种的袋子都包含名称和百分比.这将涉及创建更多的空白节点,这对我来说似乎不正确.最终,我希望能够检索所有包含特定品种至少一定百分比的葡萄酒.我不确定是否可以定义品种名称和百分比对,而不是将其放在同一个袋子中.

I've also considered making a bag of bags, with a bag for each varietal containing the name and percentage. This would involve creating even more blank nodes, which doesn't seem right to me. Eventually I would like to be able to retrieve all wines containing at least a certain percentage of a particular varietal. I'm not sure if I'll be able to if varietal name and percentage pairs have no relationship defined other than being in the same bag.

我对此并不陌生,但有一种感觉,我需要针对该问题寻找RDF架构和本体.就是说,在我完全理解我为什么要这么做之前,我也不想跳槽.

I'm new to this but have a feeling I need to look to RDF Schemas and ontologies for this problem. That said, I also don't want to jump ship to that until I totally understand why I need to.

如果可能的话,如何使用RDF来表示葡萄酒具有一定百分比的不同品种?

If possible, how can RDF be used to represent that a wine has certain percentages of different varietals?

推荐答案

我更喜欢使用以下简单模式:

I’d prefer to use this simple pattern:

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix wine: <http://www.w3.org/TR/2003/PR-owl-guide-20031209/wine#> .
@prefix vin: <http://example.org/wine#> .

vin:id1001 vin:varietal [ vin:grape  wine:CabernetSauvignonGrape; 
                          vin:percentage  "0.76"^^xsd:decimal ] ;
           vin:varietal [ vin:grape  wine:MerlotGrape ;
                          vin:percentage  "0.20"^^xsd:decimal ] .

针对上述模式的SPARQL查询示例为:

Example SPARQL queries against the pattern above would be:

SELECT DISTINCT ?sophistique
WHERE {
    ?sophistique vin:varietal/vin:percentage ?percentage .
    FILTER (?percentage <= "0.05"^^decimal)
}

SELECT DISTINCT ?coupage
WHERE {
    ?coupage vin:varietal/vin:grape ?grape1.
    ?coupage vin:varietal/vin:grape ?grape2.
    FILTER (?grape1 != ?grape2)
}

SELECT ?id (("1.0"^^xsd:decimal - SUM(?percentage)) AS ?part_des_anges)   
WHERE {
    ?id vin:varietal/vin:percentage ?percentage .
} GROUP BY ?id HAVING ( ?part_des_anges > "0.0"^^xsd:decimal )

一些评论:

  1. 在思想上,尽可能使用事物代替RDF中的字符串是更正确的.
    W3C的示例葡萄酒本体可以为许多此类事物提供URI.

  1. It is more ideologically correct to use, wherever possible, things instead of strings in RDF.
    The W3C’s example wine ontology could provide URIs for many of these things.

为什么不使用多次出现的vin:varietal属性而不是rdf:Seq?在SPARQL中,尤其是在OWL中,很难处理rdfs:Container的问题.

Why don’t you use just multiple occurrences of the vin:varietal property instead of rdf:Seq? It will be harder to deal with rdfs:Container’s in SPARQL and especially in OWL.

我认为这些品种(带有百分比的葡萄品种)不需要通过URI进行强有力的识别,它们的本体论状态"还不够扎实.因此,我使用空白节点.

I don’t think these varietals (grape varieties with percentages) need strong identification with URIs, their "ontological status" are not sufficiently solid. Thus, I use blank nodes.

这篇关于可以使用哪些RDF模式来表示组件及其所占的百分比?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆