Sparql Jena在添加实例后更改了我的owl文件

Sparql Jena在添加实例后更改了我的owl文件,sparql,jena,owl,protege,Sparql,Jena,Owl,Protege,我有一个用Protege4.2创建的owl文件。当我使用Jena添加一些实例时,Jena更改了文件结构,但文件扩展名保持不变(.owl)。文件在protege中可读,但有一些错误。有人知道我的代码哪里有问题吗 因为在用Jena编辑之后,查询的结果有些奇怪 例如,在使用Jena编辑之前 <owl:NamedIndividual rdf:about="&ontologies;thesis_ontology_1try#AM6"> <rdf:type rdf:reso

我有一个用Protege4.2创建的owl文件。当我使用Jena添加一些实例时,Jena更改了文件结构,但文件扩展名保持不变(.owl)。文件在protege中可读,但有一些错误。有人知道我的代码哪里有问题吗

因为在用Jena编辑之后,查询的结果有些奇怪

例如,在使用Jena编辑之前

 <owl:NamedIndividual rdf:about="&ontologies;thesis_ontology_1try#AM6">
    <rdf:type rdf:resource="&ontologies;thesis_ontology_1try#ApplicationModel"/>
    <hasID rdf:datatype="&xsd;string">20125157-d62b-45de-8809-84186c7169b5AM6</hasID>
    <name rdf:datatype="&xsd;string">Gebäudemodell / Buildingmodel</name>
    <hasContent rdf:resource="&ontologies;cpixml"/>
    <hasLevelOfDetail rdf:resource="&ontologies;thesis_ontology_1try#4"/>
    <hasDomain rdf:resource="&ontologies;thesis_ontology_1try#BIM"/>
    <hasType rdf:resource="&ontologies;thesis_ontology_1try#Object"/>
    <hasPhase rdf:resource="&ontologies;thesis_ontology_1try#SLCT"/>
    <hasContent rdf:resource="&ontologies;thesis_ontology_1try#ifc"/>
</owl:NamedIndividual>
试试“RDF/XML-ABBREV”,漂亮的打印机


但不管怎样,都是相同的三元组,编写方式不同,这才是重要的。

我有一个大约20MB的rdf文件,其中包含许多个人、类和关系。当我使用about方法向rdf文件添加新的个体时,需要花费大量的时间,最终导致GC内存不足异常。有没有更好的方法来编写更改?
<rdf:Description rdf:about="http://www.semanticweb.org/thato/ontologies/2012/10/9/thesis_ontology_1try#AM6">
<hasContent rdf:resource="http://www.semanticweb.org/thato/ontologies/2012/10/9/cpixml"/>
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#NamedIndividual"/>
<hasDomain rdf:resource="http://www.semanticweb.org/thato/ontologies/2012/10/9/thesis_ontology_1try#BIM"/>
<hasType rdf:resource="http://www.semanticweb.org/thato/ontologies/2012/10/9/thesis_ontology_1try#Object"/>
<hasID rdf:datatype="http://www.w3.org/2001/XMLSchema#string">20125157-d62b-45de-8809-84186c7169b5AM6</hasID>
<hasPhase rdf:resource="http://www.semanticweb.org/thato/ontologies/2012/10/9/thesis_ontology_1try#SLCT"/>
<rdf:type rdf:resource="http://www.semanticweb.org/thato/ontologies/2012/10/9/thesis_ontology_1try#ApplicationModel"/>
<hasContent rdf:resource="http://www.semanticweb.org/thato/ontologies/2012/10/9/thesis_ontology_1try#ifc"/>
<name rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Gebäudemodell / Buildingmodel</name>
<hasLevelOfDetail rdf:resource="http://www.semanticweb.org/thato/ontologies/2012/10/9/thesis_ontology_1try#4"/>
<rdf:type rdf:nodeID="A28"/>
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Thing"/>
<rdf:type rdf:nodeID="A29"/>
<rdf:type rdf:nodeID="A30"/>
<rdf:type rdf:nodeID="A31"/>
<rdf:type rdf:nodeID="A32"/>
<rdf:type rdf:resource="http://www.w3.org/2000/01/rdf-schema#Resource"/>
<rdf:type rdf:nodeID="A33"/>
<rdf:type rdf:nodeID="A34"/>
<rdf:type rdf:nodeID="A12"/>
<rdf:type rdf:nodeID="A15"/>
<rdf:type rdf:nodeID="A35"/>
<rdf:type rdf:nodeID="A5"/>
<Linkedby rdf:resource="http://www.semanticweb.org/thato/ontologies/2012/10/9/thesis_ontology_1try#LM2"/>
<isAMof rdf:resource="http://www.semanticweb.org/thato/ontologies/2012/10/9/thesis_ontology_1try#MMC2"/>
public static void main(String[] args) throws IOException {
InputStream in = FileManager.get().open("./src/thesis_ontology_1try.owl");
OntModel model = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM_MICRO_RULE_INF, null);
model.read(in, null);
in.close();

String NS = "http://www.semanticweb.org/thato/ontologies/2012/10/9/thesis_ontology_1try#";
OntClass ApplicationModel = model.getOntClass(NS + "ApplicationModel");


Individual dom = model.getIndividual(NS + "RFP");
Individual pha = model.getIndividual(NS + "SLCT");
Individual lev =  model.getIndividual(NS + "3");

Individual new1 = model.createIndividual(NS + "new1", ApplicationModel);  

ObjectProperty domain = model.createObjectProperty(NS +"hasDomain");
ObjectProperty phase = model.createObjectProperty(NS +"hasPhase");
ObjectProperty lod = model.createObjectProperty(NS +"hasLevelOfDetail");

model.add(new1, domain, dom);
model.add(new1, phase, pha);
model.add(new1, lod, lev);


PrintStream p= new PrintStream("./src/thesis_ontology_1try.owl");
model.writeAll(p, "RDF/XML", null);
p.close();

System.out.println("Done");


}

}
model.writeAll(p, "RDF/XML", null);