當前位置: 首頁>>代碼示例>>Java>>正文


Java OWLManager.createOWLOntologyManager方法代碼示例

本文整理匯總了Java中org.semanticweb.owlapi.apibinding.OWLManager.createOWLOntologyManager方法的典型用法代碼示例。如果您正苦於以下問題:Java OWLManager.createOWLOntologyManager方法的具體用法?Java OWLManager.createOWLOntologyManager怎麽用?Java OWLManager.createOWLOntologyManager使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.semanticweb.owlapi.apibinding.OWLManager的用法示例。


在下文中一共展示了OWLManager.createOWLOntologyManager方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: fromOntology

import org.semanticweb.owlapi.apibinding.OWLManager; //導入方法依賴的package包/類
/**
 * Returns a list of rules extracted from the given OWL-2 ontology document.
 * 
 * @param src an ontology document
 * @return a list of rules
 */
public static List<Rule> fromOntology(OWLOntologyDocumentSource src) {
	try {
		// use OWL-API to get a OWLOntology document from source
		OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
		manager.loadOntologyFromOntologyDocument(src);
		Set<OWLOntology> ontologies = manager.getOntologies();
		if (ontologies.isEmpty()) {
			return Collections.EMPTY_LIST;
		} else {
			// use first ontology from given source
			return fromOntology(ontologies.iterator().next());
		}
	} catch (OWLOntologyCreationException ex) {
		throw new IllegalArgumentException(
				"Loading ontology stream failed", ex);
	}
}
 
開發者ID:lszeremeta,項目名稱:neo4j-sparql-extension-yars,代碼行數:24,代碼來源:Rules.java

示例2: createSmokeFilter

import org.semanticweb.owlapi.apibinding.OWLManager; //導入方法依賴的package包/類
private static OWLEquivalentClassesAxiom createSmokeFilter() {
    OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
    OWLDataFactory factory = manager.getOWLDataFactory();
    OWLClass owlFilter = factory.getOWLClass(ONT_IRI + "SmokeFilter");
    //hasContext some (observedProperty some Somke)
    OWLObjectProperty hasContextProp = factory.getOWLObjectProperty(ONT_SSNIOT_IRI + "hasContext");
    OWLObjectProperty observedProperty = factory.getOWLObjectProperty(ONT_SSN_IRI + "observedProperty");
    OWLClass propCls = factory.getOWLClass(ONT_IRI + "Smoke");


    return factory.getOWLEquivalentClassesAxiom(
            owlFilter,
            factory.getOWLObjectSomeValuesFrom(
                    hasContextProp,
                    factory.getOWLObjectSomeValuesFrom(observedProperty, propCls)
            )
    );
}
 
開發者ID:IBCNServices,項目名稱:OBEP,代碼行數:19,代碼來源:Test.java

示例3: createTempFilter

import org.semanticweb.owlapi.apibinding.OWLManager; //導入方法依賴的package包/類
private static OWLEquivalentClassesAxiom createTempFilter() {
    OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
    OWLDataFactory factory = manager.getOWLDataFactory();

    OWLClass owlFilter = factory.getOWLClass(ONT_SSNIOT_IRI + "TemperatureFilter");

    OWLObjectProperty hasContextProp = factory.getOWLObjectProperty(ONT_SSNIOT_IRI + "hasContext");
    OWLObjectProperty observedProperty = factory.getOWLObjectProperty(ONT_SSN_IRI + "observedProperty");
    OWLClass propCls = factory.getOWLClass(ONT_SSNIOT_IRI + "Temperature");

    return factory.getOWLEquivalentClassesAxiom(
            owlFilter,
            factory.getOWLObjectSomeValuesFrom(
                    hasContextProp,
                    factory.getOWLObjectSomeValuesFrom(observedProperty, propCls)
            )
    );
}
 
開發者ID:IBCNServices,項目名稱:OBEP,代碼行數:19,代碼來源:OBEPQueryAbstracterTest.java

示例4: createSmokeFilter

