Search in sources :

Example 1 with InsertData

use of org.eclipse.rdf4j.query.algebra.InsertData in project rdf4j by eclipse.

the class SPARQLParserTest method testLongUnicode.

@Test
public void testLongUnicode() throws Exception {
    ParsedUpdate ru = parser.parseUpdate("insert data {<urn:test:foo> <urn:test:bar> \"\\U0001F61F\" .}", "urn:test");
    InsertData insertData = (InsertData) ru.getUpdateExprs().get(0);
    String[] lines = insertData.getDataBlock().split("\n");
    assertEquals("\uD83D\uDE1F", lines[lines.length - 1].replaceAll(".*\"(.*)\".*", "$1"));
}
Also used : ParsedUpdate(org.eclipse.rdf4j.query.parser.ParsedUpdate) InsertData(org.eclipse.rdf4j.query.algebra.InsertData) Test(org.junit.Test)

Example 2 with InsertData

use of org.eclipse.rdf4j.query.algebra.InsertData in project rdf4j by eclipse.

the class UpdateExprBuilder method visit.

@Override
public InsertData visit(ASTInsertData node, Object data) throws VisitorException {
    ASTUnparsedQuadDataBlock dataBlock = node.jjtGetChild(ASTUnparsedQuadDataBlock.class);
    InsertData insertData = new InsertData(dataBlock.getDataBlock());
    insertData.setLineNumberOffset(dataBlock.getAddedDefaultPrefixes());
    return insertData;
}
Also used : ASTInsertData(org.eclipse.rdf4j.query.parser.sparql.ast.ASTInsertData) InsertData(org.eclipse.rdf4j.query.algebra.InsertData) ASTUnparsedQuadDataBlock(org.eclipse.rdf4j.query.parser.sparql.ast.ASTUnparsedQuadDataBlock)

Aggregations

InsertData (org.eclipse.rdf4j.query.algebra.InsertData)2 ParsedUpdate (org.eclipse.rdf4j.query.parser.ParsedUpdate)1 ASTInsertData (org.eclipse.rdf4j.query.parser.sparql.ast.ASTInsertData)1 ASTUnparsedQuadDataBlock (org.eclipse.rdf4j.query.parser.sparql.ast.ASTUnparsedQuadDataBlock)1 Test (org.junit.Test)1