Why leading dashes are not allowed in URIs?

The following insert generates a 400 error.

PREFIX ex: <http://example.org/>
INSERT DATA{ 
  ex:-1 rdfs:label "A new book" .
}

If I remove "-" it works.

My second question how I do get the specific error message when making this HTTP post call using

  • 'content-type': "application/sparql-update"
    ?

Dashes are allowed in urls. They aren’t allowed as the first character in a prefixed name. It would probably work if you used a basename ie

Base http://example.org/

<-1>

Or you just used the full url without the prefix

The reason probably has to do with restrictions on qnames and serialization to RDF/XML but I’m just guessing here.

Zach,

This worked:

INSERT DATA{ 
  <http://example.com/-1> rdfs:label "A new & book" .
}

Not sure what you meant by basename .... can you please elaborate with an example?

I got it to work:

BASE <http://example.org/>
INSERT DATA{ 
  <-1> rdfs:label "A new & book" .
}

Thank you