Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7603133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T23:35:28+00:00 2026-05-30T23:35:28+00:00

I am using Jena 2.6.4. The following code String v = Parnell Square East;

  • 0

I am using Jena 2.6.4.

The following code

String v = "Parnell Square East";
Literal l = ModelFactory.createDefaultModel().createTypedLiteral(
    v, XSDDatatype.XSDstring);
System.out.println(l.toString());

Produces the following output:

Parnell Square East^^http://www.w3.org/2001/XMLSchema#string

which looks wrong to me: I would have expected:

“Parnell Square East”^^http://www.w3.org/2001/XMLSchema#string

From a quick look at the source code of LiteralImpl.java I see:

@Override public String toString() {
    return asNode().toString( PrefixMapping.Standard, false );
}

Why is the second parameter (quoting) set to false?

If I do

String v = "Parnell Square East";
Literal l = ModelFactory.createDefaultModel().createTypedLiteral(v,
        XSDDatatype.XSDstring);
System.out.println(l.asNode().toString(PrefixMapping.Standard, true));

I get the desired output

“Parnell Square East”^^http://www.w3.org/2001/XMLSchema#string

I just wonder why this is not the default behaviour?

Thanks,
marco

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T23:35:30+00:00Added an answer on May 30, 2026 at 11:35 pm

    There’s no guarantee, implicit or explicit, that toString on any Jena node produces output that fits any particular serialization (e.g. Turtle). You might just as well ask why toString does not produce an XML node, or why the datatype is not abbreviated to a q-name. The view that Jena takes is that toString produces enough information to be useful in debugging. Any requirements beyond that are application responsibilities.

    So saying, if you have a good use case feel free to submit a patch to the Jena Jira. Bear in mind though, that existing user code may have come to rely on the current behaviour, so switching would have some cost so you would need to make a strong case for change!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using Rails 3.2.0.rc2 and ruby 1.9.3p0 In app/views/requests/_form.html.erb I have the following code for
Using delphi 2010, i am wondering if there someway to escape the following string
Using online interfaces to a version control system is a nice way to have
Using C# and System.Data.SqlClient, is there a way to retrieve a list of parameters
Using preview 4 of ASP.NET MVC Code like: <%= Html.CheckBox( myCheckBox, Click Here, True,
I am building an app in Java using Jena for semantic information scraping. I
I want to create a simple application using Jena and SPARQL, that inserts, deletes,
I have a problem reading OWL/XML files from Java using Jena. I have no
Using linq2sql I'm trying to take the string in txtOilChange and update the oilChange
I'm trying to initialize a RDF datastore using Jena and HSQLDB . From http://jena.sourceforge.net/DB/hsql-howto.html

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.