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

Java StructuralReasonerFactory类代码示例

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

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



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

示例1: oneTimeSetUp

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


示例2: init

import org.semanticweb.owlapi.reasoner.structural.StructuralReasonerFactory; //导入依赖的package包/类
/**
 * Initialises the Modules used by coniguration and prepares the Runner for
 * the SVoNt processing
 * 
 * @param p
 *            Property Object, containing the configuration of the system
 * @param ci
 *            CommitInformations
 */
public static void init(Properties p, CommitInfo ci) {
	state = "init";
	props = p;
	commitInfo = ci;
	
	OWLDiffConfiguration.setReasonerProvider(new StructuralReasonerFactory());

	String prefix = (!ci.getOwlUpdateFile().startsWith("/")) ? "/" : "";

	owlBaseFile = URI.create("file:" + prefix + ci.getOwlBaseFile())
			.normalize();
	owlUpdateFile = URI.create("file:" + prefix + ci.getOwlUpdateFile())
			.normalize();

	validator = getValidator(props.getProperty("validator", "Pellet"));
	diffExecutor = getDiffExecutor(props.getProperty("diff", "Base"));
	clWriter = getChangeLogWriter(props.getProperty("CLWriter", "OWLAPI"));

	log.info("Using Validator of type: " + props.getProperty("validator"));
	log.info("Using DiffExecuter of type: " + props.getProperty("diff"));
	log.info("Using Change Log Writer of type: "
			+ props.getProperty("CLWriter"));

}
 
开发者ID:ag-csw,项目名称:SVoNt,代码行数:34,代码来源:SVoNtRunner.java


示例3: OWLAPIContainer

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


示例4: OntologyHelper

import org.semanticweb.owlapi.reasoner.structural.StructuralReasonerFactory; //导入依赖的package包/类
/**
 * Construct a new ontology helper instance.
 * 
 * @param ontologyUri the URI giving the location of the ontology.
 * @param config the ontology configuration, containing the property URIs
 * for labels, synonyms, etc.
 * @throws OWLOntologyCreationException if the ontology cannot be read for
 * some reason - internal inconsistencies, etc.
 * @throws URISyntaxException if the URI cannot be parsed.
 */
public OntologyHelper(URI ontologyUri, OntologySettings config) throws OWLOntologyCreationException,
		URISyntaxException {
	this.config = config;

	if (!ontologyUri.isAbsolute()) {
		// Try to read as a file from the resource path
		LOGGER.debug("Ontology URI {} is not absolute - loading from classpath", ontologyUri);
		URL url = this.getClass().getClassLoader().getResource(ontologyUri.toString());
		if (url != null) {
			ontologyUri = url.toURI();
		}
	}
	this.ontologyUri = ontologyUri;
	LOGGER.info("Loading ontology from " + ontologyUri + "...");

	OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
	IRI iri = IRI.create(ontologyUri);
	this.ontology = manager.loadOntologyFromOntologyDocument(iri);
	// Use a buffering reasoner - not interested in ongoing changes
	this.reasoner = new StructuralReasonerFactory().createReasoner(ontology);
	// this.shortFormProvider = new SimpleShortFormProvider();
	this.owlNothingIRI = manager.getOWLDataFactory().getOWLNothing().getIRI();
	
	// Initialise the class map
	initialiseClassMap();
}
 
开发者ID:flaxsearch,项目名称:BioSolr,代码行数:37,代码来源:OntologyHelper.java


示例5: getReasoner

import org.semanticweb.owlapi.reasoner.structural.StructuralReasonerFactory; //导入依赖的package包/类
/**
 * Get the reasoner that should be used to access the ontology.
 * @return the reasoner.
 * @throws OntologyHelperException if the ontology is not available.
 */
public OWLReasoner getReasoner() throws OntologyHelperException {
	if (reasoner == null) {
		reasoner = new StructuralReasonerFactory().createReasoner(getOntology());
	}

	return reasoner;
}
 
开发者ID:flaxsearch,项目名称:BioSolr,代码行数:13,代码来源:OWLDataManager.java


示例6: Schema

import org.semanticweb.owlapi.reasoner.structural.StructuralReasonerFactory; //导入依赖的package包/类
private Schema(OWLOntology ontology) {
    this.ontology = ontology;
    reasoner = (new StructuralReasonerFactory()).createReasoner(ontology);
    loadProperties();
}
 
开发者ID:askplatypus,项目名称:platypus-kb-lucene,代码行数:6,代码来源:Schema.java


示例7: main

import org.semanticweb.owlapi.reasoner.structural.StructuralReasonerFactory; //导入依赖的package包/类
/**
 * @param args
 */
