[I see you posted to the old and new jena-dev as well - this, jena-users, is the correct list for this sort of question.]

On 03/01/2012 15:46, 锐光刘 wrote:
Firstly,thanks for concerning my problem

I want to create a new OntModel which can store the  infomation from a
another OWL file
  so create a new OntModel with this function :
   OntModel CreatedModel =
ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM_RULE_INF);
Then, get all the the statements from another OWL file such as

    StmtIterator triples = RawModel.listStatements();
(RawModel is a OntModel and contain the information from external OWL file);

Finally, I add all the statement from triples to the CreatedModel with
function   CreatedModel.add(statement);

While that will work it is easier to just do:

    newModel.add( otherModel )

However,the problem is that  the new model(CreatedModel) cann't get the
information of individuals from statements,it seems that the statements
about the individuals are filterd automatic.

No. If you have really added all the statements from the model then then are all in there. There is no filtering going on in Jena.

If you can't find them as individuals then check that they exist as plain resources. Either they weren't in the model you copied from, or Jena isn't recognizing them as Individuals (e.g. there might not be appropriate type statements) or there is some mistake in your code.

I think this maybe that I
have't create a correct Model,because when I create a empty OntModel at
this way
       OntModel CreatedModel =
ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM_RULE_INF);
      CreatedModel.write(System.out);
It display this result:


<rdf:RDF
     xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
     xmlns:owl="http://www.w3.org/2002/07/owl#";
     xmlns:xsd="http://www.w3.org/2001/XMLSchema#";
     xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#";>
</rdf:RDF>


It seems not a OWL file,but a RDFS file.

No, it is simply showing a default minimal set of namespace prefixes.

[Though in fact there's no difference between an RDFS file and and OWL full file.]

So there are only class and
subclass left in the new model after adding all statements to it .

Unlikely, see above comments.

Well, could anyone tell me how to create a new OWL File ,meanwhile can have
the same Namesapce and information  from the original OWL file.

To copy the namespace prefixes from one model to another then use:

   newModel.setNsPrefixes( oldModel )

Dave

Reply via email to