Menu

#14 Improper parsing of serialized blank node (Virtuoso, Raptor)

open
5
2012-07-04
2010-03-18
No

Soprano 2.4.1 (tested with 2.4.0.1 first, upgraded to 2.4.1, still reproducible) with the Virtuoso backend and the Raptor parser fails to import blank nodes.

The attached testcase produces the following error:
"SQLExecDirect failed on query 'sparql insert into graph <sopranofakes: DEFAULTGRAPH=""> { <:blankNode > http://www.w3.org/1999/02/22-rdf-syntax-ns#value "0"^^http://www.w3.org/2001/XMLSchema#int . }' (iODBC Error: [OpenLink][Virtuoso iODBC Driver][Virtuoso Server]SQ074: Line 1: SP030: SPARQL compiler, line 1: syntax error at '<' before ':blankNode')"

If I replace the subject of the statement with a new Soprano::Node(QString("blankNode")), it works. Maybe the space after "_:blankNode" (which wasn't there before the serialization) is the problem?

(Now, I don't know if this statement semantically makes sense, but it's valid AFAICT, so it should work.)

Discussion

  • Kevin Kofler

    Kevin Kofler - 2010-03-18

    Testcase

     
  • Kevin Kofler

    Kevin Kofler - 2010-03-18

    I'm fairly sure the space is the problem, as if (statement.subject().isBlank()) statement.setSubject(Soprano::Node(statement.subject().identifier().trimmed())); fixes that statement.

     
  • Kevin Kofler

    Kevin Kofler - 2010-03-18

    I suspect this is actually a Raptor bug. Should I file this against Raptor? (But I'll have a hard time coming up with a testcase which doesn't require Soprano.)

     
  • Sebastian Trueg

    Sebastian Trueg - 2010-03-19

    Simply trim the blank node names in the parser itself.

     
  • Sebastian Trueg

    Sebastian Trueg - 2010-03-19

    The attached patch is just a workaround. In the end the blank node handling in Soprano is very bad since they are simply string identifiers which are also compared by string. Imagine you parse two files which use the same string ids for blank nodes. In the db they will end up as the same blank nodes which is wrong.
    The reason is simple: in Nepomuk we do not use blank nodes. Thus, the need for good blank node support was never there. There are, however, ideas to improve that in Soprano 3.

     

Log in to post a comment.