tdb will lose some information about prefix when load data from owl file, 
the same owl file sample.owl, if I create OntModel from sample.owl directly , I 
can get the prefix decleared in the owl file.
creating OntModel form owl file:     
OntModelSpec s = new OntModelSpec( OntModelSpec.OWL_DL_MEM );
     s.setDocumentManager( mgr );
     OntModel model = ModelFactory.createOntologyModel(s); 

        InputStreamReader in;  
  try {
  FileInputStream file = new FileInputStream(filePath);
  in = new InputStreamReader(file, "UTF-8");
  System.out.println("begin read");
  model.read(in, null);
  }
the part of OWL file:
<?xml version="1.0"?>
<!DOCTYPE rdf:RDF [
    <!ENTITY foaf "http://xmlns.com/foaf/0.1/"; >
    <!ENTITY owl "http://www.w3.org/2002/07/owl#"; >
    <!ENTITY xsd "http://www.w3.org/2001/XMLSchema#"; >
    <!ENTITY owlapi "http://www.semanticweb.org/owlapi#"; >
    <!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#"; >
    <!ENTITY contact "http://www.w3.org/2000/10/swap/pim/contact#"; >
    <!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#"; >
    <!ENTITY esesgrid "http://www.bjut.edu.cn/ontologies/2009/10/esesgrid.owl#"; 
>
    <!ENTITY AccessControl 
"http://www.bjut.edu.cn/ontologies/2009/12/AccessControl.owl#"; >
]>
<rdf:RDF xmlns="http://www.bjut.edu.cn/ontology/2011/10/esgrid.owl#";
     xml:base="http://www.bjut.edu.cn/ontology/2011/10/esgrid.owl";
     xmlns:contact="http://www.w3.org/2000/10/swap/pim/contact#";
     xmlns:esesgrid="http://www.bjut.edu.cn/ontologies/2009/10/esesgrid.owl#";
     xmlns:xsd="http://www.w3.org/2001/XMLSchema#";
     xmlns:owlapi="http://www.semanticweb.org/owlapi#";
     
xmlns:AccessControl="http://www.bjut.edu.cn/ontologies/2009/12/AccessControl.owl#";
     xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#";
     xmlns:foaf="http://xmlns.com/foaf/0.1/";
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
     xmlns:owl="http://www.w3.org/2002/07/owl#";>
    <owl:Ontology 
rdf:about="http://www.bjut.edu.cn/ontology/2011/10/esgrid.owl"/>
    
but when I load the sample.owl into TDB, and create OntModel from TDB, some 
prefixed will be lost, and only four prefixes can be get with 
OntModel.getNsPrefixMapping().
Dataset ds = TDBFactory.createDataset(directory);
model = ds.getDefaultModel();
ontmodel = ModelFactory.createOntologyModel(
OntModelSpec.OWL_DL_MEM_TRANS_INF, model);

does tdb only support n-triple well, and the owl file be supported poor?



Reply via email to