如何在 Jena:fuseki 中使用 apf:strsplit

How to use apf:strsplit in Jena:fuseki

我正在尝试使用函数 apf:strsplit 来拆分数据类型 属性 的值。我查找了一些示例并确实喜欢那里指示的内容,但是,在我的情况下,fuseki returns 是一个错误。

我的查询:

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX dbo: <http://dbpedia.org/>
PREFIX dbp: <http://dbpedia.org/property/>
PREFIX apf: <http://jena.hpl.hp.com/ARQ/property#>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>

select ?s ?member
where{
  ?s a dbo:MusicalArtist .
  ?s dbp:hometown ?p .
  {select ?member
    where{
      ?member apf:strSplit(?p " ") . 
    }
   }
}

结果:

Error 500: ?/p is not a literal node
Fuseki - version 2.3.1 (Build date: 2015-12-08T09:24:07+0000)

我的实例示例:

<http://example.com/resource/6>
  rdf:type dbo:Actor ;
  rdf:type dbo:MusicalArtist ;
  rdf:type dbo:Person ;
  rdf:type owl:NamedIndividual ;
  dbo:bloodGroup "n"@en ;
  dbo:spouse <http://example.com/resource/11> ;
  dbo:spouseName "Angelina Jolie" ;
  dbp:hometown "Dallas"^^xsd:string ;
  foaf:name "Brad Pettitt" ;
.
<http://example.com/resource/17>
  rdf:type dbo:MusicalArtist ;
  rdf:type owl:NamedIndividual ;
  dbp:hometown "El Paço"^^xsd:string ;
  foaf:name "Harrison Ford" ;
.

当我将 ?p 更改为 "other text" 时,它起作用并导致:

1 <http://example.com/resource/6>  "other"
2 <http://example.com/resource/6>  "text"
3 <http://example.com/resource/3>  "other"
4 <http://example.com/resource/3>  "text"

我试过 put str(?p), ?p^^xsd:string ?p^^xsd:literal 但没有任何效果。 我在网上查了一下,但没有找到我可以使用的东西。

有人对我如何修复此查询有一些建议吗?我不知道 :-( 任何帮助将不胜感激。

提前致谢,

此致,

瓦莱里娅

你有一个嵌套的 SELECT 将被评估,结果与前面的部分结合 - SELECT ?member 隐藏了 ?p 里面 - 实际上它是一个不同的变量(并且ARQ 将其重命名为 ?/p).

只需删除内部 SELECT:

select ?s ?member
where{
  ?s a dbo:MusicalArtist .
  ?s dbp:hometown ?p .
  ?member apf:strSplit(?p " ") . 
   }
}