Is it for human-readability? Can you try model.createTypedLiteral(new Integer(4)) as the object?
https://jena.apache.org/documentation/notes/typed-literals.html On Wed, Jun 12, 2019 at 2:44 PM Miika Alonen <[email protected]> wrote: > > How do this syntactic sugar actually work? It also works in json-ld so it not > just turtle. > > I can achieve the same result using SPARQL: > > Model model = ModelFactory.createDefaultModel(); > String update = "PREFIX ns: <http://example.org/ns#> INSERT DATA { > ns:foo ns:bar 1 . } "; > UpdateAction.parseExecute( update, model ); > model.write( System.out, "TTL" ); > > ... but I would prefer Jena API if possible. > > -----Original Message----- > From: Martynas Jusevičius <[email protected]> > Sent: keskiviikko 12. kesäkuuta 2019 15.22 > To: jena-users-ml <[email protected]> > Subject: Re: Creating plain numeric literals using jena > > AFAIK there are no "plain numeric literals". That's just syntactic sugar for > numbers in Turtle: https://www.w3.org/TR/turtle/#abbrev > > The semantics of both forms are the same, so does it really matter? > > On Wed, Jun 12, 2019 at 2:07 PM Miika Alonen <[email protected]> wrote: > > > > Hi, > > > > I have existing system that uses plain numeric literals in graphs like: > > > > ex:prop sh:order 2 . > > > > I'v been trying to add new literals using jena, but don't know how to > > create plain numeric literals. I tried this and it is working for Booleans > > but not Integers: > > > > propShape.addLiteral(SH.order, 4) > > propShape.addLiteral(SH.closed, true) > > > > Result: > > ex:prop sh:order "4"^^xsd:long . > > ex:prop sh:closed true . > > > > Expected result: > > ex:prop sh:order 4 . > > ex:prop sh:closed true . > > > > Is there a way to create these kind of numerical plain literals in Jena? > > > > Br, Miika
