Search in sources :

Example 6 with OWLLiteralData

use of edu.stanford.bmir.protege.web.shared.entity.OWLLiteralData in project webprotege by protegeproject.

the class PrimitiveDataParserImpl method parsePrimitiveDataFromTrimmedContent.

private void parsePrimitiveDataFromTrimmedContent(final String trimmedContent, final java.util.Optional<String> lang, Set<PrimitiveType> allowedTypes, final PrimitiveDataParserCallback callback) {
    if (trimmedContent.isEmpty()) {
        callback.onSuccess(java.util.Optional.empty());
        return;
    }
    if (lang.isPresent()) {
        if (allowedTypes.contains(PrimitiveType.LITERAL)) {
            OWLLiteralData literalData = parseLiteralData(trimmedContent, lang);
            callback.onSuccess(java.util.Optional.of(literalData));
        } else {
            // TODO: Literal not expected
            callback.parsingFailure();
        }
        return;
    }
    Set<EntityType<?>> allowedEntityTypes = Sets.newHashSet();
    for (PrimitiveType primitiveType : allowedTypes) {
        if (primitiveType.isEntityType()) {
            allowedEntityTypes.add(primitiveType.getEntityType());
        }
    }
    parseEntityDataIRIOrLiteral(trimmedContent, lang, allowedEntityTypes, allowedTypes, callback);
}
Also used : EntityType(org.semanticweb.owlapi.model.EntityType) OWLLiteralData(edu.stanford.bmir.protege.web.shared.entity.OWLLiteralData) PrimitiveType(edu.stanford.bmir.protege.web.shared.PrimitiveType)

Aggregations

OWLLiteralData (edu.stanford.bmir.protege.web.shared.entity.OWLLiteralData)6 OWLPrimitiveData (edu.stanford.bmir.protege.web.shared.entity.OWLPrimitiveData)3 OWLLiteral (org.semanticweb.owlapi.model.OWLLiteral)2 PrimitiveType (edu.stanford.bmir.protege.web.shared.PrimitiveType)1 IRIData (edu.stanford.bmir.protege.web.shared.entity.IRIData)1 OWLAnnotationPropertyData (edu.stanford.bmir.protege.web.shared.entity.OWLAnnotationPropertyData)1 OWLPropertyData (edu.stanford.bmir.protege.web.shared.entity.OWLPropertyData)1 EntityType (org.semanticweb.owlapi.model.EntityType)1