【问题标题】:Why isn't a ShEx constant matching the same term in the data?为什么 ShEx 常数与数据中的相同术语不匹配?
【发布时间】:2017-10-22 20:15:29
【问题描述】:

我有一个期望特定类型的 ShEx 架构:

epri:VariableShape {
  a st:studyVariable ;
  st:subject [tax:~] ;
  st:signal xsd:decimal
}

拒绝该类型的数据

st:envFactorEMF a st:studyVariable ; # << this isn't recognized
  st:subject tax:1758 ;
  st:signal -.00043 .

(demo) 为什么会这样?

【问题讨论】:

  • 我不是 ShExpert(抱歉),但验证器提供的具体错误消息很有帮助。就像st:signal xsd:decimal 意味着 st:signal 属性的值应该是一个数据类型为 xsd:decimal 的文字,它也希望 rdf:type 的值是一个数据类型为 st:studyVariable 的文字。当然,在数据中,该值实际上是 IRI st:studyVariable,根本不是文字。
  • 我想您应该使用a [st:studyVariable] 来表示您想要实际值。

标签: rdf semantic-web shex


【解决方案1】:

您链接到的演示中的错误消息实际上描述了确切的问题。

将 http://www.epri.com/studies/3002011786studyVariable 验证为 {"type":"NodeConstraint","datatype":"http://www.epri.com/studies/3002011786studyVariable"} 时出错:数据类型不匹配:http://www.epri.com/studies/3002011786studyVariable 不是数据类型为 http://www.epri.com/studies/3002011786studyVariable 的文字

您使用的是datatype constraint,这不是您想要的。

您需要改用a [ st:studyVariable ],因为您想指定value set:

epri:VariableShape {
  a [ st:studyVariable ];
  st:subject [tax:~] ;
  st:signal xsd:decimal
}

【讨论】:

    【解决方案2】:

    Joshua Taylor's answer 是正确的,但由于这是 ShEx 中最常见的错误,我想我会用一点 ascii 艺术来详细说明。

    ShEx 数据类型表示为裸 IRI,而值集表示为 []s。你有一个rdf:type 的st:studyVariable:

    epri:VariableShape {
      a st:studyVariable ;   # <-- datatype
      st:subject [tax:~] ;   # <-- value set
      st:signal xsd:decimal  # <-- datatype
    }
    

    当您想要st:studyVariable 的(小)值集时:

    epri:VariableShape {
      a [st:studyVariable] ; # <-- value set
      st:subject [tax:~] ;   # <-- value set
      st:signal xsd:decimal  # <-- datatype
    }
    

    (demo)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-05-08
      • 1970-01-01
      • 1970-01-01
      • 2019-04-09
      • 1970-01-01
      相关资源
      最近更新 更多