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

Java PrefixManager类代码示例

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

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



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

示例1: testOWLClassHashCode

import org.semanticweb.owlapi.model.PrefixManager; //导入依赖的package包/类
/**
 * Test that two {@code OWLClass}es that are equal have a same hashcode, 
 * because the OWLGraphEdge bug get me paranoid. 
 */
@Test
public void testOWLClassHashCode()
{
	 OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
	 OWLDataFactory factory = manager.getOWLDataFactory(); 
	 IRI iri = IRI.create("http://www.foo.org/#A");
	 OWLClass class1 = factory.getOWLClass(iri);
	 //get the class by another way, even if if I suspect the two references 
	 //will point to the same object
	 PrefixManager pm = new DefaultPrefixManager("http://www.foo.org/#"); 
	 OWLClass class2 = factory.getOWLClass(":A", pm);
	 
	 assertTrue("The two references point to different OWLClass objects", 
			 class1 == class2);
	 //then of course the hashcodes will be the same...
	 assertTrue("Two OWLClasses are equal but have different hashcode", 
			 class1.equals(class2) && class1.hashCode() == class2.hashCode());
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:23,代码来源:OWLGraphManipulatorTest.java


示例2: owlOntology

import org.semanticweb.owlapi.model.PrefixManager; //导入依赖的package包/类
@Bean
@Scope(value = WebApplicationContext.SCOPE_REQUEST, proxyMode = ScopedProxyMode.INTERFACES)
public OWLMutableOntology owlOntology(PrefixManager prefixManager) throws OWLOntologyCreationException {
  if (prefixManager.getDefaultPrefix() == null) {
    throw new IllegalStateException("Default ontology prefix must not be null.");
  }

  OWLOntologyManager ontologyManager = OWLManager.createOWLOntologyManager();
  // Cast to a mutable ontology to pass OWLApi's strange checks
  return (OWLMutableOntology) ontologyManager.createOntology(IRI.create(prefixManager.getDefaultPrefix()));
}
 
开发者ID:VisualDataWeb,项目名称:OntoBench,代码行数:12,代码来源:OwlApiConfig.java


示例3: createOWLAxiomsFromConceptVersionBI

import org.semanticweb.owlapi.model.PrefixManager; //导入依赖的package包/类
/**
 * Creates the owl axioms from concept version bi.
 *
 * @param setOfAxioms the set of axioms
 * @param factory the factory
 * @param pm the pm
 * @param conceptVersionBI the concept version bi
 * @return the OWL class
 * @throws Exception the exception
 */
private OWLClass createOWLAxiomsFromConceptVersionBI(
  Set<OWLAxiom> setOfAxioms, OWLDataFactory factory, PrefixManager pm,
  ConceptVersionBI conceptVersionBI) throws Exception {
  // Declaration
  OWLClass owlClass =
      factory.getOWLClass(":" + getSnomedConceptID(conceptVersionBI), pm);
  OWLDeclarationAxiom declarationAxiom =
      factory.getOWLDeclarationAxiom(owlClass);
  setOfAxioms.add(declarationAxiom);
  // Create annotation type axiom
  // Fully specified description
  OWLAnnotation labelAnnotation =
      factory.getOWLAnnotation(factory.getRDFSLabel(), factory.getOWLLiteral(
          conceptVersionBI.getFullySpecifiedDescription().getText(),
          conceptVersionBI.getFullySpecifiedDescription().getLang()));
  OWLAxiom labelAnnotationAxiom =
      factory.getOWLAnnotationAssertionAxiom(owlClass.getIRI(),
          labelAnnotation);
  setOfAxioms.add(labelAnnotationAxiom);

  // Preferred name
  OWLAnnotation preferredTerm =
      factory.getOWLAnnotation(factory.getOWLAnnotationProperty(IRI
          .create(snomedEnUsPreferredAnnotation)), factory.getOWLLiteral(
          conceptVersionBI.getPreferredDescription().getText(),
          conceptVersionBI.getPreferredDescription().getLang()));
  OWLAxiom preferredTermAx =
      factory
          .getOWLAnnotationAssertionAxiom(owlClass.getIRI(), preferredTerm);
  setOfAxioms.add(preferredTermAx);

  return owlClass;
}
 
开发者ID:Apelon-VA,项目名称:ISAAC,代码行数:44,代码来源:OWLExporter.java


示例4: printRelations

import org.semanticweb.owlapi.model.PrefixManager; //导入依赖的package包/类
/**
* Print out RelEx relations. All relations shown
* in a binary form.
*
* Example:
*       _subj(throw, John)
*       _obj(throw, ball)
*       tense(throw, past)
*       definite-FLAG(ball, T)
*       noun_number(ball, singular)
*/
public void printRelations(ParsedSentence parse, String sentence, int sentence_id, String ontologyname)
{
	try
	{
		sent = sentence;

		//Add the sentence to Sentence Class
		this.sentence_id = sentence_id;
		sentenceInd = factory.getOWLNamedIndividual(IRI.create(ontologyURI + "#" + "sentence_" + sentence_id));
		//OWLAnnotationProperty p = new OWLAnnotationPropertyImpl(IRI.create(sentence));

		//OWLAnnotation label = factory.getOWLAnnotation(sentence);
		OWLOntologyFormat ontologyFormat = manager.getOntologyFormat(ontology);
		OWLAnnotation label = (OWLAnnotation) factory.getOWLAnnotationProperty(sentence, (PrefixManager) ontologyFormat);

		OWLClassAssertionAxiom sentClass = factory.getOWLClassAssertionAxiom(this.sentence,sentenceInd);
		OWLAnnotationAssertionAxiom labelClass = factory.getOWLAnnotationAssertionAxiom((OWLAnnotationSubject) sentClass, label);
		manager.applyChange(new AddAxiom(ontology, sentClass));
		manager.applyChange(new AddAxiom(ontology, labelClass));

		printRelations(parse, null);

	}
	catch (OWLOntologyChangeException ex)
	{
		Logger.getLogger(OWLView.class.getName()).log(Level.SEVERE, null, ex);
	}
}
 
开发者ID:opencog,项目名称:relex,代码行数:40,代码来源:OWLView.java


示例5: DefaultPrefixManager

import org.semanticweb.owlapi.model.PrefixManager; //导入依赖的package包/类
/**
 * @param pm
 *        the prefix manager to copy
 * @param c
 *        comparator to sort prefixes
 * @param defaultPrefix
 *        default prefix
 */
public DefaultPrefixManager(@Nullable PrefixManager pm, @Nullable StringComparator c,
    @Nullable String defaultPrefix) {
    comparator = c == null ? new StringLengthComparator() : c;
    prefix2NamespaceMap = new TreeMap<>(comparator);
    setupDefaultPrefixes();
    if (pm != null) {
        copyPrefixesFrom(pm);
    }
    if (defaultPrefix != null) {
        setDefaultPrefix(defaultPrefix);
    }
}
 
开发者ID:matthewhorridge,项目名称:owlapi-gwt,代码行数:21,代码来源:DefaultPrefixManager.java


示例6: ClassPool

import org.semanticweb.owlapi.model.PrefixManager; //导入依赖的package包/类
@Autowired
public ClassPool(OWLDataFactory factory, PrefixManager prefixManager) {
  super(MAX_REUSES);
  this.factory = factory;
  this.prefixManager = prefixManager;
}
 
开发者ID:VisualDataWeb,项目名称:OntoBench,代码行数:7,代码来源:ClassPool.java


示例7: PropertyPool

import org.semanticweb.owlapi.model.PrefixManager; //导入依赖的package包/类
@Autowired
public PropertyPool(OWLDataFactory factory, PrefixManager prefixManager) {
  this.factory = factory;
  this.prefixManager = prefixManager;
}
 
开发者ID:VisualDataWeb,项目名称:OntoBench,代码行数:6,代码来源:PropertyPool.java


示例8: prefixManager

import org.semanticweb.owlapi.model.PrefixManager; //导入依赖的package包/类
@Bean
@Scope(value = WebApplicationContext.SCOPE_REQUEST, proxyMode = ScopedProxyMode.INTERFACES)
public PrefixManager prefixManager(RequestInformation requestInformation) {
  return new DefaultPrefixManager(null, null, requestInformation.getOntologyIri());
}
 
开发者ID:VisualDataWeb,项目名称:OntoBench,代码行数:6,代码来源:OwlApiConfig.java


示例9: getProtegePrefixmanager

import org.semanticweb.owlapi.model.PrefixManager; //导入依赖的package包/类
/**
 * @return the protegePrefixmanager
 */
public PrefixManager getProtegePrefixmanager() {
	return protegePrefixmanager;
}
 
开发者ID:md-k-sarker,项目名称:OWLAx,代码行数:7,代码来源:BasicGraphEditor.java


示例10: setProtegePrefixmanager

import org.semanticweb.owlapi.model.PrefixManager; //导入依赖的package包/类
/**
 * @param protegePrefixmanager the protegePrefixmanager to set
 */
public void setProtegePrefixmanager(PrefixManager protegePrefixmanager) {
	this.protegePrefixmanager = protegePrefixmanager;
}
 
开发者ID:md-k-sarker,项目名称:OWLAx,代码行数:7,代码来源:BasicGraphEditor.java


示例11: main

import org.semanticweb.owlapi.model.PrefixManager; //导入依赖的package包/类
public static void main(String[] args) throws OWLOntologyCreationException {
	OWLOntologyManager man = OWLManager.createOWLOntologyManager();
	OWLDataFactory dataFactory = man.getOWLDataFactory();

	// Load your ontology.
	OWLOntology ont = man.loadOntologyFromOntologyDocument(new File(
			"c:/ontologies/ontology.owl"));

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

	// Create your desired query class expression. In this example we
	// will query ObjectIntersectionOf(A ObjectSomeValuesFrom(R B)).
	PrefixManager pm = new DefaultPrefixManager("http://example.org/");
	OWLClass A = dataFactory.getOWLClass(":A", pm);
	OWLObjectProperty R = dataFactory.getOWLObjectProperty(":R", pm);
	OWLClass B = dataFactory.getOWLClass(":B", pm);
	OWLClassExpression query = dataFactory.getOWLObjectIntersectionOf(A,
			dataFactory.getOWLObjectSomeValuesFrom(R, B));

	// Create a fresh name for the query.
	OWLClass newName = dataFactory.getOWLClass(IRI.create("temp001"));
	// Make the query equivalent to the fresh class
	OWLAxiom definition = dataFactory.getOWLEquivalentClassesAxiom(newName,
			query);
	man.addAxiom(ont, definition);

	// Remember to either flush the reasoner after the ontology change
	// or create the reasoner in non-buffering mode. Note that querying
	// a reasoner after an ontology change triggers re-classification of
	// the whole ontology which might be costly. Therefore, if you plan
	// to query for multiple complex class expressions, it will be more
	// efficient to add the corresponding definitions to the ontology at
	// once before asking any queries to the reasoner.
	reasoner.flush();

	// You can now retrieve subclasses, superclasses, and instances of
	// the query class by using its new name instead.
	reasoner.getSubClasses(newName, true);
	reasoner.getSuperClasses(newName, true);
	reasoner.getInstances(newName, false);

	// After you are done with the query, you should remove the definition
	man.removeAxiom(ont, definition);

	// You can now add new definitions for new queries in the same way

	// After you are done with all queries, do not forget to free the
	// resources occupied by the reasoner
	reasoner.dispose();
}
 
开发者ID:liveontologies,项目名称:elk-reasoner,代码行数:53,代码来源:QueryingUnnamedClassExpressions.java


示例12: testNoChanges

import org.semanticweb.owlapi.model.PrefixManager; //导入依赖的package包/类
/**
 * Testing correctness of the reasoner with respect to ontology changes
 * 
 */
@Test
public void testNoChanges() 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 {

		// statistics about the root ontology
		assertEquals(root.getAxiomCount(), 3);
		// all three ontologies should be in the closure
		assertEquals(root.getImportsClosure().size(), 3);
		// all axioms from three ontologies should be in the closure
		assertEquals(getAxioms(root).size(), 6);

		// reasoner queries -- all subclasses are there
		assertTrue(reasoner.getSuperClasses(mainX, true).containsEntity(
				mainY));
		assertTrue(reasoner.getSuperClasses(mainX, true).containsEntity(
				extA));
		assertTrue(reasoner.getSuperClasses(mainY, true).containsEntity(
				extB));
		assertTrue(reasoner.getSuperClasses(extA, true)
				.containsEntity(extB));
		assertTrue(reasoner.getSuperClasses(extB, true)
				.containsEntity(extC));
		
	} finally {
		reasoner.dispose();
	}

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


示例13: testRemovingXY

import org.semanticweb.owlapi.model.PrefixManager; //导入依赖的package包/类
/**
 * Testing correctness of the reasoner with respect to ontology changes
 * 
 * removing an axiom ":X is-a :Y"
 */
@Test
public void testRemovingXY() 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 an axiom ":X is-a :Y"
		// ************************************
		OWLAxiom axiom = dataFactory.getOWLSubClassOfAxiom(mainX, mainY);
		man.removeAxiom(root, axiom);
		reasoner.flush();

		// the root ontology contains one fewer axioms
		assertEquals(root.getAxiomCount(), 2);
		// the number of ontologies in the import closure does not change
		assertEquals(root.getImportsClosure().size(), 3);
		// the total number of axioms reduces
		assertEquals(getAxioms(root).size(), 5);

		// reasoner queries -- first subsumption is gone
		assertFalse(reasoner.getSuperClasses(mainX, true).containsEntity(
				mainY));
		assertTrue(reasoner.getSuperClasses(mainX, true).containsEntity(
				extA));
		assertTrue(reasoner.getSuperClasses(mainY, true).containsEntity(
				extB));
		assertTrue(reasoner.getSuperClasses(extA, true)
				.containsEntity(extB));
		assertTrue(reasoner.getSuperClasses(extB, true)
				.containsEntity(extC));

	} finally {
		reasoner.dispose();
	}

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


示例14: testRemovingAB

import org.semanticweb.owlapi.model.PrefixManager; //导入依赖的package包/类
/**
 * Testing correctness of the reasoner with respect to ontology changes
 * <p>
 * trying to remove "A:A is-a B:B"
 * <p>
 * Because the removed axiom belongs to the imported ontology and
 * not main ontology, the remove does not make any effect. So, we
 * should end up with the ontology we have started with.
 * <p>
 * This test is ignored, because as of OWL API 4.1.3 the removal
 * of the axiom is broadcasted even though the axiom is not removed.
 */
@Test
public void testRemovingAB() 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 {

		// ************************************
		// ** trying to remove "A:A is-a B:B"
		// ************************************
		OWLSubClassOfAxiom axiom = dataFactory.getOWLSubClassOfAxiom(extA, extB);
		man.removeAxiom(root, axiom);
		reasoner.flush();

		// Because the removed axiom belongs to the imported ontology and
		// not main ontology, the remove does not make any effect. So, we
		// should end up with the ontology we have started with

		assertEquals(root.getAxiomCount(), 3);
		// all three ontologies should be in the closure
		assertEquals(root.getImportsClosure().size(), 3);
		// all axioms from three ontologies should be in the closure
		assertEquals(getAxioms(root).size(), 6);

		// reasoner queries -- all subsumptions are there
		assertTrue(reasoner.getSuperClasses(mainX, true).containsEntity(
				mainY));
		assertTrue(reasoner.getSuperClasses(mainX, true).containsEntity(
				extA));
		assertTrue(reasoner.getSuperClasses(mainY, true).containsEntity(
				extB));
		assertTrue(reasoner.getSuperClasses(extA, true)
				.containsEntity(extB));
		assertTrue(reasoner.getSuperClasses(extB, true)
				.containsEntity(extC));

	} finally {
		reasoner.dispose();
	}

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


