The serialization context I'm interest in is org.apache.jena.query.ParameterizedSparqlString (toString(): https://github.com/apache/jena/blob/master/jena-arq/src/main/java/org/apache/jena/query/ParameterizedSparqlString.java#L1291-L1377). I probably should have clarified that before.
However, I just noticed that if the xsd:integer datatype is provided explicitly, then it is serialized as a plain literal: ResourceFactory.createTypedLiteral(1000) => "1000"^^< http://www.w3.org/2001/XMLSchema#long> ResourceFactory.createTypedLiteral(1000, XSDDatatype.XSDinteger) => 1000 This solves my issue. Thanks for your comments! - Jindřich -- Jindřich Mynarz http://mynarz.net/#jindrich On Sat, Jun 25, 2016 at 4:12 PM, Andy Seaborne <a...@apache.org> wrote: > On 25/06/16 11:42, Jean-Marc Vanel wrote: > >> Sorry, now it's clear. >> >> AFAIK internally >> 1000 >> and >> "1000"^^xsd:integer >> are the same. >> What you ask is a feature of the Turtle Writer. >> You should look for settings of the Turtle Writer, if any. >> > > It does that. N-triples does not, nor does RDF/XML. > > >> If Jena does not do it, >> look for another tool like rapper, Euler/EYE, etc. >> > > Yes - it's a syntax feature of Turtle that xsd:integer can be written that > way. Same with xsd:decimal (if there is a dot) > > xsd:int and other derived types can't - it would loose the detailed type > information. > > Jindřich - do you have a detailed example? > > Andy > > > >> >> >> >> 2016-06-25 12:34 GMT+02:00 Jindřich Mynarz <mynarzjindr...@gmail.com>: >> >> Hi Jean-Marc, >>> >>> I'm aware of createTypedLiteral, but I don't want to generate typed >>> literal, but a plain one instead, as I have indicated in my question. >>> >>> For example, 1000 instead of "1000"^^xsd:integer. >>> >>> - Jindřich >>> >>> -- >>> Jindřich Mynarz >>> http://mynarz.net/#jindrich >>> >>> On Sat, Jun 25, 2016 at 12:32 PM, Jean-Marc Vanel < >>> jeanmarc.va...@gmail.com> >>> wrote: >>> >>> Jindrich you had to read further on the javadoc: >>>> >>>> >>>> - createTypedLiteral >>>> >>>> public static Literal >>>> < >>>> >>>> >>> https://jena.apache.org/documentation/javadoc/jena/org/apache/jena/rdf/model/Literal.html >>> >>>> >>>>> createTypedLiteral(String >>>> < >>>> >>>> >>> http://docs.oracle.com/javase/7/docs/api/java/lang/String.html?is-external=true >>> >>>> >>>>> string, >>>> RDFDatatype >>>> < >>>> >>>> >>> https://jena.apache.org/documentation/javadoc/jena/org/apache/jena/datatypes/RDFDatatype.html >>> >>>> >>>>> dType) >>>> >>>> Answer a typed literal. >>>> Parameters:string - the string which forms the value of the >>>> >>> literaldType >>> >>>> - RDFDatatype of the type literalReturns:a Literal node with that >>>> >>> string >>> >>>> as value >>>> >>>> >>>> - createTypedLiteral >>>> >>>> public static Literal >>>> < >>>> >>>> >>> https://jena.apache.org/documentation/javadoc/jena/org/apache/jena/rdf/model/Literal.html >>> >>>> >>>>> createTypedLiteral(Object >>>> < >>>> >>>> >>> http://docs.oracle.com/javase/7/docs/api/java/lang/Object.html?is-external=true >>> >>>> >>>>> value) >>>> >>>> Answer a typed literal. >>>> Parameters:value - a java Object, the default RDFDatatype for that >>>> object will be usedReturns:a Literal node with that value >>>> >>>> >>>> >>>> 2016-06-25 11:54 GMT+02:00 Jindřich Mynarz <mynarzjindr...@gmail.com>: >>>> >>>> Hi, >>>>> >>>>> can I use Jena to create non-string plain literals, such as integers? >>>>> >>>>> ResourceFactory.createLiteral() ( >>>>> >>>>> >>>>> >>>> >>> https://jena.apache.org/documentation/javadoc/jena/org/apache/jena/rdf/model/ResourceFactory.html#createPlainLiteral-java.lang.String- >>> >>>> ) >>>>> is available only for strings. >>>>> >>>>> - Jindřich >>>>> >>>>> -- >>>>> Jindřich Mynarz >>>>> http://mynarz.net/#jindrich >>>>> >>>>> >>>> >>>> >>>> -- >>>> Jean-Marc Vanel >>>> Déductions SARL - Consulting, services, training, >>>> Rule-based programming, Semantic Web >>>> http://deductions-software.com/ >>>> +33 (0)6 89 16 29 52 >>>> Twitter: @jmvanel , @jmvanel_fr ; chat: irc://irc.freenode.net#eulergui >>>> >>>> >>> >> >> >> >