the prefixes does exist in the owl file where the model o was created from, but when we convert the owl file into n-triple, the prefixes will be lost. I know the prefixes are merely syntax, but we will need to get the default URI of one OntModel witl OntModel.getNsPrefixURI().
I think the loss of prefix information was caused by the difference of syntax between the OWL format and N-Triple. right? -------------------------------------------------- From: "Andy Seaborne" <[email protected]> Sent: Friday, December 02, 2011 9:51 PM To: <[email protected]> Subject: Re: a problem about TDB >> the part of OWL file: > > Hi there - could you provide > > 1/ A complete, minimal example. Not fragments. > A small complete datafile. > A small complete program. > > In the memory case yo read directly into the ontModel and the TDB case, > you wrap an existing model > > 2/ In reply to your previous, I asked whether model o had the prefixes. > I ask again: does model 'model' have the prefixes? > > Prefixes are merely syntax - they don't affect the RDF triples. > > Andy > > On 02/12/11 03:04, xh-zh wrote: >> 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? >> >> >> > >
