Search code examples
sparql

When using the strafter function in sparql it doesn't run because of an invalid line error


When using the STRAFTER in a sparql query it gives back an invalid line error, I'm not sure what is wrong with the line of code.

STRAFTER("http://dbpedia.org/resource/Xbox_One", "http://dbpedia.org/resource/")

I want the result to look like this ->

Xbox_One


Solution

  • You need to bind the result to a variable.

    SELECT ?LocalPart
    
    {?s ?p ?o
    
    BIND (STRAFTER("http://dbpedia.org/resource/Xbox_One", "http://dbpedia.org/resource/") AS ?LocalPart)
    
    } 
    
    LIMIT 1