• 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏吧

Java OWLOntologyDocumentTarget类的典型用法和代码示例

java 2次浏览

本文整理汇总了Java中org.semanticweb.owlapi.io.OWLOntologyDocumentTarget的典型用法代码示例。如果您正苦于以下问题:Java OWLOntologyDocumentTarget类的具体用法?Java OWLOntologyDocumentTarget怎么用?Java OWLOntologyDocumentTarget使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。

OWLOntologyDocumentTarget类属于org.semanticweb.owlapi.io包,在下文中一共展示了OWLOntologyDocumentTarget类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: parseImports

点赞 3

import org.semanticweb.owlapi.io.OWLOntologyDocumentTarget; //导入依赖的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

示例2: writeInternal

点赞 2

import org.semanticweb.owlapi.io.OWLOntologyDocumentTarget; //导入依赖的package包/类
@Override
protected void writeInternal(OWLOntology ontology, HttpOutputMessage httpOutputMessage)
    throws IOException, HttpMessageNotWritableException {
  OWLOntologyDocumentTarget target = new StringDocumentTarget();

  try {
    ontology.saveOntology(documentFormat, target);
  } catch (OWLOntologyStorageException e) {
    // should not happpen
    throw new IllegalStateException(e);
  }

  httpOutputMessage.getBody().write(target.toString().getBytes());
}
 

开发者ID:VisualDataWeb,
项目名称:OntoBench,
代码行数:15,
代码来源:OntologyHttpMessageConverter.java

示例3: storeOntology

点赞 2

import org.semanticweb.owlapi.io.OWLOntologyDocumentTarget; //导入依赖的package包/类
@Override
public void storeOntology(@Nonnull OWLOntology ontology, @Nonnull OWLOntologyDocumentTarget target, @Nonnull OWLDocumentFormat format) throws OWLOntologyStorageException, IOException {
    if(target.isOutputStreamAvailable()) {
        storeOntology(ontology, new BufferedOutputStream(target.getOutputStream()));
    }
    else {
        throw new OWLOntologyStorageException("Unsupported target type");
    }
}
 

开发者ID:matthewhorridge,
项目名称:binaryowl,
代码行数:10,
代码来源:BinaryOWLOntologyDocumentStorer.java

示例4: writeOntology

点赞 2

import org.semanticweb.owlapi.io.OWLOntologyDocumentTarget; //导入依赖的package包/类
public void writeOntology(OWLOntology o, OWLOntologyDocumentTarget documentTarget)
        throws OWLOntologyStorageException {
    m.saveOntology(o, documentTarget);
}
 

开发者ID:jottinger,
项目名称:owlapi-tutorial,
代码行数:5,
代码来源:OntologyHelper.java

示例5: testRemove

点赞 2

import org.semanticweb.owlapi.io.OWLOntologyDocumentTarget; //导入依赖的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


版权声明:本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系管理员进行删除。
喜欢 (0)