• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java RemoveImport类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: mergeImportClosure

import org.semanticweb.owlapi.model.RemoveImport; //导入依赖的package包/类
public void mergeImportClosure(boolean isRemovedImportsDeclarations) throws OWLOntologyCreationException {
	OWLOntologyManager manager = getManager();
	Set<OWLOntology> imports = sourceOntology.getImportsClosure();
	for (OWLOntology o : imports) {
		if (o.equals(sourceOntology))
			continue;
		
		String comment = "Includes "+summarizeOntology(o);
		LOG.info(comment);
		addCommentToOntology(sourceOntology, comment);
		
		manager.addAxioms(sourceOntology, o.getAxioms());
	}
	Set<OWLImportsDeclaration> oids = sourceOntology.getImportsDeclarations();
	for (OWLImportsDeclaration oid : oids) {
		RemoveImport ri = new RemoveImport(sourceOntology, oid);
		getManager().applyChange(ri);
	}
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:20,代码来源:OWLGraphWrapperBasic.java


示例2: mergeSpecificImport

import org.semanticweb.owlapi.model.RemoveImport; //导入依赖的package包/类
/**
 * Merge a specific ontology from the import closure into the main ontology.
 * Removes the import statement.
 * 
 * @param ontologyIRI id of the ontology to merge
 * @throws OWLOntologyCreationException
 */
public void mergeSpecificImport(IRI ontologyIRI) throws OWLOntologyCreationException {
	OWLOntologyManager manager = getManager();
	Set<OWLOntology> imports = sourceOntology.getImportsClosure();
	for (OWLOntology o : imports) {
		if (o.equals(sourceOntology))
			continue;
		Optional<IRI> currentIRI = o.getOntologyID().getOntologyIRI();
		if (currentIRI.isPresent() && currentIRI.get().equals(ontologyIRI)) {
			String comment = "Includes "+summarizeOntology(o);
			LOG.info(comment);
			addCommentToOntology(sourceOntology, comment);
			manager.addAxioms(sourceOntology, o.getAxioms());	
		}
	}
	Set<OWLImportsDeclaration> oids = sourceOntology.getImportsDeclarations();
	for (OWLImportsDeclaration oid : oids) {
		if (ontologyIRI.equals(oid.getIRI())) {
			RemoveImport ri = new RemoveImport(sourceOntology, oid);
			getManager().applyChange(ri);
		}
	}
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:30,代码来源:OWLGraphWrapperBasic.java


示例3: handleSupportOntologies

import org.semanticweb.owlapi.model.RemoveImport; //导入依赖的package包/类
private static List<OWLOntologyChange> handleSupportOntologies(OWLGraphWrapper graph)
{
	OWLOntology ontology = graph.getSourceOntology();
	OWLOntologyManager manager = ontology.getOWLOntologyManager();
	OWLDataFactory factory = manager.getOWLDataFactory();
	
	List<OWLOntologyChange> removeImportChanges = new ArrayList<OWLOntologyChange>();
	Set<OWLOntology> supportOntologySet = graph.getSupportOntologySet();
	for (OWLOntology support : supportOntologySet) {
		Optional<IRI> supportIRI = support.getOntologyID().getOntologyIRI();
		if(supportIRI.isPresent()) {
			IRI ontologyIRI = supportIRI.get();
			OWLImportsDeclaration importDeclaration = factory.getOWLImportsDeclaration(ontologyIRI);
			ChangeApplied status = manager.applyChange(new AddImport(ontology, importDeclaration));
			if (ChangeApplied.SUCCESSFULLY == status) {
				// the change was successful, create remove import for later
				removeImportChanges.add(new RemoveImport(ontology, importDeclaration));
			}
		}
	}
	return removeImportChanges;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:23,代码来源:AssertInferenceTool.java


示例4: updateOntology

import org.semanticweb.owlapi.model.RemoveImport; //导入依赖的package包/类
@Override
public void updateOntology(	OWLOntology generatedOntology, 
		IRI generatedOntologyIRI, 
		IRI previousOntologyIRI, 
		URI physicalURI) {
	final OWLModelManager mm = getOWLModelManager();
	IRI iri = generatedOntologyIRI;
	OWLOntology generatedOntologyToDelete = null;
	final List<OWLOntologyChange> changes = new ArrayList<OWLOntologyChange>();
	final Collection<OWLOntology> ontologies = mm.getOntologies();
	for (OWLOntology oo : ontologies) {
		if (iri.equals(oo.getOntologyID().getOntologyIRI())) {
			log.info("Removing ontology " + iri);
			generatedOntologyToDelete = oo;
		}
		changes.add(new RemoveImport(oo, getOWLOntologyManager().getOWLDataFactory()
				.getOWLImportsDeclaration(iri)));
	}
	mm.applyChanges(changes);
	changes.clear();
	
	if (generatedOntologyToDelete != null) {
		if ( !mm.removeOntology(generatedOntologyToDelete) ) {
			log.info("Removing ontology " + generatedOntologyToDelete.getOntologyID() + " NOT succesful.");
		}
	}
	
	changes.add(new SetOntologyID(generatedOntology, iri));
	changes.add(new AddImport(generatedOntology, mm.getOWLDataFactory()
			.getOWLImportsDeclaration(previousOntologyIRI)));
	mm.applyChanges(changes);	
	mm.setPhysicalURI(generatedOntology, physicalURI);		
}
 
开发者ID:psiotwo,项目名称:sdlnot-rules,代码行数:34,代码来源:SparqlDLNotRulesController.java


示例5: updateOntology

import org.semanticweb.owlapi.model.RemoveImport; //导入依赖的package包/类
@Override
public void updateOntology(
		OWLOntology generatedOntology, IRI generatedOntologyIRI, IRI previousOntologyIRI,
		URI physicalURI) {
	IRI iri = generatedOntologyIRI;
	OWLOntology generatedOntologyToDelete = null;

	final List<OWLOntologyChange> changes = new ArrayList<OWLOntologyChange>();
	final Collection<OWLOntology> ontologies = m.getOntologies();
	for (OWLOntology oo : ontologies) {
		if (iri.equals(oo.getOntologyID().getOntologyIRI())) {
			log.info("Removing ontology " + iri);
			generatedOntologyToDelete = oo;
		}
		changes.add(new RemoveImport(oo, getOWLOntologyManager()
				.getOWLDataFactory().getOWLImportsDeclaration(iri)));
	}
	m.applyChanges(changes);
	changes.clear();

	if (generatedOntologyToDelete != null) {
		m.removeOntology(generatedOntologyToDelete);
	}

	changes.add(new SetOntologyID(generatedOntology, iri));
	changes.add(new AddImport(generatedOntology, m.getOWLDataFactory()
			.getOWLImportsDeclaration(previousOntologyIRI)));
	m.applyChanges(changes);
	m.setOntologyDocumentIRI(generatedOntology, IRI.create(physicalURI));		
	try {
		m.saveOntology(generatedOntology);
	} catch (OWLOntologyStorageException e) {
		// TODO Auto-generated catch block
		e.printStackTrace();
	}
}
 
开发者ID:psiotwo,项目名称:sdlnot-rules,代码行数:37,代码来源:SparqlDLNotRulesCLIController.java


示例6: visit

import org.semanticweb.owlapi.model.RemoveImport; //导入依赖的package包/类
public OWLOntologyChange visit(AddImport addImport) {
	return new RemoveImport(addImport.getOntology(), addImport.getImportDeclaration());
}
 
开发者ID:geneontology,项目名称:minerva,代码行数:4,代码来源:ReverseChangeGenerator.java


示例7: visit

import org.semanticweb.owlapi.model.RemoveImport; //导入依赖的package包/类
@Override
public void visit(RemoveImport change) {
	defaultVisit(change);
}
 
开发者ID:liveontologies,项目名称:elk-reasoner,代码行数:5,代码来源:OwlOntologyChangeProcessorVisitor.java


示例8: testRemovingImpA

import org.semanticweb.owlapi.model.RemoveImport; //导入依赖的package包/类
/**
 * Testing correctness of the reasoner with respect to ontology changes
 * <p>
 * removing the import declaration for </impA>
 */
@Test
public void testRemovingImpA() throws Exception {

	OWLOntologyManager man = TestOWLManager.createOWLOntologyManager();
	OWLDataFactory dataFactory = man.getOWLDataFactory();

	// set up resolution of prefixes
	PrefixManager pm = new DefaultPrefixManager();
	pm.setDefaultPrefix("http://www.example.com/main#");
	pm.setPrefix("A:", "http://www.example.com/A#");
	pm.setPrefix("B:", "http://www.example.com/B#");

	// define query classes
	OWLClass mainX = dataFactory.getOWLClass(":X", pm);
	OWLClass mainY = dataFactory.getOWLClass(":Y", pm);
	OWLClass extA = dataFactory.getOWLClass("A:A", pm);
	OWLClass extB = dataFactory.getOWLClass("B:B", pm);
	OWLClass extC = dataFactory.getOWLClass("B:C", pm);

	// loading the root ontology
	OWLOntology root = loadOntology(man, "root.owl");

	// Create an ELK reasoner.
	OWLReasonerFactory reasonerFactory = new ElkReasonerFactory();
	OWLReasoner reasoner = reasonerFactory.createReasoner(root);

	try {

		// ************************************
		// ** removing the import declaration for </impA>
		// ************************************

		OWLImportsDeclaration importA = new OWLImportsDeclarationImpl(
				IRI.create("http://www.example.com#impA"));
		OWLOntologyChange change = new RemoveImport(root, importA);
		man.applyChange(change);
		reasoner.flush();

		// Now the root ontology should not import anything
		assertEquals(root.getAxiomCount(), 3);
		assertEquals(root.getImportsClosure().size(), 1);
		assertEquals(getAxioms(root).size(), 3);

		// reasoner queries -- only subsumptions of the root ontology are
		// there
		assertTrue(reasoner.getSuperClasses(mainX, true).containsEntity(
				mainY));
		assertTrue(reasoner.getSuperClasses(mainX, true).containsEntity(
				extA));
		assertTrue(reasoner.getSuperClasses(mainY, true).containsEntity(
				extB));
		assertFalse(reasoner.getSuperClasses(extA, true).containsEntity(
				extB));
		assertFalse(reasoner.getSuperClasses(extB, true).containsEntity(
				extC));

	} finally {
		reasoner.dispose();
	}

}
 
开发者ID:liveontologies,项目名称:elk-reasoner,代码行数:67,代码来源:ElkReasonerTest.java


示例9: createSubSet

import org.semanticweb.owlapi.model.RemoveImport; //导入依赖的package包/类
public void createSubSet(OWLGraphWrapper targetGraph, 
		Set<OWLClass> subset, Set<OWLOntology> toMerge, boolean isExcludeClosure,
		boolean isRemoveDangling) throws OWLOntologyCreationException  {

	OWLOntology targetOntology = targetGraph.getSourceOntology();

	// import axioms set
	Set<OWLAxiom> importAxioms = new HashSet<OWLAxiom>();
	for (OWLOntology mergeOntology : toMerge) {
		for (OWLClass cls : subset) {
			importAxioms.addAll(mergeOntology.getAxioms(cls, Imports.EXCLUDED));
		}
	}

	// remove merge imports
	OWLOntologyManager targetManager = targetOntology.getOWLOntologyManager();
	List<OWLOntologyChange> removeImports = new ArrayList<OWLOntologyChange>();
	for(OWLOntology m : toMerge) {
		removeImports.add(new RemoveImport(targetOntology, new OWLImportsDeclarationImpl(m.getOntologyID().getOntologyIRI().get())));
	}
	targetManager.applyChanges(removeImports);

	// add axiom set to target ontology.
	targetManager.addAxioms(targetOntology, importAxioms);

	LOG.info("Start Mooncat for subset.");
	Mooncat mooncat = new Mooncat(targetGraph);
	for (OWLOntology ont : toMerge) {
		mooncat.addReferencedOntology(ont);
	}

	if (!isExcludeClosure) {
		// create Closure
		Set<OWLAxiom> axioms = mooncat.getClosureAxiomsOfExternalReferencedEntities();
		mooncat.addSubAnnotationProperties(axioms);

		// add missing axioms
		targetManager.addAxioms(targetOntology, axioms);
		LOG.info("Added "+axioms.size()+" axioms to the query ontology");
	}
	
	if (isRemoveDangling) {
		mooncat.removeDanglingAxioms();
	}

	return;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:48,代码来源:QuerySubsetGenerator.java


示例10: visit

import org.semanticweb.owlapi.model.RemoveImport; //导入依赖的package包/类
@Override
public Boolean visit(RemoveImport change) {
	Objects.requireNonNull(change);
	return false;
}
 
开发者ID:julianmendez,项目名称:jcel,代码行数:6,代码来源:JcelOntologyChangeVisitorEx.java


示例11: removeImports

import org.semanticweb.owlapi.model.RemoveImport; //导入依赖的package包/类
/**
 * Remove all imports from the given ontology
 * @param ont	OWL ontology
 */
private void removeImports(OWLOntology ont) {
	for(OWLImportsDeclaration importDecl : ont.getImportsDeclarations())
		ont.getOWLOntologyManager().applyChange(new RemoveImport(ont.getOWLOntologyManager().getImportedOntology(importDecl), importDecl));
}
 
开发者ID:rsgoncalves,项目名称:ecco,代码行数:9,代码来源:Ecco.java



注:本文中的org.semanticweb.owlapi.model.RemoveImport类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SimpleNameProvider类代码示例发布时间:2022-05-22
下一篇:
Java Hierarchy类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap