use of edu.stanford.bmir.protege.web.shared.PrimitiveType 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);
}
Aggregations