Java Code Examples for org.semanticweb.owlapi.model.OWLIndividual#isNamed()

The following examples show how to use org.semanticweb.owlapi.model.OWLIndividual#isNamed() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ModelAnnotationSolrDocumentLoader.java    From owltools with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private Map<OWLClass, Pair<OWLNamedIndividual, Set<OWLAnnotation>>> findProcesses(OWLNamedIndividual mf) {
	Map<OWLClass, Pair<OWLNamedIndividual, Set<OWLAnnotation>>> result = new HashMap<OWLClass, Pair<OWLNamedIndividual,Set<OWLAnnotation>>>();
	Set<OWLObjectPropertyAssertionAxiom> axioms = model.getObjectPropertyAssertionAxioms(mf);
	for (OWLObjectPropertyAssertionAxiom axiom : axioms) {
		if (partOf.equals(axiom.getProperty()) && mf.equals(axiom.getSubject())) {
			// relevant axiom
			OWLIndividual bpCandidate = axiom.getObject();
			if (bpCandidate.isNamed()) {
				final OWLNamedIndividual named = bpCandidate.asOWLNamedIndividual();
				Set<OWLClass> bpTypes = getTypes(named);
				for (OWLClass bpType : bpTypes) {
					if (bpSet.contains(bpType) == false) {
						continue;
					}
					result.put(bpType, Pair.of(named, getAnnotations(axiom, named)));
				}
			}
		}
	}
	return result;
}
 
Example 2
Source File: ModelAnnotationSolrDocumentLoader.java    From owltools with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private Map<OWLClass, Pair<OWLNamedIndividual, Set<OWLAnnotation>>> findLocations(OWLNamedIndividual mf) {
	Map<OWLClass, Pair<OWLNamedIndividual, Set<OWLAnnotation>>> result = new HashMap<OWLClass, Pair<OWLNamedIndividual,Set<OWLAnnotation>>>();
	Set<OWLObjectPropertyAssertionAxiom> axioms = model.getObjectPropertyAssertionAxioms(mf);
	for (OWLObjectPropertyAssertionAxiom axiom : axioms) {
		if (occursIn.equals(axiom.getProperty()) && mf.equals(axiom.getSubject())) {
			// relevant axiom
			OWLIndividual locationCandidate = axiom.getObject();
			if (locationCandidate.isNamed()) {
				OWLNamedIndividual named = locationCandidate.asOWLNamedIndividual();
				Set<OWLClass> locationTypes = getTypes(named);
				for (OWLClass locationType : locationTypes) {
					result.put(locationType, Pair.of(named, getAnnotations(axiom, named)));
				}
			}
		}
	}
	return result;
}
 
Example 3
Source File: SimpleOntologyValues.java    From mobi with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * .
 */
public static Individual mobiIndividual(OWLIndividual owlapiIndividual) {
    if (owlapiIndividual == null || !owlapiIndividual.isNamed()) {
        return null;
    }
    org.semanticweb.owlapi.model.IRI owlapiIri = owlapiIndividual.asOWLNamedIndividual().getIRI();
    IRI mobiIri = mobiIRI(owlapiIri);
    return new SimpleIndividual(mobiIri);
}
 
Example 4
Source File: OwlHelper.java    From owltools with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public static Set<OWLClassExpression> getTypes(OWLIndividual i, OWLOntology ont) {
	Set<OWLClassExpression> types;
	if (ont != null && i != null && i.isNamed()) {
		types = getTypes(i.asOWLNamedIndividual(), ont);
	}
	else {
		types = Collections.emptySet();
	}
	return types;
}
 
Example 5
Source File: LegoUnitTools.java    From owltools with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private OWLClass getType(OWLIndividual individual) {
	OWLClass type = null;
	if (individual.isNamed()) {
		Set<OWLClass> set = reasoner.getTypes(individual.asOWLNamedIndividual(), true).getFlattened();
		if (set.size() == 1) {
			OWLClass cls = set.iterator().next();
			if (cls.isBuiltIn() == false) {
				type = cls;
			}
		}
	}
	return type;
}