简体   繁体   English

在Virtuoso和SPARQL中将URI添加到具有URI的变量

[英]Add URI to variable with URIs in Virtuoso and SPARQL

I want to add new uri (as string) to variable that allready have some uris using sparql Virtuoso 7.1. 我想使用sparql Virtuoso 7.1将新的uri(作为字符串)添加到已经具有一些uri的变量中。 This is my sparql. 这是我的sparql。

SELECT ?newURIs WHERE {
 ?newURIs rdf:type res:myClass .
 BIND(URI("http://www.mypage.com/property#myProperty") AS ?newURIs) .
}

As I get it, it should add to the list that uri in "...", but it doesn't. 就我所知,它应该添加到“ ...”中的uri列表中,但事实并非如此。 Response is "Virtuoso 37000 Error SP031: SPARQL compiler: Internal error: Built-in function is not implemented" 响应为“ Virtuoso 37000错误SP031:SPARQL编译器:内部错误:内置函数未实现”

i tried: 我试过了:

BIND(IRI("...") AS ?newURIs)

and then i get results from first row (items from myClass) but my new uri is not there... Same situation with: 然后我从第一行(myClass的项目)获得结果,但是我的新uri不存在...与以下情况相同:

BIND("..." AS ?newURIs)

and with: 与:

BIND(<...> AS ?newURIs)

What am i doing wrong? 我究竟做错了什么? How can i add new URI from string to list of uris in variable? 如何将新的URI从字符串添加到变量中的URI列表?

thnx n

Well for a start your query is actually illegal in SPARQL, you can't use BIND to assign to an already in-scope variable so your query should be rejected as illegal SPARQL. 首先,您的查询实际上在SPARQL中是非法的,您不能使用BIND分配给已经在作用域内的变量,因此您的查询应被视为非法的SPARQL。 This may be what Virtuoso is doing though the error message you got was clearly unhelpful 尽管您收到的错误消息显然无济于事,但这可能是Virtuoso正在做的事情

What you are actually trying to do is a little unclear, from your description it sounds like you have a selection of possible values that you want to use for ?newURIs in which case the VALUES clause would be the appropriate way to do this eg 您实际上想做的事情还不清楚,从您的描述看来,您似乎已经选择了要用于?newURIs的可能值,在这种情况下, VALUES子句将是执行此操作的合适方法,例如

SELECT *
WHERE
{
  VALUES ?newURIs
  {
     <http://www.mypage.com/property#myProperty>
     # Other values go here
  }
  ?newURIs rdf:type res:myClass .
}

Note however that this will only find matches of your triple pattern where the value of ?newURIs has one of the values given in your VALUES clause which may not actually be what you want. 但是请注意,这只会找到您的三元模式的匹配项,其中?newURIs的值具有VALUES子句中给出的值之一,而这实际上可能并不是您想要的值。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM