org.semanticweb.owlapi.model.OWLRuntimeException Java Examples

The following examples show how to use org.semanticweb.owlapi.model.OWLRuntimeException. 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: SimpleOntologyValues.java    From mobi with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * .
 */
public static Annotation mobiAnnotation(OWLAnnotation owlAnno) {
    // TODO: ??? Fix this.
    if (owlAnno == null) {
        return null;
    }

    AnnotationProperty property = mobiAnnotationProperty(owlAnno.getProperty());
    OWLAnnotationValue value = owlAnno.getValue();
    if (value instanceof OWLLiteral) {
        OWLLiteral literal = (OWLLiteral) value;
        Literal simpleLiteral = mobiLiteral(literal);
        return new SimpleAnnotation(property, simpleLiteral);
    } else if (value instanceof org.semanticweb.owlapi.model.IRI) {
        org.semanticweb.owlapi.model.IRI iri = (org.semanticweb.owlapi.model.IRI) value;
        IRI simpleIri = mobiIRI(iri);
        return new SimpleAnnotation(property, simpleIri);
    } else if (value instanceof OWLAnonymousIndividual) {
        OWLAnonymousIndividual individual = (OWLAnonymousIndividual) value;
        Individual simpleIndividual = mobiIndividual(individual);
        return new SimpleAnnotation(property, simpleIndividual);
    } else {
        throw new OWLRuntimeException("Invalid annotation value");
    }
}
 
Example #2
Source File: ElkConverter.java    From elk-reasoner with Apache License 2.0 5 votes vote down vote up
public OWLRuntimeException convert(ElkException e) {
	if (e instanceof ElkFreshEntitiesException)
		return convert((ElkFreshEntitiesException) e);
	else if (e instanceof ElkInconsistentOntologyException)
		return convert((ElkInconsistentOntologyException) e);
	else if (e instanceof ElkInterruptedException)
		return convert((ElkInterruptedException) e);
	else
		return new OWLRuntimeException(e);
}
 
Example #3
Source File: OWLAPIFunctionalSyntaxParser.java    From elk-reasoner with Apache License 2.0 5 votes vote down vote up
private OWLOntology loadViaOWLAPI() throws Owl2ParseException {
	try {
		return TestOWLManager.createOWLOntologyManager()
				.loadOntologyFromOntologyDocument(mOntoSource);

	} catch (OWLOntologyCreationException e) {
		throw new Owl2ParseException(e);
	} catch (OWLRuntimeException re) {
		throw new Owl2ParseException(re);
	}
}
 
Example #4
Source File: SnomedTaxonomyLoader.java    From snomed-owl-toolkit with Apache License 2.0 4 votes vote down vote up
@Override
public void newReferenceSetMemberState(String[] fieldNames, String id, String effectiveTime, String active, String moduleId, String refsetId, String referencedComponentId, String... otherValues) {
	boolean activeBool = ACTIVE.equals(active);
	if (refsetId.equals(Concepts.OWL_AXIOM_REFERENCE_SET) && owlParsingExceptionThrown == null) {
		if (activeBool) {
			try {
				addActiveAxiom(id, referencedComponentId, otherValues[0]);
			} catch (OWLException | OWLRuntimeException | IllegalArgumentException | ArrayIndexOutOfBoundsException e) {
				owlParsingExceptionThrown = e;
				owlParsingExceptionMemberId = id;
			}
		} else {
			// Remove the axiom from our active set
			// Match by id rather than a deserialised representation because the equals method may fail.
			snomedTaxonomy.removeAxiom(referencedComponentId, id);
		}
	} else if (refsetId.equals(Concepts.OWL_ONTOLOGY_REFERENCE_SET)) {
		if (Concepts.OWL_ONTOLOGY_NAMESPACE.equals(referencedComponentId)) {
			if (activeBool) {
				snomedTaxonomy.addOntologyNamespace(id, otherValues[0]);
			} else {
				snomedTaxonomy.removeOntologyNamespace(id);
			}
		} else if (Concepts.OWL_ONTOLOGY_HEADER.equals(referencedComponentId)) {
			if (activeBool) {
				snomedTaxonomy.addOntologyHeader(id, otherValues[0]);
			} else {
				snomedTaxonomy.removeOntologyHeader(id);
			}
		} else {
			LOGGER.warn("Unrecognised referencedComponentId '{}' in OWL Ontology reference set file. Only {} or {} are expected. Ignoring entry.",
					referencedComponentId, Concepts.OWL_ONTOLOGY_NAMESPACE, Concepts.OWL_ONTOLOGY_HEADER);
		}
	} else if (refsetId.equals(Concepts.MRCM_ATTRIBUTE_DOMAIN_INTERNATIONAL_REFERENCE_SET)) {
		long attributeId = parseLong(referencedComponentId);
		boolean ungrouped = otherValues[1].equals("0");
		Long contentTypeId = parseLong(otherValues[5]);
		if (activeBool && ungrouped) {
			snomedTaxonomy.addUngroupedRole(contentTypeId, attributeId);
		} else {
			snomedTaxonomy.removeUngroupedRole(contentTypeId, attributeId);
		}
	} else if (fieldNames.length == 7 && fieldNames[6].equals("acceptabilityId")) {
		snomedTaxonomy.setDescriptionAcceptability(referencedComponentId, refsetId, otherValues[0], activeBool);
	}
	ComponentFactory componentFactoryTap = getComponentFactoryTap();
	if (componentFactoryTap != null) {
		componentFactoryTap.newReferenceSetMemberState(fieldNames, id, effectiveTime, active, moduleId, refsetId, referencedComponentId, otherValues);
	}
}
 
Example #5
Source File: ElkConverter.java    From elk-reasoner with Apache License 2.0 4 votes vote down vote up
public OWLRuntimeException convert(ElkRuntimeException e) {
	return new ReasonerInternalException(e);
}