Java Code Examples for org.semanticweb.owlapi.model.OWLObjectPropertyAssertionAxiom#getObject()

The following examples show how to use org.semanticweb.owlapi.model.OWLObjectPropertyAssertionAxiom#getObject() . 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: LegoTools.java    From owltools with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public List<LegoNode> createLegoNodes(Collection<OWLNamedIndividual> individuals) throws UnExpectedStructureException {
	List<LegoNode> nodes = new ArrayList<LegoNode>(individuals.size());
	Set<OWLOntology> ontologies = new HashSet<OWLOntology>(graph.getAllOntologies());
	for (OWLNamedIndividual individual : individuals) {
		Set<OWLClassAssertionAxiom> axioms = getClassAxioms(individual, ontologies);
		final LegoNode node = createNode(individual, axioms, ontologies);
		if (node != null) {
			// links
			List<LegoLink> links = new ArrayList<LegoLink>();
			Set<OWLObjectPropertyAssertionAxiom> propertyAxioms = getPropertyAxioms(individual, ontologies);
			for (OWLObjectPropertyAssertionAxiom propertyAxiom : propertyAxioms) {
				OWLIndividual object = propertyAxiom.getObject();
				if (object instanceof OWLNamedIndividual == false) {
					throw new UnExpectedStructureException("Expected a named individual for a link: "+propertyAxiom);
				}
				OWLNamedIndividual namedTarget = (OWLNamedIndividual) object;
				OWLObjectPropertyExpression property = propertyAxiom.getProperty();
				LegoLink link = new LegoLink(individual, namedTarget, property);
				LegoMetadata.extractMetadata(link, propertyAxiom);
				links.add(link);
			}
			if (!links.isEmpty()) {
				node.setLinks(links);
			}
			
			nodes.add(node);
		}
	}
	
	return nodes;
}