/** * Extracts data from the parent of ontClass that is a {@link Restriction} of type * {@link com.hp.hpl.jena.ontology.HasValueRestriction}. Updates the {@link SolrInputDocument} for ontClass. * * @param doc the input Solr document * @param restriction the restriction */ private void extractHasValueRestriction(@Nonnull final SolrInputDocument doc, @Nonnull final Restriction restriction) { // Not all of these have pretty names. Re-map these via managed-schema.xml field configurations. final String fieldName = getOnPropertyFromRestriction(restriction); final String fieldValue = restriction.asHasValueRestriction().getHasValue().asLiteral().getLexicalForm(); if (StringUtils.isNotBlank(fieldName) && StringUtils.isNotBlank(fieldValue)) { if (!this.isIntersection) { addMultivaluedField(doc, fieldName, fieldValue); } else { writeWorldwideDataFromRestriction(doc, fieldName, fieldValue); } } else { this.logger.warn("Could not extract data from hasValue restriction {}, onProperty {}, in class {}", restriction.getId(), fieldName, doc.getFieldValue(ID_FIELD_NAME)); } }
/** * Extracts data from the parent of ontClass that is a {@link Restriction} of type * {@link com.hp.hpl.jena.ontology.HasValueRestriction}. Updates the {@link SolrInputDocument} for ontClass. * * @param doc the input Solr document * @param restriction the restriction */ private void extractHasValueRestriction(@Nonnull final SolrInputDocument doc, @Nonnull final Restriction restriction) { // Not all of these have pretty names. Re-map these via managed-schema.xml field configurations. final String fieldName = getOnPropertyFromRestriction(restriction); final String fieldValue = restriction.asHasValueRestriction().getHasValue().asLiteral().getLexicalForm(); if (StringUtils.isNotBlank(fieldName) && StringUtils.isNotBlank(fieldValue)) { if (!this.isIntersection) { addMultivaluedField(doc, fieldName, fieldValue); } else { writeWorldwideDataFromRestriction(doc, fieldName, fieldValue); } } else { this.logger.warn("Could not extract data from hasValue restriction {}, onProperty {}, in class {}", restriction.getId(), fieldName, doc.getFieldValue(ID_FIELD_NAME)); } }