incubator-jena-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard Cyganiak (JIRA)" <>
Subject [jira] Created: (JENA-51) Turtle parser misses prefix declarations
Date Sat, 26 Feb 2011 21:33:58 GMT
Turtle parser misses prefix declarations

                 Key: JENA-51
             Project: Jena
          Issue Type: Bug
          Components: Jena
            Reporter: Richard Cyganiak
            Priority: Minor

Jena's Turtle parser doesn't capture @prefix declarations in the prefix mapping. Any triples
are parsed correctly, but model.getNsPrefixMap() and friends show an empty prefix mapping.

The N3 parser handles this correctly.

====== example code below =======

import com.hp.hpl.jena.rdf.model.*;

public class Test {
	public static void main(String[] args) {
		String s =
			"@prefix ex1: <>.\n" +
			"@prefix ex2: <>.\n" +
			"ex1:A a ex1:B .";
		Model n3 = ModelFactory.createDefaultModel();
		System.out.println("Parsing with N3 parser and printing prefixes:");, null, "N3");

		Model turtle = ModelFactory.createDefaultModel();
		System.out.println("Parsing with Turtle parser and printing prefixes:");, null, "TURTLE");

===== output ======

Parsing with N3 parser:
{ex2=, ex1=}
Parsing with Turtle parser:

This message is automatically generated by JIRA.
For more information on JIRA, see:


View raw message