示例15: testRemovingImpA

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


示例16: testChangesToOtherOntologies

import org.semanticweb.owlapi.model.PrefixManager; //导入依赖的package包/类
/**
 * Testing correctness of the reasoner when changes are made to other, imported or not, ontologies
 * 
 */
@Test
public void testChangesToOtherOntologies() 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 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");
	// the imported ontologies must be loaded
	OWLOntology ontoA = man.getOntology(IRI.create("http://www.example.com/A"));
	OWLOntology ontoB = man.getOntology(IRI.create("http://www.example.com/B"));

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

	try {
		
		assertTrue(reasoner.getSuperClasses(extA, false).containsEntity(
				extC));
		assertTrue(reasoner.getSuperClasses(mainY, false).containsEntity(
				extC));
		
		// ************************************
		// ** removing an axiom "A:A is-a B:B" from impA
		// ************************************
		OWLAxiom axiom = dataFactory.getOWLSubClassOfAxiom(extA, extB);
		man.removeAxiom(ontoA, axiom);
		reasoner.flush();
		
		assertFalse(reasoner.getSuperClasses(extA, false).containsEntity(
				extC));
		// put it back
		man.addAxiom(ontoA, axiom);
		reasoner.flush();
		
		assertTrue(reasoner.getSuperClasses(extA, false).containsEntity(
				extC));

		// ************************************
		// ** removing an axiom "B:B is-a B:C" from impB
		// ************************************
		axiom = dataFactory.getOWLSubClassOfAxiom(extB, extC);
		man.removeAxiom(ontoB, axiom);
		reasoner.flush();
		
		assertFalse(reasoner.getSuperClasses(mainY, false).containsEntity(
				extC));

	}
	finally {
		reasoner.dispose();
	}
}
 
