本文整理汇总了Java中org.semanticweb.owlapi.formats.RDFXMLDocumentFormat类的典型用法代码示例。如果您正苦于以下问题:Java RDFXMLDocumentFormat类的具体用法?Java RDFXMLDocumentFormat怎么用?Java RDFXMLDocumentFormat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RDFXMLDocumentFormat类属于org.semanticweb.owlapi.formats包,在下文中一共展示了RDFXMLDocumentFormat类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: export
import org.semanticweb.owlapi.formats.RDFXMLDocumentFormat; //导入依赖的package包/类
@UITopiaVariant(
author = "onprom team",
affiliation = "Free University of Bozen-Bolzano",
email = "[email protected]",
website = "http://onprom.inf.unibz.it"
)
@PluginVariant(requiredParameterLabels = {0, 1})
public void export(PluginContext context, OWLOntology ontology, File file) {
try {
//default format is RDF/XML format for the ontology
RDFDocumentFormat format = new RDFXMLDocumentFormat();
//save the given ontology using the format to the file
OWLManager.createOWLOntologyManager().saveOntology(ontology, format, new FileOutputStream(file));
context.log("Exported ontology to the file: " + file.getName());
} catch (Exception e) {
context.log("Couldn't export ontology to the file: " + file.getName() + " ->" + e.getMessage());
}
}
开发者ID:onprom,项目名称:onprom,代码行数:19,代码来源:OWLOntologyExportPlugin.java
示例2: headerOWL
import org.semanticweb.owlapi.formats.RDFXMLDocumentFormat; //导入依赖的package包/类
public void headerOWL() {
if (isOWLOntologyFormat()) {
LOG.info("using OWL ontology header");
OWLDocumentFormat ofmt = this.getOWLOntologyFormat();
if (ofmt instanceof RDFXMLDocumentFormat) {
response.setContentType("application/rdf+xml;charset-utf-8");
}
else if (ofmt instanceof OWLXMLDocumentFormat) {
response.setContentType("application/xml;charset-utf-8");
}
else {
response.setContentType("text/plain;charset-utf-8");
}
}
else {
response.setContentType("text/plain;charset-utf-8");
}
response.setStatus(HttpServletResponse.SC_OK);
}
开发者ID:owlcollab,项目名称:owltools,代码行数:20,代码来源:OWLHandler.java
示例3: testConversion
import org.semanticweb.owlapi.formats.RDFXMLDocumentFormat; //导入依赖的package包/类
@Ignore
@Test
public void testConversion() throws Exception {
ParserWrapper pw = new ParserWrapper();
OWLOntology ont = pw.parse("http://purl.obolibrary.org/obo/go.owl");
OWLGraphWrapper g = new OWLGraphWrapper(ont);
GafObjectsBuilder builder = new GafObjectsBuilder();
GafDocument gafdoc = builder.buildDocument("http://geneontology.org/gene-associations/gene_association.GeneDB_Spombe.gz");
GAFOWLBridge bridge = new GAFOWLBridge(g);
OWLOntology gafOnt = g.getManager().createOntology();
bridge.setTargetOntology(gafOnt);
bridge.translate(gafdoc);
OWLDocumentFormat owlFormat = new RDFXMLDocumentFormat();
g.getManager().saveOntology(gafOnt, owlFormat, IRI.create(new File("/tmp/gaf.owl")));
for (OWLAxiom ax : gafOnt.getAxioms()) {
//LOG.info("AX:"+ax);
}
}
开发者ID:owlcollab,项目名称:owltools,代码行数:25,代码来源:PombeGAFOWLBridgeTest.java
示例4: testConversion
import org.semanticweb.owlapi.formats.RDFXMLDocumentFormat; //导入依赖的package包/类
@Test
public void testConversion() throws Exception{
ParserWrapper pw = new ParserWrapper();
OWLOntology ont = pw.parse(getResourceIRIString("go_xp_predictor_test_subset.obo"));
OWLGraphWrapper g = new OWLGraphWrapper(ont);
g.addSupportOntology(pw.parse(getResourceIRIString("gorel.owl")));
GafObjectsBuilder builder = new GafObjectsBuilder();
GafDocument gafdoc = builder.buildDocument(getResource("xp_inference_test.gaf"));
GAFOWLBridge bridge = new GAFOWLBridge(g);
OWLOntology gafOnt = g.getManager().createOntology();
bridge.setTargetOntology(gafOnt);
bridge.translate(gafdoc);
OWLDocumentFormat owlFormat = new RDFXMLDocumentFormat();
g.getManager().saveOntology(gafOnt, owlFormat, IRI.create(new File("/tmp/gaf.owl")));
for (OWLAxiom ax : gafOnt.getAxioms()) {
LOG.info("AX:"+ax);
}
}
开发者ID:owlcollab,项目名称:owltools,代码行数:25,代码来源:GAFOWLBridgeTest.java
示例5: testConversion
import org.semanticweb.owlapi.formats.RDFXMLDocumentFormat; //导入依赖的package包/类
@Test
public void testConversion() throws Exception{
ParserWrapper pw = new ParserWrapper();
OWLOntology ont = pw.parse(getResourceIRIString("go_xp_predictor_test_subset.obo"));
OWLGraphWrapper g = new OWLGraphWrapper(ont);
g.addSupportOntology(pw.parse(getResourceIRIString("gorel.owl")));
GafObjectsBuilder builder = new GafObjectsBuilder();
GafDocument gafdoc = builder.buildDocument(getResource("xp_inference_test.gaf"));
BasicABox bridge = new BasicABox(g);
OWLOntology gafOnt = g.getManager().createOntology();
bridge.setTargetOntology(gafOnt);
bridge.translate(gafdoc);
OWLDocumentFormat owlFormat = new RDFXMLDocumentFormat();
g.getManager().saveOntology(gafOnt, owlFormat, IRI.create(new File("target/foo.owl")));
for (OWLAxiom ax : gafOnt.getAxioms()) {
LOG.info("AX:"+ax);
}
}
开发者ID:owlcollab,项目名称:owltools,代码行数:25,代码来源:BasicAboxBridgeTest.java
示例6: testConversion
import org.semanticweb.owlapi.formats.RDFXMLDocumentFormat; //导入依赖的package包/类
@Test
public void testConversion() throws Exception{
ParserWrapper pw = new ParserWrapper();
OWLOntology ont = pw.parse(getResourceIRIString("go_xp_predictor_test_subset.obo"));
OWLGraphWrapper g = new OWLGraphWrapper(ont);
g.addSupportOntology(pw.parse(getResourceIRIString("gorel.owl")));
GafObjectsBuilder builder = new GafObjectsBuilder();
GafDocument gafdoc = builder.buildDocument(getResource("mgi-exttest.gaf"));
GAFOWLBridge bridge = new GAFOWLBridge(g);
bridge.setGenerateIndividuals(false);
OWLOntology gafOnt = g.getManager().createOntology();
bridge.setTargetOntology(gafOnt);
bridge.translate(gafdoc);
OWLDocumentFormat owlFormat = new RDFXMLDocumentFormat();
g.getManager().saveOntology(gafOnt, owlFormat, IRI.create(new File("target/gaf.owl")));
for (OWLAxiom ax : gafOnt.getAxioms()) {
//LOG.info("AX:"+ax);
}
}
开发者ID:owlcollab,项目名称:owltools,代码行数:26,代码来源:MgiGAFOWLBridgeTest.java
示例7: testConversionToIndividuals
import org.semanticweb.owlapi.formats.RDFXMLDocumentFormat; //导入依赖的package包/类
@Test
public void testConversionToIndividuals() throws Exception{
ParserWrapper pw = new ParserWrapper();
OWLOntology ont = pw.parse(getResourceIRIString("go_xp_predictor_test_subset.obo"));
OWLGraphWrapper g = new OWLGraphWrapper(ont);
g.addSupportOntology(pw.parse(getResourceIRIString("gorel.owl")));
GafObjectsBuilder builder = new GafObjectsBuilder();
GafDocument gafdoc = builder.buildDocument(getResource("mgi-exttest.gaf"));
GAFOWLBridge bridge = new GAFOWLBridge(g);
bridge.setGenerateIndividuals(false);
OWLOntology gafOnt = g.getManager().createOntology();
bridge.setTargetOntology(gafOnt);
bridge.setBasicAboxMapping(true);
bridge.translate(gafdoc);
OWLDocumentFormat owlFormat = new RDFXMLDocumentFormat();
g.getManager().saveOntology(gafOnt, owlFormat, IRI.create(new File("target/gaf-abox.owl")));
for (OWLAxiom ax : gafOnt.getAxioms()) {
//LOG.info("AX:"+ax);
}
}
开发者ID:owlcollab,项目名称:owltools,代码行数:27,代码来源:MgiGAFOWLBridgeTest.java
示例8: getSuffix
import org.semanticweb.owlapi.formats.RDFXMLDocumentFormat; //导入依赖的package包/类
private String getSuffix(OWLDocumentFormat format) {
if (format instanceof RDFXMLDocumentFormat) {
return "owl";
}
if (format instanceof FunctionalSyntaxDocumentFormat) {
return "ofn";
}
if (format instanceof OWLXMLDocumentFormat) {
return "owx";
}
if (format instanceof ManchesterSyntaxDocumentFormat) {
return "omn";
}
return "owl";
}
开发者ID:owlcollab,项目名称:owltools,代码行数:17,代码来源:BridgeExtractor.java
示例9: parseImports
import org.semanticweb.owlapi.formats.RDFXMLDocumentFormat; //导入依赖的package包/类
/**
* Method that uses the loaded ontology and parses it in case there are imports that have not been considered
* @param considerImportedOntologies
* @param manager
* @param ontology
* @return
* @throws OWLOntologyCreationException
* @throws OWLOntologyStorageException
* @throws URISyntaxException
*/
private static String parseImports(
boolean considerImportedOntologies,
OWLOntologyManager manager,
OWLOntology ontology)
throws OWLOntologyCreationException, OWLOntologyStorageException, URISyntaxException {
String result = "";
if (considerImportedOntologies) {
//considerImportedClosure || //<- removed for the moment
Set<OWLOntology> setOfImportedOntologies = new HashSet<OWLOntology>();
setOfImportedOntologies.addAll(ontology.getDirectImports());
// else {
// setOfImportedOntologies.addAll(ontology.getImportsClosure());
// }
for (OWLOntology importedOntology : setOfImportedOntologies) {
manager.addAxioms(ontology, importedOntology.getAxioms());
}
}
OWLOntologyDocumentTarget parsedOntology = new StringDocumentTarget();
manager.saveOntology(ontology,new RDFXMLDocumentFormat(), parsedOntology);
result = parsedOntology.toString();
// }
return result;
}
开发者ID:dgarijo,项目名称:Widoco,代码行数:35,代码来源:LODEGeneration.java
示例10: saveOntology
import org.semanticweb.owlapi.formats.RDFXMLDocumentFormat; //导入依赖的package包/类
static void saveOntology(OWLOntology ontology, File file) throws Exception {
if (file.getName().endsWith(".ttl")) {
manager.saveOntology(ontology, new TurtleDocumentFormat(), new FileOutputStream(file));
} else if (file.getName().endsWith(".xml")) {
manager.saveOntology(ontology, new OWLXMLDocumentFormat(), new FileOutputStream(file));
} else {
manager.saveOntology(ontology, new RDFXMLDocumentFormat(), new FileOutputStream(file));
}
}
开发者ID:onprom,项目名称:onprom,代码行数:10,代码来源:OWLUtility.java
示例11: initializeFormat
import org.semanticweb.owlapi.formats.RDFXMLDocumentFormat; //导入依赖的package包/类
/**
* Initialize the format with standard default prefixes
* (rdf, rdfs, xsd, owl) and with the prefixes we will use
* (obo, oio, iao).
*
* @return The format with the prefixes set.
*/
protected static RDFXMLDocumentFormat initializeFormat() {
RDFXMLDocumentFormat format = new RDFXMLDocumentFormat();
format.copyPrefixesFrom(new DefaultPrefixManager());
format.setPrefix("obo", OBO);
format.setPrefix("oio", OIO);
format.setPrefix("iao", IAO);
format.setPrefix("ncbi", NCBI);
format.setPrefix("ncbitaxon", OBO + "ncbitaxon#");
return format;
}
开发者ID:owlcollab,项目名称:owltools,代码行数:18,代码来源:OWLConverter.java
示例12: expandLabel
import org.semanticweb.owlapi.formats.RDFXMLDocumentFormat; //导入依赖的package包/类
private String expandLabel(String subject, String property,
String value) {
RDFXMLDocumentFormat format = OWLConverter.format;
// TODO: Why is "Annotation" always doubled?
return "AnnotationAssertion(" +
property + " <" +
format.getIRI(subject) + "> \"" +
value +"\"^^xsd:string)";
}
开发者ID:owlcollab,项目名称:owltools,代码行数:10,代码来源:NCBI2OWLTest.java
示例13: expandAnnotation
import org.semanticweb.owlapi.formats.RDFXMLDocumentFormat; //导入依赖的package包/类
private String expandAnnotation(String subject, String property,
String value) {
RDFXMLDocumentFormat format = OWLConverter.format;
// TODO: Why is "Annotation" always doubled?
return "AnnotationAssertion(<" +
format.getIRI(property) + "> <" +
format.getIRI(subject) + "> \"" +
value +"\"^^xsd:string)";
}
开发者ID:owlcollab,项目名称:owltools,代码行数:10,代码来源:NCBI2OWLTest.java
示例14: expandSynonym
import org.semanticweb.owlapi.formats.RDFXMLDocumentFormat; //导入依赖的package包/类
private String expandSynonym(String subject, String type,
String property, String value) {
RDFXMLDocumentFormat format = OWLConverter.format;
return "AnnotationAssertion(Annotation(<" +
format.getIRI("oio:hasSynonymType").toString() + "> <" +
format.getIRI(type).toString() + ">) <" +
format.getIRI(property) + "> <" +
format.getIRI(subject) + "> \"" +
value +"\"^^xsd:string)";
}
开发者ID:owlcollab,项目名称:owltools,代码行数:11,代码来源:NCBI2OWLTest.java
示例15: saveOntology
import org.semanticweb.owlapi.formats.RDFXMLDocumentFormat; //导入依赖的package包/类
public void saveOntology(String fn) throws FileNotFoundException, OWLOntologyStorageException {
FileOutputStream os = new FileOutputStream(new File(fn));
OWLDocumentFormat owlFormat = new RDFXMLDocumentFormat();
owlOntologyManager.saveOntology(sourceOntology, owlFormat, os);
}
开发者ID:owlcollab,项目名称:owltools,代码行数:7,代码来源:OldSimpleOwlSim.java
示例16: saveBridgeOntologies
import org.semanticweb.owlapi.formats.RDFXMLDocumentFormat; //导入依赖的package包/类
public void saveBridgeOntologies(String dir) throws FileNotFoundException, OWLOntologyStorageException {
saveBridgeOntologies(dir, new RDFXMLDocumentFormat());
}
开发者ID:owlcollab,项目名称:owltools,代码行数:4,代码来源:BridgeExtractor.java
示例17: saveOWL
import org.semanticweb.owlapi.formats.RDFXMLDocumentFormat; //导入依赖的package包/类
public void saveOWL(OWLOntology ont, String file) throws OWLOntologyStorageException, IOException {
OWLDocumentFormat owlFormat = new RDFXMLDocumentFormat();
saveOWL(ont, owlFormat, file);
}
开发者ID:owlcollab,项目名称:owltools,代码行数:5,代码来源:ParserWrapper.java
示例18: testRemove
import org.semanticweb.owlapi.formats.RDFXMLDocumentFormat; //导入依赖的package包/类
@Test
public void testRemove() throws Exception {
ParserWrapper pw = new ParserWrapper();
OWLGraphWrapper g = pw.parseToOWLGraph(getResourceIRIString("mooncat/remove-directives-test1.obo"));
System.out.println(g.getSourceOntology().getAxioms(AxiomType.EQUIVALENT_CLASSES));
OWLOntology secondary = pw.parse(getResourceIRIString("mooncat/remove-directives-test2.obo"));
System.out.println(secondary.getAxioms(AxiomType.EQUIVALENT_CLASSES));
g.addSupportOntology(secondary);
Mooncat mooncat = new Mooncat(g);
//mooncat.mergeOntologies();
g.mergeOntology(secondary);
OWLOntology merged = g.getSourceOntology();
System.out.println(merged.getAxioms(AxiomType.EQUIVALENT_CLASSES));
Owl2Obo owl2Obo = new Owl2Obo();
OBODoc mergedObo = owl2Obo.convert(merged);
if (USE_SYSTEM_OUT) {
System.out.println("------------------------");
OWLOntologyManager manager = merged.getOWLOntologyManager();
OWLOntologyDocumentTarget documentTarget = new SystemOutDocumentTarget();
manager.saveOntology(merged, new RDFXMLDocumentFormat(), documentTarget);
System.out.println("------------------------");
String oboString = renderOBOtoString(mergedObo);
System.out.println(oboString);
System.out.println("------------------------");
}
Frame headerFrame = mergedObo.getHeaderFrame();
String owlAxiomString = headerFrame.getTagValue(OboFormatTag.TAG_OWL_AXIOMS, String.class);
assertNotNull(owlAxiomString);
Frame frame = mergedObo.getTermFrame("X:1");
Collection<Clause> clauses = frame.getClauses(OboFormatTag.TAG_INTERSECTION_OF);
assertEquals(2, clauses.size());
}
开发者ID:owlcollab,项目名称:owltools,代码行数:43,代码来源:RemoveDirectivesTest.java
注:本文中的org.semanticweb.owlapi.formats.RDFXMLDocumentFormat类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论