@Nullable public <T> Entity getEntity(T id, AttributeType<T> rtype){ Attribute<T> iri = rtype.getAttribute(id); Thing inst = iri != null? iri.ownerInstances().findFirst().orElse(null) : null; return inst != null? inst.asEntity() : null; }
public static ConceptMethod<Optional<Concept>> getAttribute(Object value) { return ConceptMethod.builder(ConceptResponseType.OPTIONAL_CONCEPT) .requestSetter(builder -> builder.setGetAttribute(convertValue(value))) .function(concept -> Optional.ofNullable(concept.asAttributeType().getAttribute(value))) .build(); }