It's fixed in the latest snapshot build: https://repository.apache.org/content/repositories/snapshots/org/apache/jena/jena-tdb/0.10.2-SNAPSHOT/
It must be the recent build or later:
0.10.2-20130801.182026-64
or force refresh of SNAPSHOTs in maven.
Andy
On 01/08/13 17:27, Charles Li wrote:
Thanks a lot, Andy! And awaiting the fix. Thanks! - Charles On Aug 1, 2013, at 9:20 AM, Andy Seaborne <[email protected]> wrote: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). AndyDave 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/XMLfiledefined namespace alias at the very beginning. model.listNameSpaces()gaveme all four actual namespaces without the alias. But getNsPrefixMap()onlygave 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)
