简体   繁体   中英

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. This is my 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. Response is "Virtuoso 37000 Error SP031: SPARQL compiler: Internal error: Built-in function is not implemented"

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:

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?

thnx

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. This may be what Virtuoso is doing though the error message you got was clearly unhelpful

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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