当前位置: 首页>>代码示例>>Java>>正文


Java OWLOntology.getIndividualsInSignature方法代码示例

本文整理汇总了Java中org.semanticweb.owlapi.model.OWLOntology.getIndividualsInSignature方法的典型用法代码示例。如果您正苦于以下问题:Java OWLOntology.getIndividualsInSignature方法的具体用法?Java OWLOntology.getIndividualsInSignature怎么用?Java OWLOntology.getIndividualsInSignature使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.semanticweb.owlapi.model.OWLOntology的用法示例。


在下文中一共展示了OWLOntology.getIndividualsInSignature方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: minimizedTranslate

import org.semanticweb.owlapi.model.OWLOntology; //导入方法依赖的package包/类
/**
 * Translate the given {@link GafDocument} into an OWL representation of the LEGO model.
 * Additionally minimize the lego model and imports into one ontology module.
 * 
 * @param gaf
 * @return minimized lego ontology
 */
public OWLOntology minimizedTranslate(GafDocument gaf) {
	OWLOntology all = translate(gaf);
	final OWLOntologyManager m = all.getOWLOntologyManager();
	
	SyntacticLocalityModuleExtractor sme = new SyntacticLocalityModuleExtractor(m, all, ModuleType.BOT);
	Set<OWLEntity> sig = new HashSet<OWLEntity>(all.getIndividualsInSignature());
	Set<OWLAxiom> moduleAxioms = sme.extract(sig);
	
	try {
		OWLOntology module = m.createOntology(IRI.generateDocumentIRI());
		m.addAxioms(module, moduleAxioms);
		return module;
	} catch (OWLException e) {
		throw new RuntimeException("Could not create minimized lego model.", e);
	}
}
 
开发者ID:geneontology,项目名称:minerva,代码行数:24,代码来源:GafToLegoTranslator.java

示例2: create

import org.semanticweb.owlapi.model.OWLOntology; //导入方法依赖的package包/类
public static InferenceProvider create(OWLReasoner r, OWLOntology ont) {
	Map<OWLNamedIndividual, Set<OWLClass>> inferredTypes = new HashMap<>();
	boolean isConsistent = r.isConsistent();
	if (isConsistent) {
		Set<OWLNamedIndividual> individuals = ont.getIndividualsInSignature();
		for (OWLNamedIndividual individual : individuals) {
			Set<OWLClass> inferred = new HashSet<>();
			Set<OWLClass> flattened = r.getTypes(individual, true).getFlattened();
			for (OWLClass cls : flattened) {
				if (cls.isBuiltIn() == false) {
					inferred.add(cls);
				}
			}
			inferredTypes.put(individual, inferred);
		}
	}
	return new MapInferenceProvider(isConsistent, inferredTypes);
}
 
开发者ID:geneontology,项目名称:minerva,代码行数:19,代码来源:MapInferenceProvider.java

示例3: removeDangningAnnotations