import org.semanticweb.owlapi.apibinding.OWLManager; //導入方法依賴的package包/類
private static OWLEquivalentClassesAxiom createSmokeFilter() {
    OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
    OWLDataFactory factory = manager.getOWLDataFactory();

    OWLClass owlFilter = factory.getOWLClass(ONT_SSNIOT_IRI + "SmokeFilter");

    OWLObjectProperty hasContextProp = factory.getOWLObjectProperty(ONT_SSNIOT_IRI + "hasContext");
    OWLObjectProperty observedProperty = factory.getOWLObjectProperty(ONT_SSN_IRI + "observedProperty");
    OWLClass propCls = factory.getOWLClass(ONT_SSNIOT_IRI + "Smoke");

    return factory.getOWLEquivalentClassesAxiom(
            owlFilter,
            factory.getOWLObjectSomeValuesFrom(
                    hasContextProp,
                    factory.getOWLObjectSomeValuesFrom(observedProperty, propCls)
            )
    );
}
 
開發者ID:IBCNServices,項目名稱:OBEP,代碼行數:19,代碼來源:OBEPQueryAbstracterTest.java

示例5: getOntologyFromName

import org.semanticweb.owlapi.apibinding.OWLManager; //導入方法依賴的package包/類
/**
 * Open the OWL ontology (from the ontology resources of CartAGen) whose name
 * is passed as parameter.
 * @param name
 * @return
 * @throws OWLOntologyCreationException
 */
public static OWLOntology getOntologyFromName(String name)
    throws OWLOntologyCreationException {
  // create the URI from the name and the CartAGen ontologies folder path
  String uri = FOLDER_PATH + "/" + name + ".owl";
  InputStream stream = OwlUtil.class.getResourceAsStream(uri);
  File file = new File(stream.toString());
  String path = file.getAbsolutePath().substring(0,
      file.getAbsolutePath().lastIndexOf('\\'));
  path = path.replaceAll(new String("\\\\"), new String("//"));
  path = path + "//src/main//resources//ontologies//" + name + ".owl";
  // create the ontology from the URI using an OWLOntologyManager
  OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
  IRI physicalURI = IRI.create(new File(path));
  OWLOntology ontology = manager
      .loadOntologyFromOntologyDocument(physicalURI);

  return ontology;
}
 
開發者ID:IGNF,項目名稱:geoxygene,代碼行數:26,代碼來源:OwlUtil.java

示例6: getOntology

import org.semanticweb.owlapi.apibinding.OWLManager; //導入方法依賴的package包/類
/**
 * @param filename
 * @return
 */
private static OWLOntology getOntology(String filename) {
	File file = new File(filename);
	
	OWLOntologyManager m = OWLManager.createOWLOntologyManager();

	OWLOntology o;
	try {
		o = m.loadOntologyFromOntologyDocument(IRI.create(file.toURI()));
	} catch (OWLOntologyCreationException e) {
		fail("Cannot load ontology.");
		return null;
	}
	assertNotNull(o);

	return o;
}
 
開發者ID:AKSW,項目名稱:Resource2Vec,代碼行數:21,代碼來源:R2VManager.java

示例7: oneTimeSetUp

import org.semanticweb.owlapi.apibinding.OWLManager; //導入方法依賴的package包/類
@BeforeClass
public static void oneTimeSetUp()
{
	try {
		// Create our ontology manager in the usual way.
		manager = OWLManager.createOWLOntologyManager();

		OWLOntology ont = manager.loadOntologyFromOntologyDocument(IRI.create("http://www.w3.org/TR/owl-guide/wine.rdf"));

		// We need to create an instance of Reasoner.
		StructuralReasonerFactory factory = new StructuralReasonerFactory();
		reasoner = factory.createReasoner(ont);
		reasoner.precomputeInferences();
       }
       catch(UnsupportedOperationException exception) {
           System.out.println("Unsupported reasoner operation.");
       }
       catch(OWLOntologyCreationException e) {
           System.out.println("Could not load the wine ontology: " + e.getMessage());
       }
}
 
開發者ID:protegeproject,項目名稱:sparql-dl-api,代碼行數:22,代碼來源:QueryEngineStrictModeTest.java

示例8: QueryingWithNamedClasses

