On 01/08/13 16:44, Dave Reynolds wrote:
If you create a TDB model and read the file into it programatically then
the prefixes are stored and getNsPrefixMap will work.

I don't think tdbloader stores prefixes. Not sure if there's a flag to
control that.

It does not record prefixes - no flag either.

Recorded as:
https://issues.apache.org/jira/browse/JENA-496
        
and fix in progress (been meaning to fix this).

        Andy


Dave

On 01/08/13 16:12, Charles Li wrote:
The only difference is that I first used the TDB loader to load the
sampleRdfXML.xml into a directory, say <my_model_dir>. Then

model = TDBFactory.createDataset(my_model_dir).getDefaultModel() ;
System.err.println( m.getNsPrefixMap() );

And nothing printed out.




On Thu, Aug 1, 2013 at 9:56 AM, Chris Dollin
<[email protected]>wrote:

On Thursday, August 01, 2013 09:23:46 AM Charles Li wrote:
I tried again using a very small RDF/XML file (attached). This RDF/XML
file
defined namespace alias at the very beginning. model.listNameSpaces()
gave
me all four actual namespaces without the alias. But getNsPrefixMap()
only
gave me an empty Map.

Hmm, works for me. Show (minimal, complete) code; mine's below.

Could this be a bug in getNsPrefixMap()?

Possible but unlikely: I would have expected it to show up much sooner
if so.


////////////////////////////////////////////////////////////////////////////////////


Code (using memory model):

package cmd;

import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.util.FileManager;

public class scog {

         public static void main( String [] args ) {
                 Model m = FileManager.get().loadModel(
"/home/chris/Documents/sampleRdfXML.xml" );
                 System.err.println( m.getNsPrefixMap() );
                 m.write( System.out, "TTL" );
         }
}

--
"The wizard seemed quite willing when I talked to him."  /Howl's Moving
Castle/

Epimorphics Ltd, http://www.epimorphics.com
Registered address: Court Lodge, 105 High Street, Portishead, Bristol
BS20
6PT
Epimorphics Ltd. is a limited company registered in England (number
7016688)





Reply via email to