public static void main(String[] args) 
{
	try {
		// Create an ontology manager in the usual way.
		OWLOntologyManager manager = OWLManager.createOWLOntologyManager();

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

           // Create an instance of an OWL API reasoner (we use the OWL API built-in StructuralReasoner for the purpose of demonstration here)
           StructuralReasonerFactory factory = new StructuralReasonerFactory();
		OWLReasoner reasoner = factory.createReasoner(ont);
           // Optionally let the reasoner compute the most relevant inferences in advance
		reasoner.precomputeInferences(InferenceType.CLASS_ASSERTIONS,InferenceType.OBJECT_PROPERTY_ASSERTIONS);

		// Create an instance of the SPARQL-DL query engine
		engine = QueryEngine.create(manager, reasoner);
		
		processQuery(
               "PREFIX wine: <http://www.w3.org/TR/2003/PR-owl-guide-20031209/wine#>\n" +
			"SELECT * WHERE {\n" +
			    "SubClassOf(wine:PinotBlanc, ?x),\n" +
			    "SubClassOf(?x, wine:Wine)\n" +
			"}"
		);
		
		processQuery(
               "PREFIX wine: <http://www.w3.org/TR/2003/PR-owl-guide-20031209/wine#>\n" +
			"ASK {\n" +
			    "SubClassOf(wine:PinotBlanc, wine:Wine)\n" +
			"}"
		);
       }
       catch(UnsupportedOperationException exception) {
           System.out.println("Unsupported reasoner operation.");
       }
       catch(OWLOntologyCreationException e) {
           System.out.println("Could not load the ontology: " + e.getMessage());
       }
}
 
开发者ID:protegeproject,项目名称:sparql-dl-api,代码行数:44,代码来源:Example_XML_JSON.java


示例8: process

import org.semanticweb.owlapi.reasoner.structural.StructuralReasonerFactory; //导入依赖的package包/类
void process() throws Exception{
	target = testWrapper.getSourceOntology();
	log.info("Loading ontologies");
	loadImportedOntologies();
	mergedSources = mergeImportedOntologies();
	loadCuratorAddedTerms(mergedSources);
	//log.info("Saving ontology");
	//File f = new File("merged.owl");
	//testWrapper.getManager().saveOntology(mergedSources, IRI.create(f.toURI()));

	log.info("Initializing reasoner");

       OWLReasonerFactory rf = new StructuralReasonerFactory();
       preReasoner = rf.createReasoner(mergedSources);
	//preReasoner = elkFactory.createReasoner(mergedSources);
	log.info("Finished reasoner initialization");
       // Classify the ontology.
	try{
		preReasoner.precomputeInferences(InferenceType.CLASS_HIERARCHY);
		log.info("Finished precomputing class hierarchy");
		//target = manager.createOntology(IRI.create(targetIRI));
		log.info("Before copying taxonomy, target class count = " +target.getClassesInSignature().size());
		log.info("copying relevant taxonony to target ontology");
		initializeTaxonomy(target);
		log.info("After copying taxonomy, target class count = " +target.getClassesInSignature().size());
		log.info("copying misc support terms to target ontology");
		log.info("Before adding misc classes, target class count = " +target.getClassesInSignature().size());
		initializeMisc();
		log.info("After adding misc classes, target class count = " +target.getClassesInSignature().size());
		log.info("Before processing database, target class count = " +target.getClassesInSignature().size());
		processDatabase();
		log.info("After processing database, target class count = " +target.getClassesInSignature().size());

		//log.info("Saving ontology");
		//File f = new File("checkpoint.owl");
		//testWrapper.getManager().saveOntology(target, IRI.create(f.toURI()));
		if (true){
			//preReasoner.flush();
			log.info("disposing preReasoner");
			preReasoner.dispose();
			mergedSources = null;  // hopefully GC will notice this
			log.info("starting post reasoning on target");
			log.info("Creating postReasoner");
			postReasoner = elkFactory.createReasoner(target);
			log.info("Precomputing hierarchy");
			postReasoner.precomputeInferences(InferenceType.CLASS_HIERARCHY);

			// To generate an inferred ontology we use implementations of
			// inferred axiom generators
			List<InferredAxiomGenerator<? extends OWLAxiom>> gens = new ArrayList<InferredAxiomGenerator<? extends OWLAxiom>>();
			gens.add(new InferredSubClassAxiomGenerator());
			gens.add(new InferredEquivalentClassAxiomGenerator());
			gens.add(new InferredClassAssertionAxiomGenerator());

			InferredOntologyGenerator iog = new InferredOntologyGenerator(postReasoner,
					gens);
			iog.fillOntology(testWrapper.getDataFactory(),target);
			log.info("flushing reasoner");
			postReasoner.flush();

			saveOntology();
			generateHTML();
			log.info("Shutting down reasoner");
		}
	}
	catch(Exception e){
		log.error(e);
		e.printStackTrace();
	}
	finally{
		preReasoner.dispose();
		if (postReasoner != null){
			postReasoner.dispose();
		}
		else{
			log.info("No post reasoner found at shutdown");
		}
	}
}
 
开发者ID:pmidford,项目名称:owlbuilder,代码行数:80,代码来源:Owlbuilder.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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