On Thursday, August 01, 2013 10:12:24 AM 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.
I suspect the model with your data isn't the model you're extracting the prefix map from, but I can't tell, because I can't see your actual executable code. (And I don't have the TDB API paged into my head right now, either ...) > 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) > > > > -- "You're down as expendable. You don't get a weapon." /Dark Lord of Derkholm/ 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)