开发者ID:liveontologies,项目名称:elk-reasoner,代码行数:71,代码来源:ElkReasonerTest.java


示例17: loadOntology

import org.semanticweb.owlapi.model.PrefixManager; //导入依赖的package包/类
/**
 * Load the root ontology and all imports and apply normalization.
 */
private void loadOntology() {
	clearState();

	axioms = new OWLAxioms();

	Collection<OWLOntology> importClosure = rootOntology.getImportsClosure();
	if(configuration.getDomainIndividuals() == null) {
		configuration.setDomainIndividuals(rootOntology.getIndividualsInSignature(Imports.INCLUDED));
	}

	normalization = new OWLNormalization(rootOntology.getOWLOntologyManager().getOWLDataFactory(), axioms, 0, configuration.getDomainIndividuals());

	for (OWLOntology ontology : importClosure) {
		normalization.processOntology(ontology);
	}

	axioms.m_namedIndividuals.clear();
	axioms.m_namedIndividuals.addAll(configuration.getDomainIndividuals());

	try {
		tmpFile = File.createTempFile("wolpertinger-base-program", ".lp");
		tmpFile.deleteOnExit();
		output = new PrintWriter(tmpFile);
		naiveTranslation = new NaiveTranslation(configuration, output);
		naiveTranslation.translateOntology(axioms);
	} catch (IOException e) {
		e.printStackTrace();
	}

	OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
	OWLDataFactory factory = manager.getOWLDataFactory();
	PrefixManager pManager = new DefaultPrefixManager();
	OWLClassExpression thing = factory.getOWLClass("owl:Thing", pManager);

	for (OWLNamedIndividual individual : axioms.m_namedIndividuals) {
		OWLClassAssertionAxiom assertion = factory.getOWLClassAssertionAxiom(thing, individual);
		manager.addAxiom(rootOntology, assertion);
	}
	
	enumerator = new ClingoModelEnumerator(new String[] {tmpFile.getAbsolutePath()});
}
 