import org.semanticweb.owlapi.model.OWLOntology; //导入方法依赖的package包/类
@CLIMethod("--remove-dangling-annotations")
public void removeDangningAnnotations(Opts opts) throws Exception {
	OWLOntology ont = g.getSourceOntology();
	int n = 0;
	Set<OWLAxiom> rmAxioms = new HashSet<OWLAxiom>();
	for (OWLNamedIndividual i : ont.getIndividualsInSignature()) {
		for (OWLClassAssertionAxiom ca : ont.getClassAssertionAxioms(i)) {
			OWLClassExpression cx = ca.getClassExpression();
			if (cx instanceof OWLClass) {
				OWLClass c = (OWLClass) cx;
				String label = g.getLabel(c);
				if (label == null)
					rmAxioms.add(ca);
				else
					n++;
			}
		}
	}
	LOG.info("Removing " + rmAxioms.size() + " axioms");
	ont.getOWLOntologyManager().removeAxioms(ont, rmAxioms);
	LOG.info("Remaining: " + n + " axioms");
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:23,代码来源:Sim2CommandRunner.java

示例4: randomizeClassAssertions

import org.semanticweb.owlapi.model.OWLOntology; //导入方法依赖的package包/类
public static void randomizeClassAssertions(OWLOntology ont, int num) {
	Set<OWLClassAssertionAxiom> caas = new HashSet<OWLClassAssertionAxiom>();
	Set<OWLClassAssertionAxiom> caasNew = new HashSet<OWLClassAssertionAxiom>();
		Set<OWLNamedIndividual> inds = ont.getIndividualsInSignature(Imports.INCLUDED);
	OWLNamedIndividual[] indArr = (OWLNamedIndividual[]) inds.toArray();
	for (OWLNamedIndividual ind : inds) {
		caas.addAll( ont.getClassAssertionAxioms(ind) );
	}
	for (OWLClassAssertionAxiom caa : caas) {
		OWLIndividual randomIndividual = null;
		caasNew.add(ont.getOWLOntologyManager().getOWLDataFactory().getOWLClassAssertionAxiom(caa.getClassExpression(), 
				randomIndividual));
	}
	ont.getOWLOntologyManager().removeAxioms(ont, caas);
	ont.getOWLOntologyManager().addAxioms(ont, caasNew);
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:17,代码来源:ABoxUtils.java

示例5: getInstancesFromClosure

import org.semanticweb.owlapi.model.OWLOntology; //导入方法依赖的package包/类
/**
 * Find all edges of the form [i INST c] in the graph closure.
 * (this includes both direct assertions, plus assertions to objects
 *  that link to c via a chain of SubClassOf assertions)
 * <p> 
 * the semantics are the same as inferred ClassAssertion axioms
 * 
 * @param c owlClass
 * @return all individuals classified here via basic graph traversal
 */
public Set<OWLIndividual> getInstancesFromClosure(OWLClass c) {
	Set<OWLIndividual> ins = new HashSet<OWLIndividual>();
	for (OWLOntology o : getAllOntologies()) {
		// iterate through all individuals; sequential scan may be slow for
		// large knowledge bases
		for (OWLIndividual in : o.getIndividualsInSignature()) {
			for (OWLGraphEdge e : getEdgesBetween(in, c)) {
				List<OWLQuantifiedProperty> qps = e.getQuantifiedPropertyList();
				// check for edges of the form < i INSTANCE_OF c >
				// we exclude relation chaims, e.g. <i [INSTANCE_OF PART_OF-some] c>
				if (qps.size() == 1 && qps.get(0).isInstanceOf()) {
					ins.add(in);
					break;
				}
			}
		}
	}
	return ins;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:30,代码来源:OWLGraphWrapperEdges.java

示例6: create

import org.semanticweb.owlapi.model.OWLOntology; //导入方法依赖的package包/类
@Override
public InferenceProvider create(ModelContainer model) throws OWLOntologyCreationException, InterruptedException {
	OWLOntology ont = model.getAboxOntology();
	final OWLOntologyManager m = ont.getOWLOntologyManager();
	OWLOntology module = null;
	OWLReasoner reasoner = null;
	try {
		InferenceProvider provider;
		synchronized (ont) {
			concurrentLock.acquire();
			try {
				if (useSLME) {
					LOG.info("Creating for module: "+model.getModelId());
					ModuleType mtype = ModuleType.BOT;
					SyntacticLocalityModuleExtractor sme = new SyntacticLocalityModuleExtractor(m, ont, mtype);
					Set<OWLEntity> seeds = new HashSet<OWLEntity>(ont.getIndividualsInSignature());
					module = ont = sme.extractAsOntology(seeds, IRI.generateDocumentIRI());
					LOG.info("Done creating module: "+model.getModelId());
				}
				reasoner = rf.createReasoner(ont);
				provider = MapInferenceProvider.create(reasoner, ont);
			}
			finally {
				concurrentLock.release();
			}
		}
		return provider;
	}
	finally {
		if (reasoner != null) {
			reasoner.dispose();
		}
		if (module != null) {
			m.removeOntology(module);
		}
	}
	
}
 
开发者ID:geneontology,项目名称:minerva,代码行数:39,代码来源:InferenceProviderCreatorImpl.java

示例7: generateAssociations

import org.semanticweb.owlapi.model.OWLOntology; //导入方法依赖的package包/类
public Set<GeneAnnotation> generateAssociations(OWLOntology ont) {
	Set<GeneAnnotation> assocs = new HashSet<GeneAnnotation>();
	for (OWLNamedIndividual i : ont.getIndividualsInSignature(Imports.INCLUDED)) {
		assocs.addAll(generateAssociations(i, ont));
	}
	return assocs;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:8,代码来源:SimpleABoxToGAF.java

示例8: getInstanceChainsFromClosure

import org.semanticweb.owlapi.model.OWLOntology; //导入方法依赖的package包/类
/**
 * Finds all edges between an instance i and he given class c.
 * <p>
 * this includes inferred class assertions, as well as chains such as
 * <p>
 * i has_part j, j inst_of k, k part_of some c
 * 
 * @param c owlClass
 * @return all edges in closure between an instance and owlClass
 */
public Set<OWLGraphEdge> getInstanceChainsFromClosure(OWLClass c) {
	Set<OWLGraphEdge> edges = new OWLGraphEdgeSet();
	for (OWLOntology o : getAllOntologies()) {
		// iterate through all individuals; sequential scan may be slow for
		// large knowledge bases
		for (OWLIndividual in : o.getIndividualsInSignature()) {
		    edges.addAll(getEdgesBetween(in, c));
		}
	}
	return edges;
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:22,代码来源:OWLGraphWrapperEdges.java

示例9: KnowledgeBase

import org.semanticweb.owlapi.model.OWLOntology; //导入方法依赖的package包/类
public KnowledgeBase(String ontoFile) throws OWLOntologyCreationException{
	
	
	OWLDataFactoryImpl owlDataFactoryImpl = new OWLDataFactoryImpl();
	OWLOntologyManager manager =OWLManager.createOWLOntologyManager();
	
	OWLOntology onto=manager.loadOntologyFromOntologyDocument(new File(ontoFile));
	OWLReasonerFactory f= new JFactFactory();
	reasoner = f.createNonBufferingReasoner(onto);

	//Transaction tr= session.beginTransaction();

	//	try{


	classesInSignature = onto.getClassesInSignature();
	 instances = onto.getIndividualsInSignature();
	propertyInSignature = onto.getObjectPropertiesInSignature();
}
 
开发者ID:Giuseppe-Rizzo,项目名称:owl2neo4j,代码行数:20,代码来源:KnowledgeBase.java

示例10: validateBeforeSave

import org.semanticweb.owlapi.model.OWLOntology; //导入方法依赖的package包/类
public List<String> validateBeforeSave(ModelContainer model) throws OWLOntologyCreationException {
	// get model
	List<String> errors = new ArrayList<String>(3);
	// check that model has required meta data
	OWLOntology aboxOntology = model.getAboxOntology();
	boolean hasTitle = false;
	boolean hasContributor = false;
	
	// get ontology annotations
	Set<OWLAnnotation> annotations = aboxOntology.getAnnotations();
	for (OWLAnnotation annotation : annotations) {
		OWLAnnotationProperty p = annotation.getProperty();
		AnnotationShorthand legoType = AnnotationShorthand.getShorthand(p.getIRI());
		if (legoType != null) {
			// check for title
			if (AnnotationShorthand.title.equals(legoType)) {
				hasTitle = true;
			}
			// check for contributor
			else if (AnnotationShorthand.contributor.equals(legoType)) {
				hasContributor = true;
			}
		}
	}

	if (hasTitle == false) {
		errors.add("The model has no title. All models must have a human readable title.");
	}
	if (hasContributor == false) {
		errors.add("The model has no contributors. All models must have an association with their contributors.");
	}
	
	// require at least one declared instance
	Set<OWLNamedIndividual> individuals = aboxOntology.getIndividualsInSignature();
	if (individuals.isEmpty()) {
		errors.add("The model has no individuals. Empty models should not be saved.");
	}
	
	// avoid returning empty list
	if (errors.isEmpty()) {
		errors = null;
	}
	return errors;
}
 
开发者ID:geneontology,项目名称:minerva,代码行数:45,代码来源:BeforeSaveModelValidator.java

示例11: getAxioms

import org.semanticweb.owlapi.model.OWLOntology; //导入方法依赖的package包/类
/**
 * Get axioms from ontology depending on requirements
 * @param ontology
 * @param considerImportsClosure
 * @param considerEntityAnnotations
 * @param ignoreAssertions
 * @return
 */
private static Set<OWLAxiom> getAxioms(
		OWLOntology ontology,
		boolean considerImportsClosure, 
		boolean considerEntityAnnotations, 
		boolean ignoreAssertions){

	Set<OWLAxiom> axioms = new HashSet<OWLAxiom>(); 
			
	
	//axioms.addAll(ontology.getGeneralClassAxioms());
	axioms.addAll(ontology.getTBoxAxioms(considerImportsClosure));
	axioms.addAll(ontology.getRBoxAxioms(considerImportsClosure));
	if (!ignoreAssertions){
		axioms.addAll(ontology.getABoxAxioms(considerImportsClosure));
	}
	
	if (considerEntityAnnotations){
		
		for (OWLClass cls : ontology.getClassesInSignature(considerImportsClosure)){
			axioms.addAll(cls.getAnnotationAssertionAxioms(ontology));
			//axioms.addAll(ontology.getDeclarationAxioms(cls));
			
		}
		
		for (OWLObjectProperty oprop : ontology.getObjectPropertiesInSignature(considerImportsClosure)){
			axioms.addAll(oprop.getAnnotationAssertionAxioms(ontology));
			//axioms.addAll(ontology.getDeclarationAxioms(oprop));
		}
		
		for (OWLDataProperty dprop : ontology.getDataPropertiesInSignature(considerImportsClosure)){
			axioms.addAll(dprop.getAnnotationAssertionAxioms(ontology));
			//axioms.addAll(ontology.getDeclarationAxioms(dprop));
		}
		
		for (OWLAnnotationProperty aprop : ontology.getAnnotationPropertiesInSignature()){
			axioms.addAll(aprop.getAnnotationAssertionAxioms(ontology));
			//axioms.addAll(ontology.getDeclarationAxioms(aprop));
		}
		
		if (!ignoreAssertions){
			for (OWLNamedIndividual indiv : ontology.getIndividualsInSignature(considerImportsClosure)){
				axioms.addAll(indiv.getAnnotationAssertionAxioms(ontology));
				//axioms.addAll(ontology.getDeclarationAxioms(indiv));
			}
			
			//TODO In pizza.owl gives an error
			//for (OWLAnonymousIndividual aindiv : ontology.getAnonymousIndividuals()){
			//	axioms.addAll(ontology.getAnnotationAssertionAxioms(aindiv));
			//}
			
			
			
		}
	}	
	
	/*for (OWLAxiom ax : ontology.getAxioms()){
		if (!axioms.contains(ax)){
			
			System.out.println(ax);
			
		}
	}*/
		
	
	return axioms;
	
}
 
开发者ID:ernestojimenezruiz,项目名称:logmap-matcher,代码行数:76,代码来源:OntologyModuleExtractor.java

示例12: experimentalLoadComplexAnnotationSolr

import org.semanticweb.owlapi.model.OWLOntology; //导入方法依赖的package包/类
/**
 * Experimental method for trying out the loading of complex_annotation doc type
 * 
 * @param opts
 * @throws Exception
 */
@CLIMethod("--solr-load-complex-annotations")
public void experimentalLoadComplexAnnotationSolr(Opts opts) throws Exception {

	// Check to see if the global url has been set.
	String url = sortOutSolrURL(globalSolrURL);				

	// Only proceed if our environment was well-defined.
	if( legoCatalogs == null || legoFiles == null || legoCatalogs.isEmpty() || legoFiles.isEmpty() ){
		LOG.warn("Lego environment not well defined--skipping.");
	}else{

		// Ready the environment for every pass.
		ParserWrapper pw = new ParserWrapper();
		// Add all of the catalogs.
		for( File legoCatalog : legoCatalogs ){
			pw.addIRIMapper(new CatalogXmlIRIMapper(legoCatalog));				
		}
		OWLOntologyManager manager = pw.getManager();
		OWLReasonerFactory reasonerFactory = new ElkReasonerFactory();
			
		// Actual loading--iterate over our list and load individually.
		for( File legoFile : legoFiles ){
			String fname = legoFile.getName();
			OWLReasoner currentReasoner = null;
			OWLOntology ontology = null;

			// TODO: Temp cover for missing group labels and IDs.
			//String agID = legoFile.getCanonicalPath();
			String agLabel = StringUtils.removeEnd(fname, ".owl");
			String agID = new String(agLabel);

			try {
				ontology = pw.parseOWL(IRI.create(legoFile));
				currentReasoner = reasonerFactory.createReasoner(ontology);
					
				// Some sanity checks--some of the genereated ones are problematic.
				boolean consistent = currentReasoner.isConsistent();
				if( consistent == false ){
					LOG.info("Skip since inconsistent: " + fname);
					continue;
				}
				Set<OWLClass> unsatisfiable = currentReasoner.getUnsatisfiableClasses().getEntitiesMinusBottom();
				
				// TODO - make configurable to allow fail fast
				if (unsatisfiable.isEmpty() == false) {
					LOG.info("Skip since unsatisfiable: " + fname);
					continue;
				}
				
				Set<OWLNamedIndividual> individuals = ontology.getIndividualsInSignature();
				Set<OWLAnnotation> modelAnnotations = ontology.getAnnotations();
				OWLGraphWrapper currentGraph = new OWLGraphWrapper(ontology);						
				try {
					LOG.info("Trying complex annotation load of: " + fname);
					ComplexAnnotationSolrDocumentLoader loader =
							new ComplexAnnotationSolrDocumentLoader(url, currentGraph, currentReasoner, individuals, modelAnnotations, agID, agLabel, fname);
					loader.load();
				} catch (SolrServerException e) {
					LOG.info("Complex annotation load of " + fname + " at " + url + " failed!");
					e.printStackTrace();
					System.exit(1);
				}
			} finally {
				// Cleanup reasoner and ontology.
				if (currentReasoner != null) {
					currentReasoner.dispose();
				}
				if (ontology != null) {
					manager.removeOntology(ontology);
				}
			}
		}
	}
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:81,代码来源:SolrCommandRunner.java

示例13: loadComplexAnnotationSolr

import org.semanticweb.owlapi.model.OWLOntology; //导入方法依赖的package包/类
/**
 * Experimental method for trying out the loading of complex_annotation doc type.
 * Works with --read-ca-list <file>.
 * 
 * @param opts
 * @throws Exception
 */
@CLIMethod("--solr-load-complex-exp")
public void loadComplexAnnotationSolr(Opts opts) throws Exception {

	// Check to see if the global url has been set.
	String url = sortOutSolrURL(globalSolrURL);				

	// Only proceed if our environment was well-defined.
	if( caFiles == null || caFiles.isEmpty() ){
		LOG.warn("LEGO environment not well defined--will skip loading LEGO/CA.");
	}else{

		// NOTE: These two lines are remainders from old code, and I'm not sure of their place in this world of ours.
		// I wish there was an arcitecture diagram somehwere...
		OWLOntologyManager manager = pw.getManager();
		OWLReasonerFactory reasonerFactory = new ElkReasonerFactory();
			
		// Actual loading--iterate over our list and load individually.
		for( String fname : caFiles ){
			OWLReasoner currentReasoner = null;
			OWLOntology ontology = null;

			// TODO: Temp cover for missing group labels and IDs.
			//String agID = legoFile.getCanonicalPath();
			String pretmp = StringUtils.removeEnd(fname, ".owl");
			String[] bits = StringUtils.split(pretmp, "/");
			String agID = bits[bits.length -1];
			String agLabel = new String(StringUtils.replaceOnce(agID, ":", "_"));
			
			try {
				ontology = pw.parseOWL(IRI.create(fname));
				currentReasoner = reasonerFactory.createReasoner(ontology);
					
				// Some sanity checks--some of the genereated ones are problematic.
				boolean consistent = currentReasoner.isConsistent();
				if( consistent == false ){
					LOG.info("Skip since inconsistent: " + fname);
					continue;
				}
				Set<OWLClass> unsatisfiable = currentReasoner.getUnsatisfiableClasses().getEntitiesMinusBottom();
				if (unsatisfiable.isEmpty() == false) {
					LOG.info("Skip since unsatisfiable: " + fname);
					continue;
				}
				
				Set<OWLNamedIndividual> individuals = ontology.getIndividualsInSignature();
				Set<OWLAnnotation> modelAnnotations = ontology.getAnnotations();
				OWLGraphWrapper currentGraph = new OWLGraphWrapper(ontology);						
				try {
					LOG.info("Trying complex annotation load of: " + fname);
					ComplexAnnotationSolrDocumentLoader loader =
							new ComplexAnnotationSolrDocumentLoader(url, currentGraph, currentReasoner, individuals, modelAnnotations, agID, agLabel, fname);
					loader.load();
				} catch (SolrServerException e) {
					LOG.info("Complex annotation load of " + fname + " at " + url + " failed!");
					e.printStackTrace();
					System.exit(1);
				}
			} finally {
				// Cleanup reasoner and ontology.
				if (currentReasoner != null) {
					currentReasoner.dispose();
				}
				if (ontology != null) {
					manager.removeOntology(ontology);
				}
			}
		}
	}
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:77,代码来源:SolrCommandRunner.java

示例14: assertAboxInferences

import org.semanticweb.owlapi.model.OWLOntology; //导入方法依赖的package包/类
@CLIMethod("--assert-abox-inferences")
public void assertAboxInferences(Opts opts) throws Exception {
    opts.info("", "Finds all inferred OPEs and ClassAssertions and asserts them. Does not handle DPEs. Resulting ontology can be used for sparql queries");
    boolean isNew = false;
    while (opts.hasOpts()) {
        if (opts.nextEq("-n|--new")) {
            isNew = true;
        }
        else
            break;
    }
    Set<OWLAxiom> newAxioms = new HashSet<OWLAxiom>();
    OWLOntology ont = g.getSourceOntology();

    // TODO : move this to a utility class
    OWLOntologyManager mgr = ont.getOWLOntologyManager();
    OWLDataFactory df = mgr.getOWLDataFactory();
    LOG.info("Initial axioms:"+ont.getAxioms(true).size());
    for (OWLNamedIndividual ind : ont.getIndividualsInSignature(Imports.INCLUDED)) {
        //LOG.info("Checking: "+ind);
        for (OWLObjectProperty p : ont.getObjectPropertiesInSignature(Imports.INCLUDED)) {
            NodeSet<OWLNamedIndividual> vs = reasoner.getObjectPropertyValues(ind, p);
            for (OWLNamedIndividual v : vs.getFlattened()) {
                //LOG.info("NEW: "+ind+" -> "+p+" -> "+v);
                newAxioms.add(df.getOWLObjectPropertyAssertionAxiom(p, ind, v));
            }
        }
        for (OWLClass c : reasoner.getTypes(ind, false).getFlattened()) {
            newAxioms.add(df.getOWLClassAssertionAxiom(c, ind));
            //LOG.info("NEW: "+ind+" :: "+c);
        }
    }
    OWLPrettyPrinter owlpp = new OWLPrettyPrinter(g);
    for (OWLAxiom a : newAxioms) {
        LOG.info("NEW: "+owlpp.render(a));
    }
    LOG.info("# OF NEW AXIOMS: "+newAxioms.size());
    if (isNew) {
        g.setSourceOntology(mgr.createOntology());
    }
    mgr.addAxioms(g.getSourceOntology(), newAxioms);
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:43,代码来源:CommandRunner.java

示例15: write

import org.semanticweb.owlapi.model.OWLOntology; //导入方法依赖的package包/类
static void write(String input, final String output, String name, String catalogXml) throws Exception {
	ParserWrapper p = new ParserWrapper();
	if (catalogXml != null) {
		p.addIRIMapper(new CatalogXmlIRIMapper(catalogXml));
	}
	IRI iri = IRI.create(new File(input));
	final OWLOntology ontology = p.parseOWL(iri);
	final OWLGraphWrapper g = new OWLGraphWrapper(ontology);

	Set<OWLNamedIndividual> individuals = ontology.getIndividualsInSignature(Imports.INCLUDED);

	OWLReasonerFactory factory = new ElkReasonerFactory();
	
	final OWLReasoner reasoner = factory.createReasoner(ontology);
	try {
		LegoRenderer renderer = new LegoDotWriter(g, reasoner) {

			BufferedWriter fileWriter = null;
			
			@Override
			protected void open() throws IOException {
				fileWriter = new BufferedWriter(new FileWriter(new File(output)));
			}

			@Override
			protected void close() {
				IOUtils.closeQuietly(fileWriter);
			}

			@Override
			protected void appendLine(CharSequence line) throws IOException {
				System.out.println(line);
				fileWriter.append(line).append('\n');
			}
		};
		renderer.render(individuals, name, true);
	}
	finally {
		reasoner.dispose();
	}
}
 
开发者ID:owlcollab,项目名称:owltools,代码行数:42,代码来源:ExampleWriter.java


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