使用YARRRML映射生成基于条件的rdf:type三元组。

huangapple go评论62阅读模式
英文:

Generating condition-based rdf:type triples using YARRRML mapping

问题

我正在进行一个需要根据数据中的值分配rdf:type的实现。

示例:

ID,Species
1,Rat
2,Eagle

ID-1应分配类型为"Animal",ID-2应分配类型为"Bird"。

我在条件映射方面遇到了困难。我尝试了这个YARRRML映射:

- p: a
  o: 
      value: http://example.com/Animal
      condition:
          function: idlab-fn:equal
          parameters:
              - [grel:valueParameter, $(Species)]
              - [grel:valueParameter2, "Rat"]
英文:

I’m working on an implementation that requires assigning rdf:type based upon a value in the data.

Example:

<!-- language: lang-none -->

ID,Species
1,Rat
2,Eagle

ID-1 should be assigned type as "Animal" and ID-2 should be assigned type as "Bird".

I’m stuck with the conditional mapping. I tried this YARRRML mapping:

<!-- language: lang-yaml -->

  - p: a
    o: 
        value: http://example.com/Animal
        condition:
            function: idlab-fn:equal
            parameters:
                - [grel:valueParameter, $(Species)]
                - [grel:valueParameter2, &quot;Rat&quot;]

答案1

得分: 1

问题可能在于条件是在对象级别而不是高一级别定义的(请参见 https://rml.io/yarrrml/spec/#conditions),以下似乎有效(在 Matey 上进行了测试):

prefixes:
 ex: "http://example.com/"
 idlab-fn: "http://example.com/idlab/function/"
 grel: "http://users.ugent.be/~bjdmeest/function/grel.ttl#"

mappings:
  person:
    sources:
      - ['test.csv~csv']
    s: http://example.com/$(ID)
    po:
      - p: rdf:type
        o: ex:Animal~iri
        condition:
          function: idlab-fn:equal
          parameters:
            - [grel:valueParameter, "Rat"]
            - [grel:valueParameter2, $(Species)]
      - [ex:name, $(Species)]
英文:

The problem might be that the condition is defined at the object instead of one level higher (see https://rml.io/yarrrml/spec/#conditions), the following seems to work (tested on Matey)

prefixes:
 ex: &quot;http://example.com/&quot;
 idlab-fn: &quot;http://example.com/idlab/function/&quot;
 grel: &quot;http://users.ugent.be/~bjdmeest/function/grel.ttl#&quot;

mappings:
  person:
    sources:
      - [&#39;test.csv~csv&#39;]
    s: http://example.com/$(ID)
    po:
      - p: rdf:type
        o: ex:Animal~iri
        condition:
          function: idlab-fn:equal
          parameters:
            - [grel:valueParameter, &quot;Rat&quot;]
            - [grel:valueParameter2, $(Species)]
      - [ex:name, $(Species)]

huangapple
  • 本文由 发表于 2023年3月9日 19:28:13
  • 转载请务必保留本文链接:https://go.coder-hub.com/75683978.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定