开发者ID:wolpertinger-reasoner,项目名称:Wolpertinger,代码行数:45,代码来源:Wolpertinger.java


示例18: createOWLPropertyAxiomsFromConceptVersionBI

import org.semanticweb.owlapi.model.PrefixManager; //导入依赖的package包/类
/**
 * Creates the owl property axioms from concept version bi.
 *
 * @param setOfAxioms the set of axioms
 * @param factory the factory
 * @param pm the pm
 * @param conceptVersionBI the concept version bi
 * @return the OWL object property
 * @throws Exception the exception
 */
private OWLObjectProperty createOWLPropertyAxiomsFromConceptVersionBI(
  Set<OWLAxiom> setOfAxioms, OWLDataFactory factory, PrefixManager pm,
  ConceptVersionBI conceptVersionBI) throws Exception {
  // Declaration
  OWLObjectProperty owlPropertyClass =
      factory.getOWLObjectProperty(
          ":" + getSnomedConceptID(conceptVersionBI), pm);
  OWLDeclarationAxiom declarationAxiom =
      factory.getOWLDeclarationAxiom(owlPropertyClass);
  setOfAxioms.add(declarationAxiom);
  // Create annotation type axiom
  // Fully specified description
  OWLAnnotation labelAnnotation =
      factory.getOWLAnnotation(factory.getRDFSLabel(), factory.getOWLLiteral(
          conceptVersionBI.getFullySpecifiedDescription().getText(),
          conceptVersionBI.getFullySpecifiedDescription().getLang()));
  OWLAxiom labelAnnotationAxiom =
      factory.getOWLAnnotationAssertionAxiom(owlPropertyClass.getIRI(),
          labelAnnotation);
  setOfAxioms.add(labelAnnotationAxiom);

  // Preferred name
  OWLAnnotation preferredTerm =
      factory.getOWLAnnotation(factory.getOWLAnnotationProperty(IRI
          .create(snomedEnUsPreferredAnnotation)), factory.getOWLLiteral(
          conceptVersionBI.getPreferredDescription().getText(),
          conceptVersionBI.getPreferredDescription().getLang()));
  OWLAxiom preferredTermAx =
      factory.getOWLAnnotationAssertionAxiom(owlPropertyClass.getIRI(),
          preferredTerm);
  setOfAxioms.add(preferredTermAx);

  // SubObjectPropertyOf
  // SubObjectPropertyOf(ObjectPropertyChain(
  // <http://snomed.info/id/363701004> <http://snomed.info/id/127489000> )
  // <http://snomed.info/id/363701004>)
  for (RelationshipVersionBI<?> rel : conceptVersionBI
      .getRelationshipsOutgoingActiveIsa()) {
    if (rel.isStated()) {
      String sctid =
          getSnomedConceptID(OTFUtility.getConceptVersion(rel
              .getDestinationNid()));
      // Skip the root of the attributes tree
      if (!sctid.equals(snomedConceptAttributeModelConcept)) {
        OWLObjectProperty parent =
            factory.getOWLObjectProperty(":" + sctid, pm);
        setOfAxioms.add(factory.getOWLSubObjectPropertyOfAxiom(
            owlPropertyClass, parent));
      }
    }
  }

  return owlPropertyClass;
}
 
开发者ID:Apelon-VA,项目名称:ISAAC,代码行数:65,代码来源:OWLExporter.java


示例19: copyPrefixesFrom

import org.semanticweb.owlapi.model.PrefixManager; //导入依赖的package包/类
@Override
public void copyPrefixesFrom(PrefixManager from) {
    copyPrefixesFrom(from.getPrefixName2PrefixMap());
}
 
开发者ID:matthewhorridge,项目名称:owlapi-gwt,代码行数:5,代码来源:DefaultPrefixManager.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java ExternalDocumentationProvider类代码示例发布时间:2022-05-22
下一篇:
Java TShortShortMap类代码示例发布时间: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