import org.semanticweb.owlapi.apibinding.OWLManager; //導入方法依賴的package包/類
public QueryingWithNamedClasses() throws OWLOntologyCreationException {
	// Traditional setup with the OWL-API
	manager = OWLManager.createOWLOntologyManager();
	IRI ontologyIri = IRI.create(EL_ONTOLOGY);
	ontology = manager.loadOntologyFromOntologyDocument(ontologyIri);

	System.out.println("Loaded ontology: " + ontology.getOntologyID());
	// But we use the Elk reasoner (add it to the classpath)
	reasonerFactory = new ElkReasonerFactory();
	reasoner = reasonerFactory.createReasoner(ontology);
	// IMPORTANT: Precompute the inferences beforehand, otherwise no results
	// will be returned
	reasoner.precomputeInferences(InferenceType.CLASS_HIERARCHY);
	// Ontologies are not easy to query with the full name of concept, so we
	// keep only the interesting bit ( = shortform)
	shortFormProvider = new SimpleShortFormProvider();

	Set<OWLOntology> importsClosure = ontology.getImportsClosure();
	mapper = new BidirectionalShortFormProviderAdapter(manager,
			importsClosure, shortFormProvider);
}
 
開發者ID:liveontologies,項目名稱:elk-reasoner,代碼行數:22,代碼來源:QueryingWithNamedClasses.java

示例9: main

import org.semanticweb.owlapi.apibinding.OWLManager; //導入方法依賴的package包/類
/**
 * @param args
 * @throws OWLOntologyCreationException
 */
public static void main(String[] args) throws OWLOntologyCreationException {
	OWLOntologyManager manager = OWLManager.createOWLOntologyManager();

	// Load your ontology.
	OWLOntology ont = manager.loadOntologyFromOntologyDocument(new File("/path/to/your/ontology/ontology.owl"));
	
	// Create an instance of ELK
	ElkProverFactory proverFactory = new ElkProverFactory();
	OWLProver prover = proverFactory.createReasoner(ont);		
	
	// Pre-compute classification
	prover.precomputeInferences(InferenceType.CLASS_HIERARCHY);

	// Pick the entailment for which we are interested in proofs
	OWLAxiom entailment = getEntailment();
	
	// Get the inferences used to prove the entailment 
	DynamicProof<? extends Inference<OWLAxiom>> proof = prover.getProof(entailment);
	
	// Now we can recursively request inferences and their premises. Print them to std.out in this example.
	unwindProof(proof, entailment);

	// Terminate the worker threads used by the reasoner.
	prover.dispose();
}
 
開發者ID:liveontologies,項目名稱:elk-reasoner,代碼行數:30,代碼來源:RetrievingProofsForEntailment.java

示例10: EBDAReasonerImplWithParallelProcessing

import org.semanticweb.owlapi.apibinding.OWLManager; //導入方法依賴的package包/類
/**
 * Initializes EBDA Reasoner based on the given EBDA Model.
 * 
 * @author Ario Santoso ([email protected] / [email protected])
 * @param ebdaModel
 */
public EBDAReasonerImplWithParallelProcessing(EBDAModelWithOptimizedXAttributesEncoding ebdaModel){

	this.xfact = XFactoryOnProm.getInstance();
	super.setExecutionLogListener(null);
	this.questFactory = new QuestOWLFactory();

	//Load the Event Ontology
		//System.out.println("\n--------------------------------------------------------");
		//System.out.println("DEBUGA: loading event ontology");
				
		OWLOntologyManager eventOntoMan = OWLManager.createOWLOntologyManager();
		URL eventOntoURL = this.getClass().getResource(XESEOConstants.eventOntoPath);

		//System.out.println("loading event ontology from: "+ this.eventOntoURL.getPath());
		
		try {
			eventOnto = eventOntoMan.loadOntologyFromOntologyDocument(eventOntoURL.openStream());
		} catch (OWLOntologyCreationException | IOException e) {
			e.printStackTrace();
		}

		//System.out.println("DEBUGA: END OF loading event ontology");
		//System.out.println("\n--------------------------------------------------------");
	//END OF Loading the Event Ontology

	this.questOWLDefaultConfig = this.createQuestOWLDefaultConfig(ebdaModel);
	this.disableLocalLogging();
}
 
