1.go.owl源码
<owl:Class rdf:about="http://purl.obolibrary.org/obo/GO_0045019">
<obo:IAO_0000115 rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Any process that stops, prevents, or reduces the frequency, rate or extent of the chemical reactions
and pathways resulting in the formation of nitric oxide.</obo:IAO_0000115>
<oboInOwl:id rdf:datatype="http://www.w3.org/2001/XMLSchema#string">GO:0045019</oboInOwl:id>
<oboInOwl:hasOBONamespace rdf:datatype="http://www.w3.org/2001/XMLSchema#string">biological_process</oboInOwl:hasOBONamespace>
<oboInOwl:hasExactSynonym rdf:datatype="http://www.w3.org/2001/XMLSchema#string">down regulation of nitric oxide biosynthetic process</oboInOwl:hasExactSynonym>
<oboInOwl:hasExactSynonym rdf:datatype="http://www.w3.org/2001/XMLSchema#string">down-regulation of nitric oxide biosynthetic process</oboInOwl:hasExactSynonym>
<oboInOwl:hasExactSynonym rdf:datatype="http://www.w3.org/2001/XMLSchema#string">downregulation of nitric oxide biosynthetic process</oboInOwl:hasExactSynonym>
<oboInOwl:hasNarrowSynonym rdf:datatype="http://www.w3.org/2001/XMLSchema#string">inhibition of nitric oxide biosynthetic process</oboInOwl:hasNarrowSynonym>
<oboInOwl:hasExactSynonym rdf:datatype="http://www.w3.org/2001/XMLSchema#string">negative regulation of nitric oxide anabolism</oboInOwl:hasExactSynonym>
<oboInOwl:hasExactSynonym rdf:datatype="http://www.w3.org/2001/XMLSchema#string">negative regulation of nitric oxide biosynthesis</oboInOwl:hasExactSynonym>
<oboInOwl:hasExactSynonym rdf:datatype="http://www.w3.org/2001/XMLSchema#string">negative regulation of nitric oxide formation</oboInOwl:hasExactSynonym>
<oboInOwl:hasExactSynonym rdf:datatype="http://www.w3.org/2001/XMLSchema#string">negative regulation of nitric oxide synthesis</oboInOwl:hasExactSynonym>
</owl:Class>
2.实现程序
package test;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import org.apache.jena.ontology.AnnotationProperty;
import org.apache.jena.ontology.OntClass;
import org.apache.jena.ontology.OntModel;
import org.apache.jena.ontology.OntModelSpec;
import org.apache.jena.rdf.model.ModelFactory;
import org.apache.jena.rdf.model.Property;
public class Insert2 {
public static void main(String args[]) throws FileNotFoundException{
final OntModel ontModel = ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM);
ontModel.read(new FileInputStream("f://myowl.owl"), "");
String OBO = "http://purl.obolibrary.org/obo/";
String OBOINOWL = "http://www.geneontology.org/formats/oboInOwl#";
//新建类
OntClass ontClass = ontModel.createClass(OBO+"GO_0045019");
//新建property
AnnotationProperty p = ontModel.createAnnotationProperty(OBO+"IAO_0000115");
p.addLabel("definition", "");
Property p1 = ontModel.createProperty(OBOINOWL+"id");
Property p2 = ontModel.createProperty(OBOINOWL+"hasOBONamespace");
Property p3 = ontModel.createProperty(OBOINOWL+"hasExactSynonym");
ontClass.addProperty(p, "Any process that stops, prevents, or reduces the frequency, rate or extent of the chemical reactions and pathways resulting in the formation of nitric oxide.");
ontClass.addProperty(p1, "GO:0045019");
ontClass.addProperty(p2, "biological_process");
ontClass.addProperty(p3, "down regulation of nitric oxide biosynthetic process");
ontModel.write(new FileOutputStream("f://go-minus1.owl"));
}
}
3.实现结果
<owl:Class rdf:about="http://purl.obolibrary.org/obo/GO_0045019">
<oboInOwl:hasExactSynonym>down regulation of nitric oxide biosynthetic process</oboInOwl:hasExactSynonym>
<oboInOwl:hasOBONamespace>biological_process</oboInOwl:hasOBONamespace>
<oboInOwl:id>GO:0045019</oboInOwl:id>
<obo:IAO_0000115>Any process that stops, prevents, or reduces the frequency, rate or extent of the chemical reactions and pathways resulting in the formation of nitric oxide.</obo:IAO_0000115>
</owl:Class>
<owl:AnnotationProperty rdf:about="http://purl.obolibrary.org/obo/IAO_0000115">
<rdfs:label>definition</rdfs:label>
</owl:AnnotationProperty>