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


Java OWLOntology.getObjectPropertiesInSignature方法代碼示例

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


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

示例1: initializeLegacyRelationIndex

import org.semanticweb.owlapi.model.OWLOntology; //導入方法依賴的package包/類
private void initializeLegacyRelationIndex() {
	synchronized(legacyRelationIndex) {
		OWLAnnotationProperty rdfsLabel = OWLManager.getOWLDataFactory().getRDFSLabel();
		for (OWLOntology ont : this.getOntology().getImportsClosure()) {
			for (OWLObjectProperty prop : ont.getObjectPropertiesInSignature()) {
				for (OWLAnnotationAssertionAxiom axiom : ont.getAnnotationAssertionAxioms(prop.getIRI())) {
					if (axiom.getProperty().equals(rdfsLabel)) {
						Optional<OWLLiteral> literalOpt = axiom.getValue().asLiteral();
						if (literalOpt.isPresent()) {
							String label = literalOpt.get().getLiteral();
							legacyRelationIndex.put(prop.getIRI(), label.replaceAll(" ", "_"));
						}
					}
				}
			}
		}
	}
}
 
開發者ID:geneontology,項目名稱:minerva,代碼行數:19,代碼來源:CoreMolecularModelManager.java

示例2: getOntoObjectProperty

import org.semanticweb.owlapi.model.OWLOntology; //導入方法依賴的package包/類
/**
 * Get the {@link OWLObjectProperty} object corresponding to a named object
 * property (i.e. relation in OO) of the ontology.
 * @param onto
 * @param name
 * @return
 */
public static OWLObjectProperty getOntoObjectProperty(OWLOntology onto,
    String name) {
  for (OWLObjectProperty p : onto.getObjectPropertiesInSignature())
    if (p.getIRI().getFragment().equals(name))
      return p;
  return null;
}
 
開發者ID:IGNF,項目名稱:geoxygene,代碼行數:15,代碼來源:OwlUtil.java

示例3: getEntities

import org.semanticweb.owlapi.model.OWLOntology; //導入方法依賴的package包/類
@Override
protected Set<OWLObjectPropertyExpression> getEntities(OWLOntology ont) {
    Set<OWLObjectPropertyExpression> result = new HashSet<OWLObjectPropertyExpression>();
    for (OWLObjectPropertyExpression property : ont.getObjectPropertiesInSignature()) {
        result.add(property);
        result.add(property.getInverseProperty());
    }
    return result;
}
 
開發者ID:ernestojimenezruiz,項目名稱:logmap-matcher,代碼行數:10,代碼來源:StructuralReasoner2.java

示例4: excludeAllWith

import org.semanticweb.owlapi.model.OWLOntology; //導入方法依賴的package包/類
public void excludeAllWith(OWLAnnotationProperty ap, OWLOntology o) {
	for (OWLObjectProperty p : o.getObjectPropertiesInSignature(Imports.INCLUDED)) {
		Set<OWLAnnotation> anns = OwlHelper.getAnnotations(p, ap, o);
		for (OWLAnnotation ann : anns) {
			if (ann.getValue() instanceof OWLLiteral) {
				OWLLiteral v = (OWLLiteral) ann.getValue();
				if (v.parseBoolean()) {
					excludeProperty(p);
				}
			}

		}
	}
}
 
開發者ID:owlcollab,項目名稱:owltools,代碼行數:15,代碼來源:OWLGraphWrapperEdges.java

示例5: includeAllWith

import org.semanticweb.owlapi.model.OWLOntology; //導入方法依賴的package包/類
public void includeAllWith(OWLAnnotationProperty ap, OWLOntology o) {
	for (OWLObjectProperty p : o.getObjectPropertiesInSignature(Imports.INCLUDED)) {
		Set<OWLAnnotation> anns = OwlHelper.getAnnotations(p, ap, o);
		for (OWLAnnotation ann : anns) {
			if (ann.getValue() instanceof OWLLiteral) {
				OWLLiteral v = (OWLLiteral) ann.getValue();
				if (v.parseBoolean()) {
					includeProperty(p);
				}
			}

		}
	}
}
 
開發者ID:owlcollab,項目名稱:owltools,代碼行數:15,代碼來源:OWLGraphWrapperEdges.java

示例6: 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

示例7: 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

示例8: 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

示例9: getIRIByIdentifier

import org.semanticweb.owlapi.model.OWLOntology; //導入方法依賴的package包/類
public IRI getIRIByIdentifier(String id, boolean isAutoResolve) {
	if (isAutoResolve) {
		OWLObject obj = this.getObjectByAltId(id);
		if (obj != null) {
			return ((OWLNamedObject) obj).getIRI();
		}
	}

	// special magic for finding IRIs from a non-standard identifier
	// This is the case for relations (OWLObject properties) with a short hand
	// or for relations with a non identifiers with-out a colon, e.g. negative_regulation
	if (!id.contains(":")) {
		final OWLAnnotationProperty shortHand = getDataFactory().getOWLAnnotationProperty(Obo2OWLVocabulary.IRI_OIO_shorthand.getIRI());
		final OWLAnnotationProperty oboIdInOwl = getDataFactory().getOWLAnnotationProperty(Obo2Owl.trTagToIRI(OboFormatTag.TAG_ID.getTag()));
		for (OWLOntology o : getAllOntologies()) {
			for(OWLObjectProperty p : o.getObjectPropertiesInSignature()) {
				// check for short hand or obo ID in owl
				Set<OWLAnnotation> annotations = OwlHelper.getAnnotations(p, o);
				if (annotations != null) {
					for (OWLAnnotation owlAnnotation : annotations) {
						OWLAnnotationProperty property = owlAnnotation.getProperty();
						if ((shortHand != null && shortHand.equals(property)) 
								|| (oboIdInOwl != null && oboIdInOwl.equals(property)))
						{
							OWLAnnotationValue value = owlAnnotation.getValue();
							if (value != null && value instanceof OWLLiteral) {
								OWLLiteral literal = (OWLLiteral) value;
								String shortHandLabel = literal.getLiteral();
								if (id.equals(shortHandLabel)) {
									return p.getIRI();
								}
							}
						}
					}
				}
			}
		}
	}


	// otherwise use the obo2owl method
	Obo2Owl b = new Obo2Owl(getManager()); // re-use manager, creating a new one can be expensive as this is a highly used code path
	b.setObodoc(new OBODoc());
	return b.oboIdToIRI(id);
}
 
開發者ID:owlcollab,項目名稱:owltools,代碼行數:46,代碼來源:OWLGraphWrapperExtended.java


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