File tree Expand file tree Collapse file tree
main/java/org/eclipse/rdf4j/queryrender
test/java/org/eclipse/rdf4j/queryrender Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ else if (value instanceof Literal) {
7878 builder .append ("\" \" \" " ).append (escape (aLit .getLabel ())).append ("\" \" \" " );
7979
8080 if (Literals .isLanguageLiteral (aLit )) {
81- builder .append ("@" ).append (aLit . getLanguage ( ));
81+ aLit . getLanguage (). ifPresent ( lang -> builder .append ("@" ).append (lang ));
8282 }
8383 else {
8484 builder .append ("^^<" ).append (aLit .getDatatype ().toString ()).append (">" );
Original file line number Diff line number Diff line change 1+ /*******************************************************************************
2+ * Copyright (c) 2017 Eclipse RDF4J contributors.
3+ * All rights reserved. This program and the accompanying materials
4+ * are made available under the terms of the Eclipse Distribution License v1.0
5+ * which accompanies this distribution, and is available at
6+ * http://www.eclipse.org/org/documents/edl-v10.php.
7+ *******************************************************************************/
8+
9+ package org .eclipse .rdf4j .queryrender ;
10+
11+ import static org .junit .Assert .assertEquals ;
12+
13+ import org .eclipse .rdf4j .model .Value ;
14+ import org .eclipse .rdf4j .model .impl .SimpleValueFactory ;
15+ import org .junit .Test ;
16+
17+ public class RenderUtilsTest
18+ {
19+ @ Test
20+ public void toSparqlWithLiteralSerialisesLanguageTag ()
21+ {
22+ Value val = SimpleValueFactory .getInstance ().createLiteral ("test" , "en" );
23+
24+ assertEquals ("\" \" \" test\" \" \" @en" , RenderUtils .toSPARQL (val ));
25+ }
26+ }
You can’t perform that action at this time.
0 commit comments