開發者ID:onprom,項目名稱:onprom,代碼行數:35,代碼來源:EBDAReasonerImplWithParallelProcessing.java

示例11: StatisticalFunctionalityDetector

import org.semanticweb.owlapi.apibinding.OWLManager; //導入方法依賴的package包/類
public StatisticalFunctionalityDetector(File ontologyFile, double threshold) {
	try {
		OWLOntologyManager man = OWLManager.createOWLOntologyManager();
		ontology = man.loadOntologyFromOntologyDocument(ontologyFile);
		dataFactory = man.getOWLDataFactory();
	} catch (OWLOntologyCreationException e) {
		e.printStackTrace();
	}
	this.threshold = threshold;
}
 
開發者ID:dice-group,項目名稱:RDF2PT,代碼行數:11,代碼來源:StatisticalFunctionalityDetector.java

示例12: setUp

import org.semanticweb.owlapi.apibinding.OWLManager; //導入方法依賴的package包/類
@Before
public void setUp() throws Exception {
    graphDb = new GraphDatabaseFactory().newEmbeddedDatabase(new File(TEST_GRAPH_DB_PATH));
    OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
    OWLOntology ontology = manager.loadOntologyFromOntologyDocument(file.getFile());
    OWLDataFactory factory = manager.getOWLDataFactory();
    loader = new Owl2Neo4jLoader(graphDb, ontology, factory);
}
 
開發者ID:ISA-tools,項目名稱:FAIRsharing-Owl2Neo,代碼行數:9,代碼來源:Owl2Neo4jLoaderTest.java

示例13: owlOntology

import org.semanticweb.owlapi.apibinding.OWLManager; //導入方法依賴的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

示例14: OWLAPIContainer

import org.semanticweb.owlapi.apibinding.OWLManager; //導入方法依賴的package包/類
public OWLAPIContainer(URI filename) throws OWLOntologyCreationException {
	try {


		this.filename = filename;
		manager = OWLManager.createOWLOntologyManager();
		df = manager.getOWLDataFactory();
		ontology = manager.loadOntologyFromOntologyDocument(
				new FileDocumentSource(new File(filename.getPath())));
		System.out.println("Loaded");
		StructuralReasonerFactory reasonerFact = new StructuralReasonerFactory();	
		reasoner = reasonerFact.createReasoner(ontology);
		System.out.println("Reasoned");
		// Pour eviter un long calcul
		getAllLanguageInLabels();
		System.out.println("Found");
		

		//			try {
		//				System.out.println("Let's try Sesame");
		//				OwlTripleStore ts = Utilities.getOwlTripleStore(ontology, true);
		//				Repository sesame_repo = ts.getRepository();
		//				RepositoryConnection sesame_connect = sesame_repo.getConnection();
		//				System.out.println("I have: "+sesame_connect.size()+" statements");
		//			} catch (RepositoryException e) {
		//				System.err.println("Sesame Error!!!!");
		//				e.printStackTrace();
	}
	catch(RuntimeException e) {
		e.printStackTrace();
		throw e;
	}
}
 
開發者ID:lmazuel,項目名稱:onagui,代碼行數:34,代碼來源:OWLAPIContainer.java

示例15: setUp

import org.semanticweb.owlapi.apibinding.OWLManager; //導入方法依賴的package包/類
public void setUp() {
    abstracter = new AbstracterImpl();
    OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
    try {
        o = manager.loadOntology(IRI.create("http://IBCNServices.github.io/Accio-Ontology/SSNiot.owl#"));
        abstracter.setOntology(o);
    } catch (OWLOntologyCreationException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    testEngine = new OBEPTestEngine();
    abstracter.init(testEngine);

}
 
開發者ID:IBCNServices,項目名稱:OBEP,代碼行數:15,代碼來源:AbstracterTest.java


注:本文中的org.semanticweb.owlapi.apibinding.OWLManager.createOWLOntologyManager方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。