diff --git a/solr/configsets/scholars-discovery/conf/managed-schema.xml b/solr/configsets/scholars-discovery/conf/managed-schema.xml index 9b732b66a..db33a7e48 100644 --- a/solr/configsets/scholars-discovery/conf/managed-schema.xml +++ b/solr/configsets/scholars-discovery/conf/managed-schema.xml @@ -202,10 +202,6 @@ field first in an ascending sort and last in a descending sort. --> - - - - @@ -358,6 +354,10 @@ + + + + diff --git a/solr/configsets/scholars-discovery/conf/solrconfig.xml b/solr/configsets/scholars-discovery/conf/solrconfig.xml index e01f9abbb..bc3d62f63 100644 --- a/solr/configsets/scholars-discovery/conf/solrconfig.xml +++ b/solr/configsets/scholars-discovery/conf/solrconfig.xml @@ -35,7 +35,7 @@ that you fully re-index after changing this setting as it can affect both how text is indexed and queried. --> - 9.4 + 9.7 @@ -385,10 +385,9 @@ to occupy. Note that when this option is specified, the size and initialSize parameters are ignored. --> - - + - - + - + + autowarmCount="128"/> + - - - - - + + - - - - - - + + @@ -990,48 +969,6 @@ [EEE, ]dd MMM yyyy HH:mm[:ss] z EEEE, dd-MMM-yy HH:mm:ss z EEE MMM ppd HH:mm:ss [z ]yyyy - - yyyy-MM-dd'T'HH:mm:ss.SSS - yyyy-MM-dd'T'HH:mm:ss.SSSz - yyyy-MM-dd'T'HH:mm:ss.SSSZ - yyyy-MM-dd'T'HH:mm:ss.SSSZZ - - yyyy-MM-dd'T'HH:mm:ss,SSS - yyyy-MM-dd'T'HH:mm:ss,SSSz - yyyy-MM-dd'T'HH:mm:ss,SSSZ - yyyy-MM-dd'T'HH:mm:ss,SSSZZ - - yyyy-MM-dd'T'HH:mm:ss - yyyy-MM-dd'T'HH:mm:ssz - yyyy-MM-dd'T'HH:mm:ssZ - yyyy-MM-dd'T'HH:mm:ssZZ - - yyyy-MM-dd'T'HH:mm - yyyy-MM-dd'T'HH:mmz - yyyy-MM-dd'T'HH:mmZ - yyyy-MM-dd'T'HH:mmZZ - - yyyy-MM-dd HH:mm:ss.SSS - yyyy-MM-dd HH:mm:ss.SSSz - yyyy-MM-dd HH:mm:ss.SSSZ - yyyy-MM-dd HH:mm:ss.SSSZZ - - yyyy-MM-dd HH:mm:ss,SSS - yyyy-MM-dd HH:mm:ss,SSSz - yyyy-MM-dd HH:mm:ss,SSSZ - yyyy-MM-dd HH:mm:ss,SSSZZ - - yyyy-MM-dd HH:mm:ss - yyyy-MM-dd HH:mm:ssz - yyyy-MM-dd HH:mm:ssZ - yyyy-MM-dd HH:mm:ssZZ - - yyyy-MM-dd HH:mm - yyyy-MM-dd HH:mmz - yyyy-MM-dd HH:mmZ - yyyy-MM-dd HH:mmZZ - - yyyy-MM-dd diff --git a/src/main/java/edu/tamu/scholars/middleware/config/WebSocketSecurityConfig.java b/src/main/java/edu/tamu/scholars/middleware/config/WebSocketSecurityConfig.java index 05a805a44..0bd757e1b 100644 --- a/src/main/java/edu/tamu/scholars/middleware/config/WebSocketSecurityConfig.java +++ b/src/main/java/edu/tamu/scholars/middleware/config/WebSocketSecurityConfig.java @@ -29,6 +29,7 @@ protected void configureInbound(MessageSecurityMetadataSourceRegistry messages) .simpSubscribeDestMatchers( "/queue/public", "/queue/themes", + "/queue/dataAndAnalyticsViews", "/queue/directoryViews", "/queue/discoveryViews", "/queue/displayViews", diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/DiscoveryConstants.java b/src/main/java/edu/tamu/scholars/middleware/discovery/DiscoveryConstants.java index 4f718293a..0e7f2ec00 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/DiscoveryConstants.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/DiscoveryConstants.java @@ -10,12 +10,16 @@ public class DiscoveryConstants { public static final String CLASS = "class"; + public static final String ABSTRACT = "abstract"; + public static final String TYPE = "type"; public static final String SNIPPET = "snippet"; public static final String MOD_TIME = "modTime"; + public static final String SYNC_IDS = "syncIds"; + public static final String QUERY_DELIMETER = ":"; public static final String DEFAULT_QUERY = WILDCARD + QUERY_DELIMETER + WILDCARD; diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/component/Harvester.java b/src/main/java/edu/tamu/scholars/middleware/discovery/component/Harvester.java index 6371170ba..1302adc30 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/component/Harvester.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/component/Harvester.java @@ -1,13 +1,14 @@ package edu.tamu.scholars.middleware.discovery.component; import edu.tamu.scholars.middleware.discovery.model.AbstractIndexDocument; +import edu.tamu.scholars.middleware.discovery.model.Individual; import reactor.core.publisher.Flux; public interface Harvester { - public Flux harvest(); + public Flux harvest(); - public AbstractIndexDocument harvest(String subject); + public Individual harvest(String subject); public Class type(); diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/component/Indexer.java b/src/main/java/edu/tamu/scholars/middleware/discovery/component/Indexer.java index 10c07f3e5..81556bfe2 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/component/Indexer.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/component/Indexer.java @@ -3,14 +3,15 @@ import java.util.Collection; import edu.tamu.scholars.middleware.discovery.model.AbstractIndexDocument; +import edu.tamu.scholars.middleware.discovery.model.Individual; public interface Indexer { public void init(); - public void index(Collection documents); + public void index(Collection documents); - public void index(AbstractIndexDocument document); + public void index(Individual document); public void optimize(); diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/component/jena/TriplestoreHarvester.java b/src/main/java/edu/tamu/scholars/middleware/discovery/component/jena/TriplestoreHarvester.java index 4df50b731..95642cd9f 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/component/jena/TriplestoreHarvester.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/component/jena/TriplestoreHarvester.java @@ -1,6 +1,5 @@ package edu.tamu.scholars.middleware.discovery.component.jena; -import static edu.tamu.scholars.middleware.discovery.DiscoveryConstants.ID; import static edu.tamu.scholars.middleware.discovery.DiscoveryConstants.NESTED_DELIMITER; import java.lang.reflect.Field; @@ -32,6 +31,7 @@ import edu.tamu.scholars.middleware.discovery.annotation.FieldType; import edu.tamu.scholars.middleware.discovery.component.Harvester; import edu.tamu.scholars.middleware.discovery.model.AbstractIndexDocument; +import edu.tamu.scholars.middleware.discovery.model.Individual; import edu.tamu.scholars.middleware.service.TemplateService; import edu.tamu.scholars.middleware.service.Triplestore; import reactor.core.publisher.Flux; @@ -40,7 +40,7 @@ public class TriplestoreHarvester implements Harvester { private static final Logger logger = LoggerFactory.getLogger(TriplestoreHarvester.class); - private static final String COLLECTION_SPARQL_TEMPLATE = "collection"; + private static final String COLLECTION = "collection"; private static final String FORWARD_SLASH = "/"; @@ -58,36 +58,39 @@ public class TriplestoreHarvester implements Harvester { private final List propertySourceTypeOps; - private final List indexedFields; + private final List nestedFields; public TriplestoreHarvester(Class type) { this.type = type; - this.propertySourceTypeOps = FieldUtils.getFieldsListWithAnnotation(type, FieldSource.class).stream().map(this::getTypeOp).collect(Collectors.toList()); - this.indexedFields = FieldUtils.getFieldsListWithAnnotation(type, FieldType.class); + this.propertySourceTypeOps = FieldUtils.getFieldsListWithAnnotation(type, FieldSource.class) + .stream() + .map(this::getTypeOp) + .collect(Collectors.toList()); + this.nestedFields = FieldUtils.getFieldsListWithAnnotation(type, FieldType.class) + .stream() + .filter(this::isNestedField) + .collect(Collectors.toList()); } - public Flux harvest() { + public Flux harvest() { CollectionSource source = type.getAnnotation(CollectionSource.class); - String query = templateService.templateSparql(COLLECTION_SPARQL_TEMPLATE, source.predicate()); - logger.debug("{}:\n{}", COLLECTION_SPARQL_TEMPLATE, query); + String query = templateService.templateSparql(COLLECTION, source.predicate()); + logger.debug("{}:\n{}", COLLECTION, query); QueryExecution queryExecution = triplestore.createQueryExecution(query); Iterator tripleIterator = queryExecution.execConstructTriples(); - Iterable triples = () -> tripleIterator; - return Flux.fromIterable(triples) + + return Flux.fromIterable(() -> tripleIterator) .map(this::subject) .map(this::harvest) .doFinally(onFinally -> queryExecution.close()); } - public AbstractIndexDocument harvest(String subject) { + public Individual harvest(String subject) { try { - return createDocument(subject); + return createIndividual(subject); } catch (Exception e) { - logger.error("Unable to index {}: {}", type.getSimpleName(), parse(subject)); - logger.error("Error: {}", e.getMessage()); - if (logger.isDebugEnabled()) { - e.printStackTrace(); - } + logger.debug("Error harvesting", e); + logger.error("Unable to harvest {} {}: {}", type.getSimpleName(), parse(subject), e.getMessage()); throw new RuntimeException(e); } } @@ -96,31 +99,30 @@ public Class type() { return type; } - private String subject(Triple triple) { - return triple.getSubject().toString(); - } + private Individual createIndividual(String subject) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException { + Individual individual = new Individual(); + individual.setId(parse(subject)); + lookupProperties(individual, subject); + lookupSyncIds(individual); + individual.setProxy(type.getSimpleName()); - private AbstractIndexDocument createDocument(String subject) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException { - AbstractIndexDocument document = construct(); - document.setId(parse(subject)); - lookupProperties(document, subject); - lookupSyncIds(document); - return document; + return individual; } - private void lookupProperties(AbstractIndexDocument document, String subject) { + private void lookupProperties(Individual individual, String subject) { propertySourceTypeOps.parallelStream().forEach(typeOp -> { try { FieldSource source = typeOp.getPropertySource(); Model model = queryForModel(source, subject); List values = lookupProperty(typeOp, source, model); - populate(document, typeOp.getField(), values); - } catch (Exception e) { - logger.error("Unable to populate document {}: {}", name(), parse(subject)); - logger.error("Error: {}", e.getMessage()); - if (logger.isDebugEnabled()) { - e.printStackTrace(); + if (!values.isEmpty()) { + populate(individual, typeOp.getField(), values); + } else { + logger.debug("Could not find values for {}", typeOp.getField().getName()); } + } catch (Exception e) { + logger.error("Unable to populate individual {} {}: {}", type.getSimpleName(), parse(subject), e.getMessage()); + logger.debug("Error populating individual", e); } }); } @@ -133,6 +135,7 @@ private Model queryForModel(FieldSource source, String subject) { if (logger.isDebugEnabled()) { model.write(System.out, "RDF/XML"); } + return model; } } @@ -152,9 +155,9 @@ private List queryForProperty(TypeOp typeOp, FieldSource source, Model m StmtIterator statements; try { statements = resource.listProperties(model.createProperty(source.predicate())); - } catch (InvalidPropertyURIException exception) { - logger.error("{} lookup by {}", typeOp.getField().getName(), source.predicate()); - throw exception; + } catch (InvalidPropertyURIException e) { + logger.error("{} lookup by {}: {}", typeOp.getField().getName(), source.predicate(), e.getMessage()); + throw e; } while (statements.hasNext()) { @@ -177,49 +180,39 @@ private List queryForProperty(TypeOp typeOp, FieldSource source, Model m } } } + return values; } - private void populate(AbstractIndexDocument document, Field field, List values) throws IllegalArgumentException, IllegalAccessException { + private void populate(Individual document, Field field, List values) throws IllegalArgumentException, IllegalAccessException { if (values.isEmpty()) { logger.debug("Could not find values for {}", field.getName()); } else { - field.setAccessible(true); - if (List.class.isAssignableFrom(field.getType())) { - field.set(document, values); + if (Collection.class.isAssignableFrom(field.getType())) { + document.getContent().put(field.getName(), values); } else { - field.set(document, values.get(0)); + document.getContent().put(field.getName(), values.get(0)); } } } - @SuppressWarnings("unchecked") - private void lookupSyncIds(AbstractIndexDocument document) { + private void lookupSyncIds(Individual individual) { Set syncIds = new HashSet(); - syncIds.add(document.getId()); - indexedFields.stream().filter(this::isNestedField).peek(field -> field.setAccessible(true)).forEach(field -> { - try { - Object value = field.get(document); + syncIds.add(individual.getId()); + nestedFields.stream() + .forEach(field -> { + Object value = individual.getContent().get(field.getName()); if (value != null) { if (Collection.class.isAssignableFrom(field.getType())) { - ((Collection) value).forEach(v -> addSyncId(syncIds, v)); + @SuppressWarnings("unchecked") + List values = (List) value; + values.forEach(v -> addSyncId(syncIds, v)); } else { addSyncId(syncIds, (String) value); } } - } catch (IllegalArgumentException | IllegalAccessException e) { - logger.error("Unable to get value of {} {}", name(), field.getName()); - logger.error("Error: {}", e.getMessage()); - if (logger.isDebugEnabled()) { - e.printStackTrace(); - } - } - }); - document.setSyncIds(new ArrayList<>(syncIds)); - } - - private boolean isNestedField(Field field) { - return !field.getName().equals(ID) && field.getAnnotation(FieldType.class).type().startsWith(NESTED); + }); + individual.setSyncIds(new ArrayList<>(syncIds)); } private void addSyncId(Set syncIds, String value) { @@ -229,12 +222,15 @@ private void addSyncId(Set syncIds, String value) { } } - private AbstractIndexDocument construct() throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException, SecurityException { - return type.getConstructor().newInstance(new Object[0]); + private boolean isNestedField(Field field) { + return field.getAnnotation(FieldType.class) + .type() + .startsWith(NESTED); } - private String name() { - return type.getSimpleName(); + private String subject(Triple triple) { + return triple.getSubject() + .toString(); } private String parse(String uri) { @@ -272,7 +268,6 @@ private interface TypeOp { public Field getField(); public FieldSource getPropertySource(); - } private abstract class AbstractTypeOp implements TypeOp { diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/component/solr/SolrIndexer.java b/src/main/java/edu/tamu/scholars/middleware/discovery/component/solr/SolrIndexer.java index 777d3c750..c4a40f98e 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/component/solr/SolrIndexer.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/component/solr/SolrIndexer.java @@ -20,6 +20,7 @@ import edu.tamu.scholars.middleware.discovery.annotation.FieldType; import edu.tamu.scholars.middleware.discovery.component.Indexer; import edu.tamu.scholars.middleware.discovery.model.AbstractIndexDocument; +import edu.tamu.scholars.middleware.discovery.model.Individual; public class SolrIndexer implements Indexer { @@ -43,22 +44,22 @@ public SolrIndexer(Class type) { @Override public void init() { for (Field field : FieldUtils.getFieldsListWithAnnotation(type, FieldType.class)) { - FieldType indexed = field.getAnnotation(FieldType.class); + FieldType fieldType = field.getAnnotation(FieldType.class); - String name = StringUtils.isNotEmpty(indexed.value()) - ? indexed.value() + String name = StringUtils.isNotEmpty(fieldType.value()) + ? fieldType.value() : field.getName(); - if (!indexed.readonly() && !CREATED_FIELDS.contains(name) && CREATED_FIELDS.add(name)) { + if (!fieldType.readonly() && !CREATED_FIELDS.contains(name) && CREATED_FIELDS.add(name)) { Map fieldAttributes = new HashMap(); - fieldAttributes.put("type", indexed.type()); - fieldAttributes.put("stored", indexed.stored()); - fieldAttributes.put("indexed", indexed.searchable()); - fieldAttributes.put("required", indexed.required()); + fieldAttributes.put("type", fieldType.type()); + fieldAttributes.put("stored", fieldType.stored()); + fieldAttributes.put("indexed", fieldType.searchable()); + fieldAttributes.put("required", fieldType.required()); - if (StringUtils.isNotEmpty(indexed.defaultValue())) { - fieldAttributes.put("defaultValue", indexed.defaultValue()); + if (StringUtils.isNotEmpty(fieldType.defaultValue())) { + fieldAttributes.put("defaultValue", fieldType.defaultValue()); } fieldAttributes.put("multiValued", Collection.class.isAssignableFrom(field.getType())); @@ -72,9 +73,9 @@ public void init() { logger.debug("Failed to add field", e); } - if (indexed.copyTo().length > 0) { + if (fieldType.copyTo().length > 0) { try { - SchemaRequest.AddCopyField addCopyFieldRequest = new SchemaRequest.AddCopyField(name, Arrays.asList(indexed.copyTo())); + SchemaRequest.AddCopyField addCopyFieldRequest = new SchemaRequest.AddCopyField(name, Arrays.asList(fieldType.copyTo())); addCopyFieldRequest.process(solrClient, collectionName); } catch (Exception e) { logger.debug("Failed to add copy field", e); @@ -85,29 +86,31 @@ public void init() { } @Override - public void index(Collection documents) { + public void index(Collection individuals) { try { - solrClient.addBeans(collectionName, documents); + solrClient.addBeans(collectionName, individuals); solrClient.commit(collectionName); - logger.info(String.format("Saved %s batch of %s", name(), documents.size())); + logger.info("Saved {} batch of {}", name(), individuals.size()); } catch (Exception e) { + logger.debug("Error saving batch", e); if (enableIndividualOnBatchFail) { - logger.warn(String.format("Failed to save batch of %s. Attempting individually.", name()), e); - documents.stream().forEach(this::index); + logger.warn("Failed to save batch of {}. Attempting individually.", name()); + individuals.stream().forEach(this::index); } else { - logger.warn("Skipping individuals of failed batch of {}.", name() ); + logger.warn("Skipping individuals of failed batch of {}. {}", name(), e.getMessage()); } } } @Override - public void index(AbstractIndexDocument document) { + public void index(Individual individual) { try { - solrClient.addBean(collectionName, document); + solrClient.addBean(collectionName, individual); solrClient.commit(collectionName); - logger.info(String.format("Saved %s with id %s", name(), document.getId())); + logger.info("Saved {} with id {}", name(), individual.getId()); } catch (Exception e) { - logger.warn(String.format("Failed to save %s with id %s", name(), document.getId()), e); + logger.debug("Error saving individual", e); + logger.warn("Failed to save {} with id {}", name(), individual.getId()); } } @@ -116,7 +119,8 @@ public void optimize() { try { solrClient.optimize(collectionName); } catch (Exception e) { - logger.warn(String.format("Failed to optimize index"), e); + logger.debug("Error optimizing collection", e); + logger.warn("Failed to optimize collection. {}", e.getMessage()); } } diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/indicator/IndexHealthIndicator.java b/src/main/java/edu/tamu/scholars/middleware/discovery/indicator/IndexHealthIndicator.java index 3553158c2..ce21c9d6f 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/indicator/IndexHealthIndicator.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/indicator/IndexHealthIndicator.java @@ -19,7 +19,6 @@ import edu.tamu.scholars.middleware.config.model.IndexConfig; import edu.tamu.scholars.middleware.discovery.model.repo.IndividualRepo; -import edu.tamu.scholars.middleware.discovery.service.IndexService; @Component("index") @Profile("!test") @@ -32,9 +31,6 @@ public class IndexHealthIndicator implements HealthIndicator { @Autowired private IndividualRepo individualRepo; - @Autowired - private IndexService indexService; - @Autowired private IndexConfig index; diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/model/AbstractIndexDocument.java b/src/main/java/edu/tamu/scholars/middleware/discovery/model/AbstractIndexDocument.java index 3331530d8..d7e22af1b 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/model/AbstractIndexDocument.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/model/AbstractIndexDocument.java @@ -1,10 +1,10 @@ package edu.tamu.scholars.middleware.discovery.model; +import static edu.tamu.scholars.middleware.discovery.DiscoveryConstants.CLASS; + import java.util.ArrayList; import java.util.List; -import org.apache.solr.client.solrj.beans.Field; - import com.fasterxml.jackson.annotation.JsonProperty; import edu.tamu.scholars.middleware.discovery.annotation.FieldSource; @@ -12,37 +12,33 @@ public abstract class AbstractIndexDocument { - @Field + @JsonProperty(CLASS) + private String proxy; + @FieldType(required = true, readonly = true) private String id; - @JsonProperty("class") - @Field("class") - private String clazz = this.getClass().getSimpleName(); - - @Field @FieldType(type = "whole_strings") @FieldSource(template = "common/type", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) private List type; - @Field @FieldType(type = "strings") private List syncIds = new ArrayList<>(); - public String getId() { - return id; + public String getProxy() { + return proxy; } - public void setId(String id) { - this.id = id; + public void setProxy(String proxy) { + this.proxy = proxy; } - public String getClazz() { - return clazz; + public String getId() { + return id; } - public void setClazz(String clazz) { - this.clazz = clazz; + public void setId(String id) { + this.id = id; } public List getType() { diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/model/Collection.java b/src/main/java/edu/tamu/scholars/middleware/discovery/model/Collection.java index 9a844172d..15c34dc38 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/model/Collection.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/model/Collection.java @@ -1,11 +1,10 @@ package edu.tamu.scholars.middleware.discovery.model; import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_EMPTY; +import static edu.tamu.scholars.middleware.discovery.DiscoveryConstants.ABSTRACT; import java.util.List; -import org.apache.solr.client.solrj.beans.Field; - import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; @@ -19,124 +18,102 @@ @CollectionSource(name = "collections", predicate = "http://purl.org/ontology/bibo/Collection") public class Collection extends Common { - @Field @FieldType(type = "tokenized_string", copyTo = { "_text_", "name_sort" }) @FieldSource(template = "collection/name", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private String name; - @Field("abstract") - @JsonProperty("abstract") - @FieldType(type = "tokenized_string", value = "abstract", copyTo = "_text_") + @JsonProperty(ABSTRACT) + @FieldType(type = "tokenized_string", value = ABSTRACT, copyTo = "_text_") @FieldSource(template = "collection/abstract", predicate = "http://purl.org/ontology/bibo/abstract") private String abstractText; - @Field @FieldType(type = "whole_string") @FieldSource(template = "collection/abbreviation", predicate = "http://vivoweb.org/ontology/core#abbreviation") private String abbreviation; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "collection/publicationVenueFor", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List publicationVenueFor; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "collection/editor", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List editors; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "collection/translator", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List translators; - @Field @FieldType(type = "pdate", searchable = false) @FieldSource(template = "collection/publicationDate", predicate = "http://vivoweb.org/ontology/core#dateTime") private String publicationDate; - @Field @FieldType(type = "nested_whole_string") @NestedObject(properties = { @Reference(value = "publisherType", key = "type") }) @FieldSource(template = "collection/publisher", predicate = "http://www.w3.org/2000/01/rdf-schema#label", unique = true) private String publisher; - @Field @FieldType(type = "nested_whole_string") @FieldSource(template = "collection/publisherType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) private String publisherType; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "collection/hasSubjectArea", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List subjectAreas; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "collection/feature", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List features; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "collection/outputOfProcessOrEvent", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List outputOfProcessOrEvent; - @Field @FieldType(type = "whole_strings", copyTo = "_text_") @FieldSource(template = "collection/keyword", predicate = "http://vivoweb.org/ontology/core#freetextKeyword") private List keywords; - @Field @FieldType(type = "whole_string") @FieldSource(template = "collection/issn", predicate = "http://purl.org/ontology/bibo/issn") private String issn; - @Field @FieldType(type = "whole_string") @FieldSource(template = "collection/eissn", predicate = "http://purl.org/ontology/bibo/eissn") private String eissn; - @Field @FieldType(type = "whole_string") @FieldSource(template = "collection/doi", predicate = "http://purl.org/ontology/bibo/doi") private String doi; - @Field @FieldType(type = "whole_string") @FieldSource(template = "collection/oclcnum", predicate = "http://purl.org/ontology/bibo/oclcnum") private String oclcnum; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "collection/isAbout", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List isAbout; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "collection/specifiedOutputOf", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List specifiedOutputOf; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "collection/mention", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List mentions; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "collection/participatesIn", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List participatesIn; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "collection/supportedBy", predicate = "http://www.w3.org/2000/01/rdf-schema#label") diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/model/Common.java b/src/main/java/edu/tamu/scholars/middleware/discovery/model/Common.java index a4f583945..1b842a33c 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/model/Common.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/model/Common.java @@ -2,49 +2,40 @@ import java.util.List; -import org.apache.solr.client.solrj.beans.Field; - -import edu.tamu.scholars.middleware.discovery.annotation.NestedObject; -import edu.tamu.scholars.middleware.discovery.annotation.NestedObject.Reference; import edu.tamu.scholars.middleware.discovery.annotation.FieldSource; import edu.tamu.scholars.middleware.discovery.annotation.FieldType; +import edu.tamu.scholars.middleware.discovery.annotation.NestedObject; +import edu.tamu.scholars.middleware.discovery.annotation.NestedObject.Reference; public class Common extends AbstractIndexDocument { - @Field @FieldType(type = "whole_string", searchable = false) @FieldSource(template = "common/image", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/public#directDownloadUrl") private String image; - @Field @FieldType(type = "whole_string", searchable = false) @FieldSource(template = "common/thumbnail", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/public#directDownloadUrl") private String thumbnail; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @NestedObject(properties = { @Reference(value = "websiteUrl", key = "url") }) @FieldSource(template = "common/website", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List websites; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "common/websiteUrl", predicate = "http://www.w3.org/2006/vcard/ns#url") private List websiteUrl; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "common/geographicFocus", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List geographicFocus; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "common/sameAs", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List sameAs; - @Field @FieldType(type = "pdate") @FieldSource(template = "common/modTime", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#modTime") private String modTime; diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/model/Concept.java b/src/main/java/edu/tamu/scholars/middleware/discovery/model/Concept.java index 661521346..c013b93a7 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/model/Concept.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/model/Concept.java @@ -4,8 +4,6 @@ import java.util.List; -import org.apache.solr.client.solrj.beans.Field; - import com.fasterxml.jackson.annotation.JsonInclude; import edu.tamu.scholars.middleware.discovery.annotation.CollectionSource; @@ -19,118 +17,97 @@ @CollectionSource(name = "concepts", predicate = "http://www.w3.org/2004/02/skos/core#Concept") public class Concept extends Common { - @Field @FieldType(type = "tokenized_string", copyTo = { "_text_", "name_sort" }) @FieldSource(template = "concept/name", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private String name; - @Field @NestedObject @FieldType(type = "nested_whole_strings") @FieldSource(template = "concept/associatedDepartment", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List associatedDepartments; - @Field @NestedObject @FieldType(type = "nested_whole_strings", copyTo = "_text_") @FieldSource(template = "concept/researchAreaOf", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List researchAreaOf; - @Field @FieldType(type = "nested_whole_strings", copyTo = "_text_") @NestedObject(properties = { @Reference(value = "awardOrHonorForType", key = "type") }) @FieldSource(template = "concept/awardOrHonorFor", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List awardOrHonorFor; - @Field @FieldType(type = "nested_whole_strings") @FieldSource(template = "concept/awardOrHonorForType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) private List awardOrHonorForType; - @Field @FieldType(type = "nested_tokenized_strings", copyTo = { "_text_", "awardConferredBy_nested_facets" }) @NestedObject(properties = { @Reference(value = "awardConferredByType", key = "type") }) @FieldSource(template = "concept/awardConferredBy", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List awardConferredBy; - @Field @FieldType(type = "nested_whole_strings") @FieldSource(template = "concept/awardConferredByType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) private List awardConferredByType; - @Field @FieldType(type = "whole_strings", copyTo = "_text_") @FieldSource(template = "concept/awardConferredByPreferredLabel", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#awardConferredBy_label") private List awardConferredByPreferredLabel; - @Field @FieldType(type = "pdate") @FieldSource(template = "concept/yearAwarded", predicate = "http://vivoweb.org/ontology/core#dateTime") private String yearAwarded; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @NestedObject(properties = { @Reference(value = "receiptRecipientName", key = "recipientName") }) @FieldSource(template = "concept/receipts", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List receipts; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "concept/receiptRecipientName", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List receiptRecipientName; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "concept/broaderConcept", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List broaderConcepts; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "concept/narrowerConcept", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List narrowerConcepts; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "concept/relatedConcept", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List relatedConcepts; - @Field @FieldType(type = "nested_tokenized_string", copyTo = { "_text_", "futureResearchIdeaOf_nested_facets" }) @NestedObject(properties = { @Reference(value = "futureResearchIdeaOfEmail", key = "email"), @Reference(value = "futureResearchIdeaOfTitle", key = "title"), @Reference(value = "futureResearchIdeaOfOrganization", key = "organizations") }) @FieldSource(template = "concept/futureResearchIdeaOf", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private String futureResearchIdeaOf; - @Field @FieldType(type = "nested_whole_string") @FieldSource(template = "concept/futureResearchIdeaOfEmail", predicate = "http://www.w3.org/2006/vcard/ns#email") private String futureResearchIdeaOfEmail; - @Field @FieldType(type = "nested_whole_string") @FieldSource(template = "concept/futureResearchIdeaOfTitle", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private String futureResearchIdeaOfTitle; - @Field @NestedMultiValuedProperty @NestedObject(root = false) @FieldType(type = "nested_whole_strings") @FieldSource(template = "concept/futureResearchIdeaOfOrganization", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List futureResearchIdeaOfOrganization; - @Field @FieldType(type = "whole_strings", copyTo = "_text_") @FieldSource(template = "concept/keyword", predicate = "http://vivoweb.org/ontology/core#freetextKeyword") private List keywords; - @Field @FieldType(type = "tokenized_string", copyTo = "_text_") @FieldSource(template = "concept/description", predicate = "http://vivoweb.org/ontology/core#description") private String description; - @Field @FieldType(type = "pdate") @FieldSource(template = "concept/createdDate", predicate = "http://vivoweb.org/ontology/core#dateTime") private String createdDate; diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/model/Document.java b/src/main/java/edu/tamu/scholars/middleware/discovery/model/Document.java index 3e3953881..857fbef75 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/model/Document.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/model/Document.java @@ -1,11 +1,10 @@ package edu.tamu.scholars.middleware.discovery.model; import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_EMPTY; +import static edu.tamu.scholars.middleware.discovery.DiscoveryConstants.ABSTRACT; import java.util.List; -import org.apache.solr.client.solrj.beans.Field; - import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; @@ -20,424 +19,346 @@ @CollectionSource(name = "documents", predicate = "http://purl.org/ontology/bibo/Document") public class Document extends Common { - @Field @FieldType(type = "tokenized_string", copyTo = { "_text_", "title_sort" }) @FieldSource(template = "document/title", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private String title; - @Field("abstract") - @JsonProperty("abstract") - @FieldType(type = "tokenized_string", value = "abstract", copyTo = "_text_") + @JsonProperty(ABSTRACT) + @FieldType(type = "tokenized_string", value = ABSTRACT, copyTo = "_text_") @FieldSource(template = "document/abstract", predicate = "http://purl.org/ontology/bibo/abstract") private String abstractText; - @Field @FieldType(type = "whole_string", copyTo = "_text_") @FieldSource(template = "document/abbreviation", predicate = "http://vivoweb.org/ontology/core#abbreviation") private String abbreviation; - @Field @NestedObject @FieldType(type = "nested_whole_string", copyTo = "_text_") @FieldSource(template = "document/publicationVenue", predicate = "http://www.w3.org/2000/01/rdf-schema#label", unique = true) private String publicationVenue; - @Field @NestedObject @FieldType(type = "nested_whole_string", searchable = false) @FieldSource(template = "document/hasPublicationVenueFor", predicate = "http://www.w3.org/2000/01/rdf-schema#label", unique = true) private String hasPublicationVenueFor; - @Field @FieldType(type = "whole_string", copyTo = "_text_") @FieldSource(template = "document/publicationOutlet", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#publishedProceedings", unique = true) private String publicationOutlet; - @Field @FieldType(type = "whole_string", copyTo = "_text_") @FieldSource(template = "document/nameOfConference", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#nameOfConference", unique = true) private String nameOfConference; - @Field @FieldType(type = "nested_whole_strings", copyTo = "_text_") @NestedObject(properties = { @Reference(value = "authorOrganization", key = "organizations") }) @FieldSource(template = "document/author", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List authors; - @Field @NestedMultiValuedProperty @NestedObject(root = false) @FieldType(type = "nested_whole_strings") @FieldSource(template = "document/authorOrganization", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List authorOrganization; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "document/editor", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List editors; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "document/translator", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List translators; - @Field @FieldType(type = "whole_string", searchable = false) @FieldSource(template = "document/status", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private String status; - @Field @FieldType(type = "pdate") @FieldSource(template = "document/publicationDate", predicate = "http://vivoweb.org/ontology/core#dateTime") private String publicationDate; - @Field @FieldType(type = "nested_whole_string") @NestedObject(properties = { @Reference(value = "publisherType", key = "type") }) @FieldSource(template = "document/publisher", predicate = "http://www.w3.org/2000/01/rdf-schema#label", unique = true) private String publisher; - @Field @FieldType(type = "nested_whole_string") @FieldSource(template = "document/publisherType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) private String publisherType; - @Field @FieldType(type = "pdate", searchable = false) @FieldSource(template = "document/dateFiled", predicate = "http://vivoweb.org/ontology/core#dateTime") private String dateFiled; - @Field @FieldType(type = "pdate", searchable = false) @FieldSource(template = "document/dateIssued", predicate = "http://vivoweb.org/ontology/core#dateTime") private String dateIssued; - @Field @NestedObject @FieldType(type = "nested_whole_strings") @FieldSource(template = "document/hasSubjectArea", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List subjectAreas; - @Field @FieldType(type = "whole_strings", searchable = false) @FieldSource(template = "document/hasRestriction", predicate = "http://purl.obolibrary.org/obo/ERO_0000045") private List restrictions; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "document/documentPart", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List documentParts; - @Field @FieldType(type = "whole_string", searchable = false) @FieldSource(template = "document/chapter", predicate = "http://purl.org/ontology/bibo/chapter") private String chapter; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "document/feature", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List features; - @Field @FieldType(type = "whole_string", searchable = false) @FieldSource(template = "document/edition", predicate = "http://purl.org/ontology/bibo/edition") private String edition; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "document/documentationForProjectOrResource", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List documentationForProjectOrResource; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "document/outputOfProcessOrEvent", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List outputOfProcessOrEvent; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "document/presentedAt", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List presentedAt; - @Field @FieldType(type = "whole_strings", copyTo = "_text_") @FieldSource(template = "document/keyword", predicate = "http://vivoweb.org/ontology/core#freetextKeyword") private List keywords; - @Field @FieldType(type = "whole_string") @FieldSource(template = "document/eanucc13", predicate = "http://purl.org/ontology/bibo/eanucc13") private String eanucc13; - @Field @FieldType(type = "whole_string") @FieldSource(template = "document/nihmsid", predicate = "http://vivoweb.org/ontology/core#nihmsid") private String nihmsid; - @Field @FieldType(type = "whole_string") @FieldSource(template = "document/pmcid", predicate = "http://vivoweb.org/ontology/core#pmcid") private String pmcid; - @Field @FieldType(type = "whole_string") @FieldSource(template = "document/identifier", predicate = "http://purl.org/ontology/bibo/identifier") private String identifier; - @Field @FieldType(type = "whole_string") @FieldSource(template = "document/patentNumber", predicate = "http://vivoweb.org/ontology/core#patentNumber") private String patentNumber; - @Field @FieldType(type = "whole_string") @FieldSource(template = "document/doi", predicate = "http://purl.org/ontology/bibo/doi") private String doi; - @Field @FieldType(type = "whole_string") @FieldSource(template = "document/oclcnum", predicate = "http://purl.org/ontology/bibo/oclcnum") private String oclcnum; - @Field @FieldType(type = "whole_string") @FieldSource(template = "document/isbn10", predicate = "http://purl.org/ontology/bibo/isbn10") private String isbn10; - @Field @FieldType(type = "whole_string") @FieldSource(template = "document/isbn13", predicate = "http://purl.org/ontology/bibo/isbn13") private String isbn13; - @Field @FieldType(type = "whole_string") @FieldSource(template = "document/pmid", predicate = "http://purl.org/ontology/bibo/pmid") private String pmid; - @Field @FieldType(type = "whole_string") @FieldSource(template = "document/lccn", predicate = "http://purl.org/ontology/bibo/lccn") private String lccn; - @Field @FieldType(type = "whole_string") @FieldSource(template = "document/issn", predicate = "http://purl.org/ontology/bibo/issn") private String issn; - @Field @FieldType(type = "whole_string") @FieldSource(template = "document/eissn", predicate = "http://purl.org/ontology/bibo/eissn") private String eissn; - @Field @FieldType(type = "whole_string") @FieldSource(template = "document/uri", predicate = "http://purl.org/ontology/bibo/uri") private String uri; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "document/citedBy", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List citedBy; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "document/cites", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List cites; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "document/citesAsDataSource", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List citesAsDataSource; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "document/hasTranslation", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List translations; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "document/translationOf", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List translationOf; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "document/globalCitationFrequency", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List globalCitationFrequency; - @Field @FieldType(type = "whole_string", searchable = false) @FieldSource(template = "document/iclCode", predicate = "http://vivoweb.org/ontology/core#iclCode") private String iclCode; - @Field @FieldType(type = "pint") @FieldSource(template = "document/numberOfPages", predicate = "http://purl.org/ontology/bibo/numPages") private Integer numberOfPages; - @Field @FieldType(type = "whole_string", searchable = false) @FieldSource(template = "document/pageStart", predicate = "http://purl.org/ontology/bibo/pageStart") private String pageStart; - @Field @FieldType(type = "whole_string", searchable = false) @FieldSource(template = "document/pageEnd", predicate = "http://purl.org/ontology/bibo/pageEnd") private String pageEnd; - @Field @FieldType(type = "whole_string", searchable = false) @FieldSource(template = "document/number", predicate = "http://purl.org/ontology/bibo/number") private String number; - @Field @FieldType(type = "whole_string", searchable = false) @FieldSource(template = "document/volume", predicate = "http://purl.org/ontology/bibo/volume") private String volume; - @Field @FieldType(type = "whole_string", searchable = false) @FieldSource(template = "document/issue", predicate = "http://purl.org/ontology/bibo/issue") private String issue; - @Field @FieldType(type = "whole_string", searchable = false) @FieldSource(template = "document/placeOfPublication", predicate = "http://vivoweb.org/ontology/core#placeOfPublication") private String placeOfPublication; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "document/assignee", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List assignees; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "document/reproducedIn", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List reproducedIn; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "document/reproduces", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List reproduces; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "document/isAbout", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List isAbout; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "document/specifiedOutputOf", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List specifiedOutputOf; - @Field @FieldType(type = "whole_string", searchable = false) @FieldSource(template = "document/isTemplate", predicate = "http://purl.obolibrary.org/obo/ARG_0000001") private String isTemplate; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "document/mention", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List mentions; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "document/participatesIn", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List participatesIn; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "document/supportedBy", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List supportedBy; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "document/receipt", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List receipts; - @Field @FieldType(type = "pfloat") @FieldSource(template = "document/altmetricScore", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#AltmetricScore") private Float altmetricScore; - @Field @FieldType(type = "pint") @FieldSource(template = "document/citationCount", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#CitationCount") private Integer citationCount; - @Field @FieldType(type = "whole_strings") @FieldSource(template = "document/tag", predicate = "http://purl.obolibrary.org/obo/ARG_0000015") private List tags; - @Field @FieldType(type = "whole_string") @FieldSource(template = "document/note", predicate = "http://www.w3.org/2006/vcard/ns#note") private String note; - @Field @FieldType(type = "whole_string") @FieldSource(template = "document/key", predicate = "http://www.w3.org/2006/vcard/ns#key") private String key; - @Field @FieldType(type = "whole_string") @FieldSource(template = "document/url", predicate = "http://www.w3.org/2006/vcard/ns#url") private String url; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "document/etdChairedBy", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List etdChairedBy; - @Field @NestedObject @FieldType(type = "nested_whole_strings") @FieldSource(template = "document/advisedBy", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List advisedBy; - @Field @FieldType(type = "whole_strings") @FieldSource(template = "document/completeAuthorList", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#completeAuthorList", split = true) private List completeAuthorList; - @Field @FieldType(type = "whole_strings") @FieldSource(template = "document/authorList", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#fullAuthorList") private List authorList; - @Field @FieldType(type = "whole_strings", searchable = false) @FieldSource(template = "document/editorList", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#fullEditorList") private List editorList; - @Field @FieldType(type = "tokenized_string", copyTo = "_text_") @FieldSource(template = "document/bookTitle", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#bookTitleForChapter") private String bookTitle; - @Field @FieldType(type = "whole_string") @FieldSource(template = "document/newsOutlet", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#NewsOutlet") private String newsOutlet; diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/model/Individual.java b/src/main/java/edu/tamu/scholars/middleware/discovery/model/Individual.java index 41215835d..52f6169f5 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/model/Individual.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/model/Individual.java @@ -1,32 +1,119 @@ package edu.tamu.scholars.middleware.discovery.model; import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_EMPTY; +import static edu.tamu.scholars.middleware.discovery.DiscoveryConstants.CLASS; +import static edu.tamu.scholars.middleware.discovery.DiscoveryConstants.ID; +import static edu.tamu.scholars.middleware.discovery.DiscoveryConstants.SYNC_IDS; +import static edu.tamu.scholars.middleware.discovery.DiscoveryConstants.TYPE; import java.util.Collection; +import java.util.HashMap; +import java.util.List; import java.util.Map; +import java.util.stream.Collectors; +import org.apache.lucene.document.StoredField; import org.apache.solr.client.solrj.beans.Field; +import org.apache.solr.common.SolrDocument; import org.springframework.hateoas.server.core.Relation; import com.fasterxml.jackson.annotation.JsonInclude; +import edu.tamu.scholars.middleware.discovery.utility.DiscoveryUtility; + @JsonInclude(NON_EMPTY) @Relation(collectionRelation = "individual", itemRelation = "individual") public class Individual extends AbstractIndexDocument { @Field("*") - private Map> content; + private final Map content; public Individual() { + this(new HashMap<>()); + } + private Individual(Map content) { + this.content = content; } - public Map> getContent() { + public Map getContent() { return content; } - public void setContent(Map> content) { - this.content = content; + public String getProxy() { + return (String) content.get(CLASS); + } + + public void setProxy(String proxy) { + this.content.put(CLASS, proxy); + } + + @Override + public String getId() { + return (String) content.get(ID); + } + + @Override + public void setId(String id) { + this.content.put(ID, id); + } + + @Override + @SuppressWarnings("unchecked") + public List getType() { + return (List) content.get(TYPE); + } + + @Override + public void setType(List type) { + this.content.put(TYPE, type); + } + + @Override + @SuppressWarnings("unchecked") + public List getSyncIds() { + return (List) content.get(SYNC_IDS); + } + + @Override + public void setSyncIds(List syncIds) { + this.content.put(SYNC_IDS, syncIds); + } + + public static Individual from(SolrDocument document) { + Map content = new HashMap<>(); + + String name = (String) normalize(document.getFieldValue(CLASS)); + + DiscoveryUtility.getDiscoveryDocumentTypeFields(name) + .entrySet() + .stream() + .filter(entry -> document.containsKey(entry.getKey())) + .forEach(entry -> { + String field = entry.getKey(); + if (Collection.class.isAssignableFrom(entry.getValue())) { + Collection values = document.getFieldValues(field) + .stream() + .map(Individual::normalize) + .collect(Collectors.toList()); + content.put(field, values); + } else { + content.put(field, normalize(document.getFirstValue(field))); + } + }); + + return Individual.from(content); + } + + public static Object normalize(Object value) { + if (StoredField.class.isAssignableFrom(value.getClass())) { + return ((StoredField) value).stringValue(); + } + return value; + } + + public static Individual from(Map content) { + return new Individual(content); } } diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/model/Organization.java b/src/main/java/edu/tamu/scholars/middleware/discovery/model/Organization.java index 8a8c877dd..aa88567cb 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/model/Organization.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/model/Organization.java @@ -4,8 +4,6 @@ import java.util.List; -import org.apache.solr.client.solrj.beans.Field; - import com.fasterxml.jackson.annotation.JsonInclude; import edu.tamu.scholars.middleware.discovery.annotation.CollectionSource; @@ -18,332 +16,273 @@ @CollectionSource(name = "organizations", predicate = "http://xmlns.com/foaf/0.1/Organization") public class Organization extends Common { - @Field @FieldType(type = "tokenized_string", copyTo = { "_text_", "name_sort" }) @FieldSource(template = "organization/name", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private String name; - @Field @FieldType(type = "tokenized_string", copyTo = "_text_") @FieldSource(template = "organization/overview", predicate = "http://vivoweb.org/ontology/core#overview") private String overview; - @Field @NestedObject @FieldType(type = "nested_whole_strings", copyTo = "_text_") @FieldSource(template = "organization/offersDegree", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List degrees; - @Field @FieldType(type = "whole_string", copyTo = "_text_") @FieldSource(template = "organization/abbreviation", predicate = "http://vivoweb.org/ontology/core#abbreviation") private String abbreviation; - @Field @FieldType(type = "pdate", searchable = false) @FieldSource(template = "organization/date", predicate = "http://vivoweb.org/ontology/core#dateTime") private String date; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "organization/sponsorsAwardOrHonor", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List sponsorsAwardOrHonor; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "organization/awardOrHonorGiven", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List awardOrHonorGiven; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "organization/awardOrHonorReceived", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List awardOrHonorReceived; - @Field @FieldType(type = "whole_strings", copyTo = "_text_") @FieldSource(template = "organization/keyword", predicate = "http://vivoweb.org/ontology/core#freetextKeyword") private List keywords; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @NestedObject(properties = { @Reference(value = "organizationForTrainingTrainee", key = "trainee"), @Reference(value = "organizationForTrainingDegree", key = "degree"), @Reference(value = "organizationForTrainingStartDate", key = "startDate"), @Reference(value = "organizationForTrainingEndDate", key = "endDate") }) @FieldSource(template = "organization/organizationForTraining", predicate = "http://vivoweb.org/ontology/core#majorField") private List organizationForTraining; - @Field @NestedObject(root = false) @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "organization/organizationForTrainingTrainee", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List organizationForTrainingTrainee; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "organization/organizationForTrainingDegree", predicate = "http://vivoweb.org/ontology/core#abbreviation") private List organizationForTrainingDegree; - @Field @FieldType(type = "nested_dates", searchable = false) @FieldSource(template = "organization/organizationForTrainingStartDate", predicate = "http://vivoweb.org/ontology/core#dateTime") private List organizationForTrainingStartDate; - @Field @FieldType(type = "nested_dates", searchable = false) @FieldSource(template = "organization/organizationForTrainingEndDate", predicate = "http://vivoweb.org/ontology/core#dateTime") private List organizationForTrainingEndDate; - @Field @FieldType(type = "nested_whole_strings") @NestedObject(properties = { @Reference(value = "peopleType", key = "type"), @Reference(value = "peopleTitle", key = "title") }) @FieldSource(template = "organization/people", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List people; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "organization/peopleType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) private List peopleType; - @Field @FieldType(type = "nested_whole_strings") @FieldSource(template = "organization/peopleTitle", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List peopleTitle; - @Field @NestedObject(properties = { @Reference(value = "hasSubOrganizationType", key = "type") }) @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "organization/hasSubOrganization", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List hasSubOrganizations; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "organization/hasSubOrganizationType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) private List hasSubOrganizationType; - @Field @NestedObject @FieldType(type = "nested_whole_strings") @FieldSource(template = "organization/organizationWithin", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List organizationWithin; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "organization/leadOrganizationOf", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List leadOrganizationOf; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "organization/hasCollaboratingOrganizationOrGroup", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List hasCollaboratingOrganizationOrGroup; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "organization/hasAffiliatedOrganization", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List hasAffiliatedOrganizations; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "organization/memberOf", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List memberOf; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "organization/clinicalActivity", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List clinicalActivities; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "organization/convenerOfEvent", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List convenerOfEvents; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "organization/attendedEvent", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List attendedEvents; - @Field @NestedObject @FieldType(type = "nested_tokenized_strings", copyTo = "_text_") @FieldSource(template = "organization/publication", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List publications; - @Field @NestedObject @FieldType(type = "nested_whole_strings") @FieldSource(template = "organization/publisherOf", predicate = "http://www.w3.org/2000/01/rdf-schema#label", unique = true) private List publisherOf; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "organization/presentation", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List presentations; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "organization/featuredIn", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List featuredIn; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "organization/assigneeForPatent", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List assigneeForPatent; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "organization/translatorOf", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List translatorOf; - @Field @FieldType(type = "nested_whole_strings") @NestedObject(properties = { @Reference(value = "awardsGrantDate", key = "date") }) @FieldSource(template = "organization/awardsGrant", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List awardsGrant; - @Field @FieldType(type = "nested_dates", searchable = false) @FieldSource(template = "organization/awardsGrantDate", predicate = "http://vivoweb.org/ontology/core#dateTime") private List awardsGrantDate; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @NestedObject(properties = { @Reference(value = "administersGrantDate", key = "date") }) @FieldSource(template = "organization/administersGrant", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List administersGrant; - @Field @FieldType(type = "nested_dates", searchable = false) @FieldSource(template = "organization/administersGrantDate", predicate = "http://vivoweb.org/ontology/core#dateTime") private List administersGrantDate; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @NestedObject(properties = { @Reference(value = "subcontractsGrantDate", key = "date") }) @FieldSource(template = "organization/subcontractsGrant", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List subcontractsGrant; - @Field @FieldType(type = "nested_dates", searchable = false) @FieldSource(template = "organization/subcontractsGrantDate", predicate = "http://vivoweb.org/ontology/core#dateTime") private List subcontractsGrantDate; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "organization/performsHumanStudy", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List performsHumanStudy; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "organization/contractOrProviderForService", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List contractOrProviderForService; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "organization/outreachAndCommunityServiceActivity", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List outreachAndCommunityServiceActivities; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "organization/hasEquipment", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List hasEquipment; - @Field @NestedObject @FieldType(type = "nested_whole_strings") @FieldSource(template = "organization/offersCourse", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List courses; - @Field @FieldType(type = "whole_string", searchable = false) @FieldSource(template = "organization/phone", predicate = "http://www.w3.org/2006/vcard/ns#telephone") private String phone; - @Field @FieldType(type = "whole_string", searchable = false) @FieldSource(template = "organization/fax", predicate = "http://www.w3.org/2006/vcard/ns#fax") private String fax; - @Field @FieldType(type = "whole_string", searchable = false) @FieldSource(template = "organization/emailAddress", predicate = "http://www.w3.org/2006/vcard/ns#email") private String emailAddress; - @Field @FieldType(type = "whole_string", searchable = false) @FieldSource(template = "organization/streetAddress", predicate = "organization.streetAddress") private String streetAddress; - @Field @FieldType(type = "whole_string", searchable = false) @FieldSource(template = "organization/locality", predicate = "organization.locality") private String locality; - @Field @FieldType(type = "whole_string", searchable = false) @FieldSource(template = "organization/region", predicate = "organization.region") private String region; - @Field @FieldType(type = "whole_string", searchable = false) @FieldSource(template = "organization/postalCode", predicate = "organization.postalCode") private String postalCode; - @Field @FieldType(type = "whole_string", searchable = false) @FieldSource(template = "organization/country", predicate = "organization.country") private String country; - @Field @FieldType(type = "whole_string", searchable = false) @FieldSource(template = "organization/geographicLocation", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private String geographicLocation; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "organization/locatedAtFacility", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List locatedAtFacilities; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "organization/predecessorOrganization", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List predecessorOrganizations; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "organization/successorOrganization", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List successorOrganizations; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "organization/governingAuthorityFor", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List governingAuthorityFor; - @Field @NestedObject @FieldType(type = "nested_whole_strings") @FieldSource(template = "organization/affiliatedResearchArea", predicate = "http://www.w3.org/2000/01/rdf-schema#label", unique = true) private List affiliatedResearchAreas; - @Field @FieldType(type = "whole_string", searchable = false) @FieldSource(template = "organization/orgId", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#OrgID") private String orgId; diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/model/Person.java b/src/main/java/edu/tamu/scholars/middleware/discovery/model/Person.java index bc19250fc..32069db84 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/model/Person.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/model/Person.java @@ -4,8 +4,6 @@ import java.util.List; -import org.apache.solr.client.solrj.beans.Field; - import com.fasterxml.jackson.annotation.JsonInclude; import edu.tamu.scholars.middleware.discovery.annotation.CollectionSource; @@ -19,861 +17,698 @@ @CollectionSource(name = "persons", predicate = "http://xmlns.com/foaf/0.1/Person") public class Person extends Common { - @Field @FieldType(type = "tokenized_string", copyTo = { "_text_", "name_sort" }) @FieldSource(template = "person/name", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private String name; - @Field @FieldType(type = "whole_string") @FieldSource(template = "person/primaryEmail", predicate = "http://www.w3.org/2006/vcard/ns#email") private String primaryEmail; - @Field @FieldType(type = "whole_strings", searchable = false) @FieldSource(template = "person/additionalEmail", predicate = "http://www.w3.org/2006/vcard/ns#email") private List additionalEmails; - @Field @FieldType(type = "whole_string", searchable = false) @FieldSource(template = "person/phone", predicate = "http://www.w3.org/2006/vcard/ns#telephone") private String phone; - @Field @FieldType(type = "whole_string") @FieldSource(template = "person/orcidId", predicate = "http://vivoweb.org/ontology/core#orcidId", parse = true) private String orcidId; - @Field @FieldType(type = "tokenized_string") @FieldSource(template = "person/preferredTitle", predicate = "http://www.w3.org/2006/vcard/ns#title") private String preferredTitle; - @Field @FieldType(type = "nested_whole_strings") @NestedObject(properties = { @Reference(value = "positionType", key = "type"), @Reference(value = "positionOrganization", key = "organizations") }) @FieldSource(template = "person/position", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List positions; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/positionType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) private List positionType; - @Field @NestedMultiValuedProperty @FieldType(type = "nested_whole_strings") @NestedObject(root = false, properties = { @Reference(value = "positionOrganizationParent", key = "parent") }) @FieldSource(template = "person/positionOrganization", predicate = "http://www.w3.org/2000/01/rdf-schema#label", unique = true) private List positionOrganization; - @Field @NestedMultiValuedProperty @NestedObject(root = false) @FieldType(type = "nested_whole_strings") @FieldSource(template = "person/positionOrganizationParent", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List positionOrganizationParent; - @Field @FieldType(type = "tokenized_string", copyTo = "_text_") @FieldSource(template = "person/overview", predicate = "http://vivoweb.org/ontology/core#overview") private String overview; - @Field @NestedObject @FieldType(type = "nested_tokenized_strings", copyTo = { "_text_", "researchAreas_nested_facets" }) @FieldSource(template = "person/researchArea", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List researchAreas; - @Field @FieldType(type = "whole_string") @FieldSource(template = "person/hrJobTitle", predicate = "http://vivoweb.org/ontology/core#hrJobTitle") private String hrJobTitle; - @Field @FieldType(type = "whole_strings") @FieldSource(template = "person/keyword", predicate = "http://vivoweb.org/ontology/core#freetextKeyword") private List keywords; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @NestedObject(properties = { @Reference(value = "headOfType", key = "type"), @Reference(value = "headOfOrganization", key = "organization"), @Reference(value = "headOfStartDate", key = "startDate"), @Reference(value = "headOfEndDate", key = "endDate") }) @FieldSource(template = "person/headOf", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List headOf; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/headOfType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) private List headOfType; - @Field @NestedObject(root = false) @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/headOfOrganization", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List headOfOrganization; - @Field @FieldType(type = "nested_dates", searchable = false) @FieldSource(template = "person/headOfStartDate", predicate = "http://vivoweb.org/ontology/core#dateTime") private List headOfStartDate; - @Field @FieldType(type = "nested_dates", searchable = false) @FieldSource(template = "person/headOfEndDate", predicate = "http://vivoweb.org/ontology/core#dateTime") private List headOfEndDate; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @NestedObject(properties = { @Reference(value = "memberOfType", key = "type"), @Reference(value = "memberOfOrganization", key = "organization"), @Reference(value = "memberOfStartDate", key = "startDate"), @Reference(value = "memberOfEndDate", key = "endDate") }) @FieldSource(template = "person/memberOf", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List memberOf; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/memberOfType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) private List memberOfType; - @Field @NestedObject(root = false) @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/memberOfOrganization", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List memberOfOrganization; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/memberOfStartDate", predicate = "http://vivoweb.org/ontology/core#dateTime") private List memberOfStartDate; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/memberOfEndDate", predicate = "http://vivoweb.org/ontology/core#dateTime") private List memberOfEndDate; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/hasCollaborator", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List hasCollaborator; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @NestedObject(properties = { @Reference(value = "clinicalActivityType", key = "type"), @Reference(value = "clinicalActivityRole", key = "role"), @Reference(value = "clinicalActivityStartDate", key = "startDate"), @Reference(value = "clinicalActivityEndDate", key = "endDate") }) @FieldSource(template = "person/clinicalActivity", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List clinicalActivities; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/clinicalActivityType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) private List clinicalActivityType; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/clinicalActivityRole", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List clinicalActivityRole; - @Field @FieldType(type = "nested_dates", searchable = false) @FieldSource(template = "person/clinicalActivityStartDate", predicate = "http://vivoweb.org/ontology/core#dateTime") private List clinicalActivityStartDate; - @Field @FieldType(type = "nested_dates", searchable = false) @FieldSource(template = "person/clinicalActivityEndDate", predicate = "http://vivoweb.org/ontology/core#dateTime") private List clinicalActivityEndDate; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @NestedObject(properties = { @Reference(value = "attendedEventType", key = "type"), @Reference(value = "attendedEventStartDate", key = "startDate"), @Reference(value = "attendedEventEndDate", key = "endDate") }) @FieldSource(template = "person/attendedEvent", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List attendedEvents; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/attendedEventType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) private List attendedEventType; - @Field @FieldType(type = "nested_dates", searchable = false) @FieldSource(template = "person/attendedEventStartDate", predicate = "http://vivoweb.org/ontology/core#dateTime") private List attendedEventStartDate; - @Field @FieldType(type = "nested_dates", searchable = false) @FieldSource(template = "person/attendedEventEndDate", predicate = "http://vivoweb.org/ontology/core#dateTime") private List attendedEventEndDate; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @NestedObject(properties = { @Reference(value = "educationAndTrainingName", key = "name"), @Reference(value = "educationAndTrainingInfo", key = "info"), @Reference(value = "educationAndTrainingOrganization", key = "organization"), @Reference(value = "educationAndTrainingMajorField", key = "field"), @Reference(value = "educationAndTrainingDegreeAbbreviation", key = "abbreviation"), @Reference(value = "educationAndTrainingStartDate", key = "startDate"), @Reference(value = "educationAndTrainingEndDate", key = "endDate"), @Reference(value = "educationAndTrainingIsDateSuppressed", key = "isDateSuppressed") }) @FieldSource(template = "person/educationAndTraining", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) private List educationAndTraining; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/educationAndTrainingName", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List educationAndTrainingName; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/educationAndTrainingInfo", predicate = "http://vivoweb.org/ontology/core#supplementalInformation") private List educationAndTrainingInfo; - @Field @NestedObject(root = false) @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/educationAndTrainingOrganization", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List educationAndTrainingOrganization; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/educationAndTrainingMajorField", predicate = "http://vivoweb.org/ontology/core#majorField") private List educationAndTrainingMajorField; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/educationAndTrainingDegreeAbbreviation", predicate = "http://vivoweb.org/ontology/core#abbreviation") private List educationAndTrainingDegreeAbbreviation; - @Field @FieldType(type = "nested_dates", searchable = false) @FieldSource(template = "person/educationAndTrainingStartDate", predicate = "http://vivoweb.org/ontology/core#dateTime") private List educationAndTrainingStartDate; - @Field @FieldType(type = "nested_dates", searchable = false) @FieldSource(template = "person/educationAndTrainingEndDate", predicate = "http://vivoweb.org/ontology/core#dateTime") private List educationAndTrainingEndDate; - @Field @FieldType(type="nested_whole_string", searchable = false) @FieldSource(template= "person/educationAndTrainingIsDateSuppressed", predicate = "http://vivoweb.org/ontology/core#supplementalInformation") private List educationAndTrainingIsDateSuppressed; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/credentials", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List credentials; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @NestedObject(properties = { @Reference(value = "credentialEligibilityAttainedType", key = "type") }) @FieldSource(template = "person/credentialEligibilityAttained", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List credentialEligibilityAttained; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/credentialEligibilityAttainedType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) private List credentialEligibilityAttainedType; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/awardAndHonor", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List awardsAndHonors; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @NestedObject(properties = { @Reference(value = "adviseeOfType", key = "type"), @Reference(value = "adviseeOfCandidacy", key = "candidacy"), @Reference(value = "adviseeOfStartDate", key = "startDate"), @Reference(value = "adviseeOfEndDate", key = "endDate") }) @FieldSource(template = "person/adviseeOf", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List adviseeOf; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/adviseeOfType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) private List adviseeOfType; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/adviseeOfCandidacy", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List adviseeOfCandidacy; - @Field @FieldType(type = "nested_dates", searchable = false) @FieldSource(template = "person/adviseeOfStartDate", predicate = "http://vivoweb.org/ontology/core#dateTime") private List adviseeOfStartDate; - @Field @FieldType(type = "nested_dates", searchable = false) @FieldSource(template = "person/adviseeOfEndDate", predicate = "http://vivoweb.org/ontology/core#dateTime") private List adviseeOfEndDate; - @Field @FieldType(type = "nested_tokenized_strings", copyTo = "_text_") @NestedObject(properties = { @Reference(value = "selectedPublicationType", key = "type"), @Reference(value = "selectedPublicationDate", key = "publicationDate"), @Reference(value = "selectedPublicationPublisher", key = "publisher"), @Reference(value = "selectedPublicationVenue", key = "venue"), @Reference(value = "selectedPublicationTag", key = "tags") }) @FieldSource(template = "person/selectedPublications", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List publications; - @Field @FieldType(type = "pdates") @FieldSource(template = "person/publicationDates", predicate = "http://vivoweb.org/ontology/core#dateTime") private List publicationDates; // duplicate of selectedPublicationDate without encoded reference to publication - @Field @FieldType(type = "nested_whole_strings") @FieldSource(template = "person/selectedPublicationType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) private List selectedPublicationType; - @Field @FieldType(type = "nested_dates") @FieldSource(template = "person/selectedPublicationDate", predicate = "http://vivoweb.org/ontology/core#dateTime") private List selectedPublicationDate; - @Field @FieldType(type = "nested_whole_strings") @FieldSource(template = "person/selectedPublicationPublisher", predicate = "http://www.w3.org/2000/01/rdf-schema#label", unique = true) private List selectedPublicationPublisher; - @Field @FieldType(type = "nested_whole_strings") @FieldSource(template = "person/selectedPublicationVenue", predicate = "http://www.w3.org/2000/01/rdf-schema#label", unique = true) private List selectedPublicationVenue; - @Field @FieldType(type = "nested_whole_strings") @FieldSource(template = "person/selectedPublicationTag", predicate = "http://purl.obolibrary.org/obo/ARG_0000015") private List selectedPublicationTag; - @Field @FieldType(type = "nested_tokenized_strings", copyTo = "_text_") @NestedObject(properties = { @Reference(value = "creativeWorkType", key = "type") }) @FieldSource(template = "person/creativeWorks", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List creativeWorks; - @Field @FieldType(type = "nested_whole_strings") @FieldSource(template = "person/creativeWorkType", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#subtype") private List creativeWorkType; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @NestedObject(properties = { @Reference(value = "collectionOrSeriesEditorForType", key = "type"), @Reference(value = "collectionOrSeriesEditorForRole", key = "role"), @Reference(value = "collectionOrSeriesEditorForStartDate", key = "startDate"), @Reference(value = "collectionOrSeriesEditorForEndDate", key = "endDate") }) @FieldSource(template = "person/collectionOrSeriesEditorFor", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List collectionOrSeriesEditorFor; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/collectionOrSeriesEditorForType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) private List collectionOrSeriesEditorForType; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/collectionOrSeriesEditorForRole", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List collectionOrSeriesEditorForRole; - @Field @FieldType(type = "nested_dates", searchable = false) @FieldSource(template = "person/collectionOrSeriesEditorForStartDate", predicate = "http://vivoweb.org/ontology/core#dateTime") private List collectionOrSeriesEditorForStartDate; - @Field @FieldType(type = "nested_dates", searchable = false) @FieldSource(template = "person/collectionOrSeriesEditorForEndDate", predicate = "http://vivoweb.org/ontology/core#dateTime") private List collectionOrSeriesEditorForEndDate; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @NestedObject(properties = { @Reference(value = "editorOfType", key = "type"), @Reference(value = "editorOfPublisher", key = "publisher"), @Reference(value = "editorOfPageStart", key = "pageStart"), @Reference(value = "editorOfPageEnd", key = "pageEnd"), @Reference(value = "editorOfDate", key = "date") }) @FieldSource(template = "person/editorOf", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List editorOf; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/editorOfType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) private List editorOfType; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/editorOfPublisher", predicate = "http://www.w3.org/2000/01/rdf-schema#label", unique = true) private List editorOfPublisher; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/editorOfPageStart", predicate = "http://purl.org/ontology/bibo/pageStart") private List editorOfPageStart; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/editorOfPageEnd", predicate = "http://purl.org/ontology/bibo/pageEnd") private List editorOfPageEnd; - @Field @FieldType(type = "nested_dates", searchable = false) @FieldSource(template = "person/editorOfDate", predicate = "http://vivoweb.org/ontology/core#dateTime") private List editorOfDate; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @NestedObject(properties = { @Reference(value = "presentationType", key = "type"), @Reference(value = "presentationRole", key = "role"), @Reference(value = "presentationEvent", key = "event"), @Reference(value = "presentationStartDate", key = "startDate"), @Reference(value = "presentationEndDate", key = "endDate") }) @FieldSource(template = "person/presentation", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List presentations; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/presentationType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) private List presentationType; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/presentationRole", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List presentationRole; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/presentationEvent", predicate = "http://www.w3.org/2000/01/rdf-schema#label", parse = true) private List presentationEvent; - @Field @FieldType(type = "nested_dates", searchable = false) @FieldSource(template = "person/presentationStartDate", predicate = "http://vivoweb.org/ontology/core#dateTime") private List presentationStartDate; - @Field @FieldType(type = "nested_dates", searchable = false) @FieldSource(template = "person/presentationEndDate", predicate = "http://vivoweb.org/ontology/core#dateTime") private List presentationEndDate; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/featuredIn", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List featuredIn; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/assigneeForPatent", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List assigneeForPatent; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/translatorOf", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List translatorOf; - @Field @FieldType(type = "tokenized_string") @FieldSource(template = "person/researchOverview", predicate = "http://vivoweb.org/ontology/core#researchOverview") private String researchOverview; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/principalInvestigatorOn", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List principalInvestigatorOn; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/coPrincipalInvestigatorOn", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List coPrincipalInvestigatorOn; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @NestedObject(properties = { @Reference(value = "researcherOnAwardedBy", key = "awardedBy"), @Reference(value = "researcherOnRole", key = "role"), @Reference(value = "researcherOnStartDate", key = "startDate"), @Reference(value = "researcherOnEndDate", key = "endDate") }) @FieldSource(template = "person/researcherOn", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List researcherOn; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @NestedObject(root = false, properties = { @Reference(value = "researcherOnAwardedByPreferredLabel", key = "preferredLabel") }) @FieldSource(template = "person/researcherOnAwardedBy", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List researcherOnAwardedBy; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/researcherOnAwardedByPreferredLabel", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#awardedBy_label") private List researcherOnAwardedByPreferredLabel; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/researcherOnRole", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) private List researcherOnRole; - @Field @FieldType(type = "nested_dates", searchable = false) @FieldSource(template = "person/researcherOnStartDate", predicate = "http://vivoweb.org/ontology/core#dateTime") private List researcherOnStartDate; - @Field @FieldType(type = "nested_dates", searchable = false) @FieldSource(template = "person/researcherOnEndDate", predicate = "http://vivoweb.org/ontology/core#dateTime") private List researcherOnEndDate; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @NestedObject(properties = { @Reference(value = "otherResearchActivityRole", key = "role"), @Reference(value = "otherResearchActivityStartDate", key = "startDate"), @Reference(value = "otherResearchActivityEndDate", key = "endDate") }) @FieldSource(template = "person/otherResearchActivity", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List otherResearchActivities; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/otherResearchActivityRole", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List otherResearchActivityRole; - @Field @FieldType(type = "nested_dates", searchable = false) @FieldSource(template = "person/otherResearchActivityStartDate", predicate = "http://vivoweb.org/ontology/core#dateTime") private List otherResearchActivityStartDate; - @Field @FieldType(type = "nested_dates", searchable = false) @FieldSource(template = "person/otherResearchActivityEndDate", predicate = "http://vivoweb.org/ontology/core#dateTime") private List otherResearchActivityEndDate; - @Field @FieldType(type = "tokenized_string") @FieldSource(template = "person/teachingOverview", predicate = "http://vivoweb.org/ontology/core#teachingOverview") private String teachingOverview; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @NestedObject(properties = { @Reference(value = "teachingActivityRole", key = "role") }) @FieldSource(template = "person/teachingActivity", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List teachingActivities; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/teachingActivityRole", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List teachingActivityRole; - @Field @NestedObject @FieldType(type = "nested_whole_strings") @FieldSource(template = "person/teachingMaterials", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List teachingMaterials; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @NestedObject(properties = { @Reference(value = "adviseeType", key = "type"), @Reference(value = "adviseeCandidacy", key = "candidacy"), @Reference(value = "adviseeStartDate", key = "startDate"), @Reference(value = "adviseeEndDate", key = "endDate") }) @FieldSource(template = "person/advisee", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List advisee; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/adviseeType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) private List adviseeType; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/adviseeCandidacy", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List adviseeCandidacy; - @Field @FieldType(type = "nested_dates", searchable = false) @FieldSource(template = "person/adviseeStartDate", predicate = "http://vivoweb.org/ontology/core#dateTime") private List adviseeStartDate; - @Field @FieldType(type = "nested_dates", searchable = false) @FieldSource(template = "person/adviseeEndDate", predicate = "http://vivoweb.org/ontology/core#dateTime") private List adviseeEndDate; - @Field @FieldType(type = "tokenized_string") @FieldSource(template = "person/outreachOverview", predicate = "http://vivoweb.org/ontology/core#outreachOverview") private String outreachOverview; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @NestedObject(properties = { @Reference(value = "reviewerOfType", key = "type"), @Reference(value = "reviewerOfStartDate", key = "startDate"), @Reference(value = "reviewerOfEndDate", key = "endDate") }) @FieldSource(template = "person/reviewerOf", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List reviewerOf; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/reviewerOfType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) private List reviewerOfType; - @Field @FieldType(type = "nested_dates", searchable = false) @FieldSource(template = "person/reviewerOfStartDate", predicate = "http://vivoweb.org/ontology/core#dateTime") private List reviewerOfStartDate; - @Field @FieldType(type = "nested_dates", searchable = false) @FieldSource(template = "person/reviewerOfEndDate", predicate = "http://vivoweb.org/ontology/core#dateTime") private List reviewerOfEndDate; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @NestedObject(properties = { @Reference(value = "contactOrProvidorForServiceType", key = "type") }) @FieldSource(template = "person/contactOrProvidorForService", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List contactOrProvidorForService; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/contactOrProvidorForServiceType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) private List contactOrProvidorForServiceType; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @NestedObject(properties = { @Reference(value = "organizerOfEventType", key = "type"), @Reference(value = "organizerOfEventStartDate", key = "startDate"), @Reference(value = "organizerOfEventEndDate", key = "endDate") }) @FieldSource(template = "person/organizerOfEvent", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List organizerOfEvent; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/organizerOfEventType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) private List organizerOfEventType; - @Field @FieldType(type = "nested_dates", searchable = false) @FieldSource(template = "person/organizerOfEventStartDate", predicate = "http://vivoweb.org/ontology/core#dateTime") private List organizerOfEventStartDate; - @Field @FieldType(type = "nested_dates", searchable = false) @FieldSource(template = "person/organizerOfEventEndDate", predicate = "http://vivoweb.org/ontology/core#dateTime") private List organizerOfEventEndDate; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @NestedObject(properties = { @Reference(value = "professionalServiceActivityType", key = "type"), @Reference(value = "professionalServiceActivityRole", key = "role"), @Reference(value = "professionalServiceActivityStartDate", key = "startDate"), @Reference(value = "professionalServiceActivityEndDate", key = "endDate") }) @FieldSource(template = "person/professionalServiceActivity", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List professionalServiceActivities; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/professionalServiceActivityRole", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List professionalServiceActivityRole; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/professionalServiceActivityType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) private List professionalServiceActivityType; - @Field @FieldType(type = "nested_dates", searchable = false) @FieldSource(template = "person/professionalServiceActivityStartDate", predicate = "http://vivoweb.org/ontology/core#dateTime") private List professionalServiceActivityStartDate; - @Field @FieldType(type = "nested_dates", searchable = false) @FieldSource(template = "person/professionalServiceActivityEndDate", predicate = "http://vivoweb.org/ontology/core#dateTime") private List professionalServiceActivityEndDate; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @NestedObject(properties = { @Reference(value = "outreachAndCommunityServiceActivityType", key = "type"), @Reference(value = "outreachAndCommunityServiceActivityRole", key = "role"), @Reference(value = "outreachAndCommunityServiceActivityStartDate", key = "startDate"), @Reference(value = "outreachAndCommunityServiceActivityEndDate", key = "endDate") }) @FieldSource(template = "person/outreachAndCommunityServiceActivity", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List outreachAndCommunityServiceActivities; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/professionalServiceActivityType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) private List outreachAndCommunityServiceActivityType; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/professionalServiceActivityRole", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List outreachAndCommunityServiceActivityRole; - @Field @FieldType(type = "nested_dates", searchable = false) @FieldSource(template = "person/professionalServiceActivityStartDate", predicate = "http://vivoweb.org/ontology/core#dateTime") private List outreachAndCommunityServiceActivityStartDate; - @Field @FieldType(type = "nested_dates", searchable = false) @FieldSource(template = "person/professionalServiceActivityEndDate", predicate = "http://vivoweb.org/ontology/core#dateTime") private List outreachAndCommunityServiceActivityEndDate; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @NestedObject(properties = { @Reference(value = "performsTechniqueType", key = "type") }) @FieldSource(template = "person/performsTechnique", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List performsTechnique; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/performsTechniqueType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) private List performsTechniqueType; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @NestedObject(properties = { @Reference(value = "hasExpertiseInTechniqueType", key = "type") }) @FieldSource(template = "person/hasExpertiseInTechnique", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List hasExpertiseInTechnique; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/hasExpertiseInTechniqueType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) private List hasExpertiseInTechniqueType; - @Field @FieldType(type = "whole_string") @FieldSource(template = "person/eraCommonsId", predicate = "http://vivoweb.org/ontology/core#eRACommonsId") private String eraCommonsId; - @Field @FieldType(type = "whole_string") @FieldSource(template = "person/isiResearcherId", predicate = "http://vivoweb.org/ontology/core#researcherId") private String isiResearcherId; - @Field @FieldType(type = "whole_string") @FieldSource(template = "person/scopusId", predicate = "http://vivoweb.org/ontology/core#scopusId") private String scopusId; - @Field @FieldType(type = "whole_string") @FieldSource(template = "person/healthCareProviderId", predicate = "http://purl.obolibrary.org/obo/ARG_0000197") private String healthCareProviderId; - @Field @FieldType(type = "whole_string") @FieldSource(template = "person/email", predicate = "http://www.w3.org/2006/vcard/ns#email") private String email; - @Field @FieldType(type = "tokenized_string") @FieldSource(template = "person/firstName", predicate = "http://www.w3.org/2006/vcard/ns#givenName") private String firstName; - @Field @FieldType(type = "tokenized_string") @FieldSource(template = "person/middleName", predicate = "http://www.w3.org/2006/vcard/ns#middleName") private String middleName; - @Field @FieldType(type = "tokenized_string") @FieldSource(template = "person/lastName", predicate = "http://www.w3.org/2006/vcard/ns#familyName") private String lastName; - @Field @FieldType(type = "whole_string", searchable = false) @FieldSource(template = "person/streetAddress", predicate = "http://www.w3.org/2006/vcard/ns#streetAddress") private String streetAddress; - @Field @FieldType(type = "whole_string", searchable = false) @FieldSource(template = "person/locality", predicate = "http://www.w3.org/2006/vcard/ns#locality") private String locality; - @Field @FieldType(type = "whole_string", searchable = false) @FieldSource(template = "person/region", predicate = "http://www.w3.org/2006/vcard/ns#region") private String region; - @Field @FieldType(type = "whole_string", searchable = false) @FieldSource(template = "person/postalCode", predicate = "http://www.w3.org/2006/vcard/ns#postalCode") private String postalCode; - @Field @FieldType(type = "whole_string", searchable = false) @FieldSource(template = "person/country", predicate = "http://www.w3.org/2006/vcard/ns#country") private String country; - @Field @FieldType(type = "whole_string", searchable = false) @FieldSource(template = "person/geographicLocation", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private String geographicLocation; - @Field @FieldType(type = "whole_strings", searchable = false) @FieldSource(template = "person/locatedInFacility", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List locatedInFacility; - @Field @FieldType(type = "whole_string", searchable = false) @FieldSource(template = "person/fax", predicate = "http://www.w3.org/2006/vcard/ns#fax") private String fax; - @Field @FieldType(type = "whole_strings") @FieldSource(template = "person/organization", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List organizations; - @Field @FieldType(type = "whole_strings") @FieldSource(template = "person/school", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List schools; - @Field @FieldType(type = "whole_string", searchable = false) @FieldSource(template = "person/isni", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#ISNI") private String isni; - @Field @FieldType(type = "whole_string", searchable = false) @FieldSource(template = "person/netid", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#NETID") private String netid; - @Field @FieldType(type = "whole_string", searchable = false) @FieldSource(template = "person/researcherId", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#ResearcherId") private String researcherId; - @Field @FieldType(type = "whole_string", searchable = false) @FieldSource(template = "person/twitter", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#twitterID") private String twitter; - @Field @FieldType(type = "whole_string", searchable = false) @FieldSource(template = "person/uid", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#UID") private String uid; - @Field @FieldType(type = "whole_string", searchable = false) @FieldSource(template = "person/uin", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#UIN") private String uin; - @Field @FieldType(type = "whole_string", searchable = false) @FieldSource(template = "person/youtube", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#youtube") private String youtube; - @Field @NestedObject @FieldType(type = "nested_whole_strings") @FieldSource(template = "person/inTheNews", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List inTheNews; - @Field @NestedObject @FieldType(type = "nested_whole_strings") @FieldSource(template = "person/futureResearchIdeas", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List futureResearchIdeas; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @NestedObject(properties = { @Reference(value = "etdChairOfURL", key = "url"), @Reference(value = "etdChairOfPublicationDate", key = "publicationDate") }) @FieldSource(template = "person/etdChairOf", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List etdChairOf; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "person/etdChairOfURL", predicate = "http://www.w3.org/2006/vcard/ns#url") private List etdChairOfURL; - @Field @FieldType(type = "nested_dates", searchable = false) @FieldSource(template = "person/etdChairOfPublicationDate", predicate = "http://vivoweb.org/ontology/core#dateTime") private List etdChairOfPublicationDate; - @Field @NestedObject(properties = { @Reference(value = "capstoneAdvisedOfURL", key = "url"), @Reference(value = "capstoneAdvisedOfPublicationDate", key = "publicationDate") }) @FieldType(type = "nested_whole_strings") @FieldSource(template = "person/capstoneAdvisedOf", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List capstoneAdvisedOf; - @Field @FieldType(type = "nested_whole_strings") @FieldSource(template = "person/capstoneAdvisedOfURL", predicate = "http://www.w3.org/2006/vcard/ns#url") private List capstoneAdvisedOfURL; - @Field @FieldType(type = "nested_dates") @FieldSource(template = "person/capstoneAdvisedOfPublicationDate", predicate = "http://vivoweb.org/ontology/core#dateTime") private List capstoneAdvisedOfPublicationDate; - @Field @FieldType(type = "whole_string") @FieldSource(template = "person/featuredProfileDisplay", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#FeaturedProfileDisplay") private String featuredProfileDisplay; - @Field @FieldType(type = "whole_string") @FieldSource(template = "person/publicationToInterfolio", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#PublicationToInterfolio") private String publicationToInterfolio; diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/model/Process.java b/src/main/java/edu/tamu/scholars/middleware/discovery/model/Process.java index b5cd4285f..82b4fa1b8 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/model/Process.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/model/Process.java @@ -1,11 +1,10 @@ package edu.tamu.scholars.middleware.discovery.model; import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_EMPTY; +import static edu.tamu.scholars.middleware.discovery.DiscoveryConstants.ABSTRACT; import java.util.List; -import org.apache.solr.client.solrj.beans.Field; - import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; @@ -20,202 +19,166 @@ @CollectionSource(name = "processes", predicate = "http://purl.obolibrary.org/obo/BFO_0000015") public class Process extends Common { - @Field @FieldType(type = "tokenized_string", copyTo = { "_text_", "title_sort" }) @FieldSource(template = "process/title", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private String title; - @Field("abstract") - @JsonProperty("abstract") - @FieldType(type = "tokenized_string", value = "abstract", copyTo = "_text_") + @JsonProperty(ABSTRACT) + @FieldType(type = "tokenized_string", value = ABSTRACT, copyTo = "_text_") @FieldSource(template = "process/abstract", predicate = "http://purl.org/ontology/bibo/abstract") private String abstractText; - @Field @FieldType(type = "nested_whole_strings", copyTo = "_text_") @NestedObject(properties = { @Reference(value = "authorOrganization", key = "organizations") }) @FieldSource(template = "process/author", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List authors; - @Field @NestedMultiValuedProperty @NestedObject(root = false) @FieldType(type = "nested_whole_strings") @FieldSource(template = "process/authorOrganization", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List authorOrganization; - @Field @FieldType(type = "whole_strings") @FieldSource(template = "process/authorList", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#fullAuthorList") private List authorList; - @Field @FieldType(type = "tokenized_string", copyTo = "_text_") @FieldSource(template = "process/description", predicate = "http://vivoweb.org/ontology/core#description") private String description; - @Field @NestedObject @FieldType(type = "nested_whole_strings") @FieldSource(template = "process/offeredBy", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List offeredBy; - @Field @FieldType(type = "nested_whole_string") @NestedObject(properties = { @Reference(value = "dateTimeIntervalStart", key = "start"), @Reference(value = "dateTimeIntervalEnd", key = "end") }) @FieldSource(template = "process/dateTimeInterval", predicate = "http://vivoweb.org/ontology/core#dateTimeInterval") private String dateTimeInterval; - @Field @FieldType(type = "nested_date") @NestedObject(properties = { @Reference(value = "dateTimePrecisionStart", key = "precision") }, root = false) @FieldSource(template = "process/dateTimeIntervalStart", predicate = "http://vivoweb.org/ontology/core#dateTime") private String dateTimeIntervalStart; - @Field @FieldType(type = "nested_date") @NestedObject(properties = { @Reference(value = "dateTimePrecisionEnd", key = "precision") }, root = false) @FieldSource(template = "process/dateTimeIntervalEnd", predicate = "http://vivoweb.org/ontology/core#dateTime") private String dateTimeIntervalEnd; - @Field @FieldType(type = "nested_whole_string") @FieldSource(template = "process/dateTimePrecisionStart", predicate = "http://vivoweb.org/ontology/core#dateTimePrecision", parse = true) private String dateTimePrecisionStart; - @Field @FieldType(type = "nested_whole_strings") @FieldSource(template = "process/dateTimePrecisionEnd", predicate = "http://vivoweb.org/ontology/core#dateTimePrecision", parse = true) private String dateTimePrecisionEnd; - @Field @FieldType(type = "whole_string") @FieldSource(template = "process/subtype", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#subtype") private String subtype; - @Field @FieldType(type = "whole_string") @FieldSource(template = "process/venue", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#venue") private String venue; - @Field @FieldType(type = "whole_string") @FieldSource(template = "process/location", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#location") private String location; - @Field @FieldType(type = "whole_string") @FieldSource(template = "process/url", predicate = "http://www.w3.org/2006/vcard/ns#url") private String url; - @Field @FieldType(type = "whole_string") @FieldSource(template = "process/note", predicate = "http://www.w3.org/2006/vcard/ns#note") private String note; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "process/occursWithinEvent", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List occursWithinEvent; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "process/includesEvent", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List includesEvent; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "process/inEventSeries", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List inEventSeries; - @Field @FieldType(type = "nested_tokenized_strings", copyTo = { "_text_", "participants_nested_facets" }) @NestedObject(properties = { @Reference(value = "participantId", key = "personId"), @Reference(value = "participantRole", key = "role"), @Reference(value = "participantDateTimeIntervalStart", key = "startDate"), @Reference(value = "participantDateTimeIntervalEnd", key = "endDate") }) @FieldSource(template = "process/participant", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List participants; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "process/participantId", predicate = "http://purl.obolibrary.org/obo/RO_0000052", parse = true) private List participantId; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "process/participantRole", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List participantRole; - @Field @FieldType(type = "nested_dates") @FieldSource(template = "process/participantDateTimeIntervalStart", predicate = "http://vivoweb.org/ontology/core#dateTime") private List participantDateTimeIntervalStart; - @Field @FieldType(type = "nested_dates") @FieldSource(template = "process/participantDateTimeIntervalEnd", predicate = "http://vivoweb.org/ontology/core#dateTime") private List participantDateTimeIntervalEnd; - @Field @NestedObject @FieldType(type = "nested_whole_strings") @FieldSource(template = "process/hasSubjectArea", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List subjectAreas; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "process/hasPrerequisite", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List hasPrerequisite; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "process/prerequisiteFor", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List prerequisiteFor; - @Field @FieldType(type = "whole_string", searchable = false) @FieldSource(template = "process/credits", predicate = "http://vivoweb.org/ontology/core#courseCredits") private String credits; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "process/outputPublicationOrOtherWork", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List outputPublicationOrOtherWork; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "process/relatedDocument", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List relatedDocuments; - @Field @FieldType(type = "whole_string", searchable = false) @FieldSource(template = "process/contactInformation", predicate = "http://vivoweb.org/ontology/core#contactInformation") private String contactInformation; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "process/heldInFacility", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List heldInFacility; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "process/heldInGeographicLocation", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List heldInGeographicLocation; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "process/hasOutput", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List hasOutput; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "process/hasParticipant", predicate = "http://www.w3.org/2000/01/rdf-schema#label") diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/model/Relationship.java b/src/main/java/edu/tamu/scholars/middleware/discovery/model/Relationship.java index dc4707308..31578dc2a 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/model/Relationship.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/model/Relationship.java @@ -1,11 +1,10 @@ package edu.tamu.scholars.middleware.discovery.model; import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_EMPTY; +import static edu.tamu.scholars.middleware.discovery.DiscoveryConstants.ABSTRACT; import java.util.List; -import org.apache.solr.client.solrj.beans.Field; - import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; @@ -19,216 +18,177 @@ @CollectionSource(name = "relationships", predicate = "http://vivoweb.org/ontology/core#Relationship") public class Relationship extends Common { - @Field @FieldType(type = "tokenized_string", copyTo = { "_text_", "title_sort" }) @FieldSource(template = "relationship/title", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private String title; - @Field("abstract") - @JsonProperty("abstract") - @FieldType(type = "whole_string", value = "abstract", copyTo = "_text_") + @JsonProperty(ABSTRACT) + @FieldType(type = "whole_string", value = ABSTRACT, copyTo = "_text_") @FieldSource(template = "relationship/abstract", predicate = "http://purl.org/ontology/bibo/abstract") private String abstractText; - @Field @FieldType(type = "whole_string") @FieldSource(template = "relationship/description", predicate = "http://vivoweb.org/ontology/core#description") private String description; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "relationship/organization", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List organization; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "relationship/receiptOf", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List receiptOf; - @Field @FieldType(type = "nested_whole_strings") @NestedObject(properties = { @Reference(value = "awardOrHonorForType", key = "type") }) @FieldSource(template = "relationship/awardOrHonorFor", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List awardOrHonorFor; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "relationship/awardOrHonorForType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) private List awardOrHonorForType; - @Field @FieldType(type = "nested_whole_strings", copyTo = "_text_") @NestedObject(properties = { @Reference(value = "awardConferredByType", key = "type"), @Reference(value = "awardConferredByAbbreviation", key = "abbreviation"), @Reference(value = "awardConferredByPreferredLabel", key = "preferredLabel") }) @FieldSource(template = "relationship/awardConferredBy", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List awardConferredBy; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "relationship/awardConferredByType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) private List awardConferredByType; - @Field @FieldType(type = "nested_whole_strings", copyTo = "_text_") @FieldSource(template = "relationship/awardConferredByAbbreviation", predicate = "http://vivoweb.org/ontology/core#abbreviation") private List awardConferredByAbbreviation; - @Field @FieldType(type = "nested_whole_strings", copyTo = "_text_") @FieldSource(template = "relationship/awardConferredByPreferredLabel", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#awardConferredBy_label") private List awardConferredByPreferredLabel; - @Field @FieldType(type = "nested_tokenized_strings", copyTo = { "_text_", "awardedBy_nested_facets" }) @NestedObject(properties = { @Reference(value = "awardedByType", key = "type"), @Reference(value = "awardedByAbbreviation", key = "abbreviation"), @Reference(value = "awardedByPreferredLabel", key = "preferredLabel") }) @FieldSource(template = "relationship/awardedBy", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List awardedBy; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "relationship/awardedByType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) private List awardedByType; - @Field @FieldType(type = "nested_whole_strings", copyTo = "_text_") @FieldSource(template = "relationship/awardedByAbbreviation", predicate = "http://vivoweb.org/ontology/core#abbreviation") private List awardedByAbbreviation; - @Field @FieldType(type = "nested_whole_strings", copyTo = "_text_") @FieldSource(template = "relationship/awardedByPreferredLabel", predicate = "http://vivo.library.tamu.edu/ontology/TAMU#awardedBy_label") private List awardedByPreferredLabel; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @NestedObject(properties = { @Reference(value = "grantSubcontractedThroughType", key = "type") }) @FieldSource(template = "relationship/grantSubcontractedThrough", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List grantSubcontractedThrough; - @Field @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "relationship/grantSubcontractedThroughType", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) private List grantSubcontractedThroughType; - @Field @NestedObject @FieldType(type = "nested_whole_strings") @FieldSource(template = "relationship/administeredBy", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List administeredBy; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "relationship/subGrant", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List subGrant; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "relationship/subGrantOf", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List subGrantOf; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "relationship/providesFundingFor", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List providesFundingFor; - @Field @FieldType(type = "whole_string", searchable = false) @FieldSource(template = "relationship/totalAwardAmount", predicate = "http://vivoweb.org/ontology/core#totalAwardAmount") private String totalAwardAmount; - @Field @FieldType(type = "whole_string", searchable = false) @FieldSource(template = "relationship/directCosts", predicate = "http://vivoweb.org/ontology/core#directCosts") private String directCosts; - @Field @FieldType(type = "whole_string", searchable = false) @FieldSource(template = "relationship/sponsorAwardId", predicate = "http://vivoweb.org/ontology/core#sponsorAwardId") private String sponsorAwardId; - @Field @FieldType(type = "whole_string", searchable = false) @FieldSource(template = "relationship/localAwardId", predicate = "http://vivoweb.org/ontology/core#localAwardId") private String localAwardId; - @Field @FieldType(type = "nested_tokenized_strings", copyTo = "_text_") @NestedObject(properties = { @Reference(value = "contributorRole", key = "role"), @Reference(value = "contributorOrganization", key = "organizations") }) @FieldSource(template = "relationship/contributor", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List contributors; - @Field @FieldType(type = "nested_whole_strings") @FieldSource(template = "relationship/contributorRole", predicate = "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#mostSpecificType", parse = true) private List contributorRole; - @Field @FieldType(type = "nested_whole_strings") @FieldSource(template = "relationship/contributorOrganization", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List contributorOrganization; - @Field @NestedObject @FieldType(type = "nested_whole_strings", copyTo = "_text_") @FieldSource(template = "relationship/principalInvestigator", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List principalInvestigators; - @Field @NestedObject @FieldType(type = "nested_whole_strings", copyTo = "_text_") @FieldSource(template = "relationship/coPrincipalInvestigator", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List coPrincipalInvestigators; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "relationship/supportedPublicationOrOtherWork", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List supportedPublicationOrOtherWork; - @Field @FieldType(type = "pdate") @FieldSource(template = "relationship/startDateTime", predicate = "http://vivoweb.org/ontology/core#dateTime") private String startDateTime; - @Field @FieldType(type = "pdate") @FieldSource(template = "relationship/endDateTime", predicate = "http://vivoweb.org/ontology/core#dateTime") private String endDateTime; - @Field @NestedObject @FieldType(type = "nested_whole_strings") @FieldSource(template = "relationship/hasSubjectArea", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List subjectAreas; - @Field @FieldType(type = "pdate") @FieldSource(template = "relationship/yearAwarded", predicate = "http://vivoweb.org/ontology/core#dateTime") private String yearAwarded; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "relationship/inheresIn", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List inheresIn; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "relationship/isSpecifiedOutputOf", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List specifiedOutputOf; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "relationship/outputOf", predicate = "http://www.w3.org/2000/01/rdf-schema#label") private List outputOf; - @Field @NestedObject @FieldType(type = "nested_whole_strings", searchable = false) @FieldSource(template = "relationship/participatesIn", predicate = "http://www.w3.org/2000/01/rdf-schema#label") diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/model/repo/IndividualRepo.java b/src/main/java/edu/tamu/scholars/middleware/discovery/model/repo/IndividualRepo.java index 27366b567..5d1af93a6 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/model/repo/IndividualRepo.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/model/repo/IndividualRepo.java @@ -14,7 +14,6 @@ import java.util.Calendar; import java.util.Date; import java.util.List; -import java.util.Objects; import java.util.Optional; import java.util.concurrent.atomic.AtomicLong; import java.util.regex.Matcher; @@ -46,19 +45,19 @@ import org.springframework.stereotype.Service; import edu.tamu.scholars.middleware.discovery.argument.BoostArg; +import edu.tamu.scholars.middleware.discovery.argument.DiscoveryAcademicAgeDescriptor; import edu.tamu.scholars.middleware.discovery.argument.DiscoveryNetworkDescriptor; import edu.tamu.scholars.middleware.discovery.argument.DiscoveryQuantityDistributionDescriptor; -import edu.tamu.scholars.middleware.discovery.argument.DiscoveryAcademicAgeDescriptor; import edu.tamu.scholars.middleware.discovery.argument.FacetArg; import edu.tamu.scholars.middleware.discovery.argument.FilterArg; import edu.tamu.scholars.middleware.discovery.argument.HighlightArg; import edu.tamu.scholars.middleware.discovery.argument.QueryArg; import edu.tamu.scholars.middleware.discovery.exception.SolrRequestException; import edu.tamu.scholars.middleware.discovery.model.Individual; +import edu.tamu.scholars.middleware.discovery.response.DiscoveryAcademicAge; import edu.tamu.scholars.middleware.discovery.response.DiscoveryFacetAndHighlightPage; import edu.tamu.scholars.middleware.discovery.response.DiscoveryNetwork; import edu.tamu.scholars.middleware.discovery.response.DiscoveryQuantityDistribution; -import edu.tamu.scholars.middleware.discovery.response.DiscoveryAcademicAge; import edu.tamu.scholars.middleware.utility.DateFormatUtility; import reactor.core.publisher.Flux; @@ -137,9 +136,12 @@ public List findByIdIn(List ids, List filters, So JsonQueryRequest jsonRequest = builder.jsonQuery(ids); - QueryResponse queryResponse = jsonRequest.process(solrClient, collectionName); + QueryResponse response = jsonRequest.process(solrClient, collectionName); - return queryResponse.getBeans(Individual.class); + return response.getResults() + .stream() + .map(Individual::from) + .collect(Collectors.toList()); } catch (IOException | SolrServerException e) { throw new SolrRequestException("Failed to find documents from ids", e); } @@ -175,7 +177,12 @@ public DiscoveryFacetAndHighlightPage search( try { QueryResponse response = solrClient.query(collectionName, builder.query()); - return DiscoveryFacetAndHighlightPage.from(response, page, facets, highlight, Individual.class); + List individuals = response.getResults() + .stream() + .map(Individual::from) + .collect(Collectors.toList()); + + return DiscoveryFacetAndHighlightPage.from(individuals, response, page, facets, highlight, Individual.class); } catch (IOException | SolrServerException e) { throw new SolrRequestException("Failed to search documents", e); } @@ -196,17 +203,8 @@ public Flux export(QueryArg query, List filters, List to.toString()).collect(Collectors.toList())); - } - - emitter.next(individual); + public void streamSolrDocument(SolrDocument document) { + emitter.next(Individual.from(document)); if (remaining.decrementAndGet() == 0) { emitter.complete(); @@ -215,10 +213,10 @@ public void streamSolrDocument(SolrDocument doc) { @Override public void streamDocListInfo(long numFound, long start, Float maxScore) { - if (numFound == 0) { - emitter.complete(); - } else { + if (numFound > 0) { remaining.set(numFound); + } else { + emitter.complete(); } } @@ -284,8 +282,6 @@ public DiscoveryAcademicAge academicAge(DiscoveryAcademicAgeDescriptor academicA String ageField = academicAgeDescriptor.getAgeField(); try { - - // get count long count = this.count(query, filters); String fields = academicAgeDescriptor.getAccumulateMultivaluedDate() @@ -389,8 +385,7 @@ private Individual getById(String id) { try { SolrDocument document = solrClient.getById(collectionName, id); - return solrClient.getBinder() - .getBean(Individual.class, document); + return Individual.from(document); } catch (IOException | SolrServerException e) { throw new SolrRequestException("Failed to get document by id", e); } @@ -398,8 +393,10 @@ private Individual getById(String id) { private List findAll(SolrQuery query) { try { - return solrClient.query(collectionName, query) - .getBeans(Individual.class); + return solrClient.query(collectionName, query).getResults() + .stream() + .map(Individual::from) + .collect(Collectors.toList()); } catch (IOException | SolrServerException e) { throw new SolrRequestException("Failed to query documents", e); } @@ -407,8 +404,13 @@ private List findAll(SolrQuery query) { private Page findAll(SolrQuery query, Pageable pageable) { try { - SolrDocumentList documents = solrClient.query(collectionName, query).getResults(); - List individuals = solrClient.getBinder().getBeans(Individual.class, documents); + SolrDocumentList documents = solrClient.query(collectionName, query) + .getResults(); + List individuals = solrClient.query(collectionName, query) + .getResults() + .stream() + .map(Individual::from) + .collect(Collectors.toList()); return new PageImpl(individuals, pageable, documents.getNumFound()); } catch (IOException | SolrServerException e) { diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/response/DiscoveryFacetAndHighlightPage.java b/src/main/java/edu/tamu/scholars/middleware/discovery/response/DiscoveryFacetAndHighlightPage.java index 64475ce9a..742742915 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/response/DiscoveryFacetAndHighlightPage.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/response/DiscoveryFacetAndHighlightPage.java @@ -33,8 +33,7 @@ public DiscoveryFacetAndHighlightPage(List content, Pageable pageable, long t this.highlights = highlights; } - public static DiscoveryFacetAndHighlightPage from(QueryResponse response, Pageable pageable, List facetArguments, HighlightArg highlightArg, Class type) { - List documents = response.getBeans(type); + public static DiscoveryFacetAndHighlightPage from(List documents, QueryResponse response, Pageable pageable, List facetArguments, HighlightArg highlightArg, Class type) { List facets = buildFacets(response, facetArguments); List highlights = buildHighlights(response, highlightArg); SolrDocumentList results = response.getResults(); diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/response/DiscoveryFacetPage.java b/src/main/java/edu/tamu/scholars/middleware/discovery/response/DiscoveryFacetPage.java index 5bf809ea4..0076a559d 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/response/DiscoveryFacetPage.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/response/DiscoveryFacetPage.java @@ -35,8 +35,7 @@ public DiscoveryFacetPage(List content, Pageable pageable, long total, List DiscoveryFacetPage from(QueryResponse response, Pageable pageable, List facetArguments, Class type) { - List documents = response.getBeans(type); + public static DiscoveryFacetPage from(List documents, QueryResponse response, Pageable pageable, List facetArguments, Class type) { List facets = buildFacets(response, facetArguments); SolrDocumentList results = response.getResults(); diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/serializer/UnwrappingIndividualSerializer.java b/src/main/java/edu/tamu/scholars/middleware/discovery/serializer/UnwrappingIndividualSerializer.java index 110410c62..8451d9c5e 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/serializer/UnwrappingIndividualSerializer.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/serializer/UnwrappingIndividualSerializer.java @@ -3,11 +3,10 @@ import static edu.tamu.scholars.middleware.discovery.DiscoveryConstants.CLASS; import static edu.tamu.scholars.middleware.discovery.DiscoveryConstants.ID; import static edu.tamu.scholars.middleware.discovery.DiscoveryConstants.NESTED_DELIMITER; -import static edu.tamu.scholars.middleware.discovery.utility.DiscoveryUtility.getDiscoveryDocumentTypeByName; +import static edu.tamu.scholars.middleware.discovery.utility.DiscoveryUtility.getDiscoveryDocumentType; import java.io.IOException; import java.lang.reflect.Field; -import java.util.Collection; import java.util.EnumSet; import java.util.List; import java.util.Map; @@ -54,11 +53,11 @@ public boolean isUnwrappingSerializer() { } @Override - public void serialize(Individual document, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException, JsonProcessingException { - Class type = getDiscoveryDocumentTypeByName(document.getClazz()); - Map> content = document.getContent(); - jsonGenerator.writeObjectField(nameTransformer.transform(ID), document.getId()); - jsonGenerator.writeObjectField(nameTransformer.transform(CLASS), document.getClazz()); + public void serialize(Individual individual, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException, JsonProcessingException { + Class type = getDiscoveryDocumentType(individual.getProxy()); + Map content = individual.getContent(); + jsonGenerator.writeObjectField(nameTransformer.transform(ID), individual.getId()); + jsonGenerator.writeObjectField(nameTransformer.transform(CLASS), individual.getProxy()); for (Field field : FieldUtils.getFieldsListWithAnnotation(type, FieldSource.class)) { JsonProperty jsonProperty = field.getAnnotation(JsonProperty.class); String name = nameTransformer.transform(jsonProperty != null ? jsonProperty.value() : field.getName()); @@ -90,14 +89,13 @@ public void serialize(Individual document, JsonGenerator jsonGenerator, Serializ } } else { if (!value.toString().contains(NESTED_DELIMITER)) { - - @SuppressWarnings("unchecked") - List values = (List) value; - if (List.class.isAssignableFrom(field.getType())) { + @SuppressWarnings("unchecked") + List values = (List) value; + jsonGenerator.writeObjectField(name, values); } else { - jsonGenerator.writeObjectField(nameTransformer.transform(name), values.get(0)); + jsonGenerator.writeObjectField(nameTransformer.transform(name), value); } } } @@ -105,7 +103,7 @@ public void serialize(Individual document, JsonGenerator jsonGenerator, Serializ } } - private ObjectNode processValue(Map> content, Class type, Field field, String[] vParts, int index) { + private ObjectNode processValue(Map content, Class type, Field field, String[] vParts, int index) { ObjectNode node = JsonNodeFactory.instance.objectNode(); NestedObject nestedObject = field.getAnnotation(NestedObject.class); if (nestedObject != null) { @@ -116,7 +114,7 @@ private ObjectNode processValue(Map> content, Class> content, Class type, NestedObject nestedObject, ObjectNode node, String[] vParts, int depth) { + private void processNestedObject(Map content, Class type, NestedObject nestedObject, ObjectNode node, String[] vParts, int depth) { for (Reference reference : nestedObject.properties()) { String ref = reference.value(); Field nestedField = FieldUtils.getField(type, ref, true); diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/service/IndexService.java b/src/main/java/edu/tamu/scholars/middleware/discovery/service/IndexService.java index b0588a76b..2198a615e 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/service/IndexService.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/service/IndexService.java @@ -54,7 +54,7 @@ public void startup() { if (index.isSchematize()) { logger.info("Initializing index fields..."); indexers.stream().forEach(indexer -> { - logger.info(String.format("Initializing %s fields.", indexer.type().getSimpleName())); + logger.info("Initializing {} fields.", indexer.type().getSimpleName()); indexer.init(); }); } @@ -77,7 +77,7 @@ public void index() { Instant start = Instant.now(); logger.info("Indexing..."); harvesters.parallelStream().forEach(harvester -> { - logger.info(String.format("Indexing %s documents.", harvester.type().getSimpleName())); + logger.info("Indexing {} documents.", harvester.type().getSimpleName()); if (indexers.stream().anyMatch(indexer -> indexer.type().equals(harvester.type()))) { harvester.harvest().buffer(index.getBatchSize()).subscribe(batch -> { indexers.parallelStream().filter(indexer -> indexer.type().equals(harvester.type())).forEach(indexer -> { @@ -85,15 +85,15 @@ public void index() { }); }); } else { - logger.warn(String.format("No indexer found for %s documents!", harvester.type().getSimpleName())); + logger.warn("No indexer found for {} documents!", harvester.type().getSimpleName()); } - logger.info(String.format("Indexing %s documents finished.", harvester.type().getSimpleName())); + logger.info("Indexing {} documents finished.", harvester.type().getSimpleName()); }); indexers.stream().forEach(indexer -> { - logger.info(String.format("Optimizing %s index.", indexer.type().getSimpleName())); + logger.info("Optimizing {} index.", indexer.type().getSimpleName()); indexer.optimize(); }); - logger.info(String.format("Indexing finished. %s seconds.", Duration.between(start, Instant.now()).toMillis() / 1000.0)); + logger.info("Indexing finished. {} seconds.", Duration.between(start, Instant.now()).toMillis() / 1000.0); triplestore.destroy(); indexing.set(false); } else { diff --git a/src/main/java/edu/tamu/scholars/middleware/discovery/utility/DiscoveryUtility.java b/src/main/java/edu/tamu/scholars/middleware/discovery/utility/DiscoveryUtility.java index 1b63141ad..095841864 100644 --- a/src/main/java/edu/tamu/scholars/middleware/discovery/utility/DiscoveryUtility.java +++ b/src/main/java/edu/tamu/scholars/middleware/discovery/utility/DiscoveryUtility.java @@ -1,5 +1,6 @@ package edu.tamu.scholars.middleware.discovery.utility; +import static edu.tamu.scholars.middleware.discovery.DiscoveryConstants.CLASS; import static edu.tamu.scholars.middleware.discovery.DiscoveryConstants.DISCOVERY_MODEL_PACKAGE; import static edu.tamu.scholars.middleware.discovery.DiscoveryConstants.PATH_DELIMETER_REGEX; import static edu.tamu.scholars.middleware.discovery.DiscoveryConstants.REQUEST_PARAM_DELIMETER; @@ -7,8 +8,9 @@ import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Arrays; -import java.util.HashSet; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; @@ -22,14 +24,17 @@ import org.springframework.core.type.filter.AnnotationTypeFilter; import edu.tamu.scholars.middleware.discovery.annotation.CollectionSource; +import edu.tamu.scholars.middleware.discovery.annotation.FieldType; import edu.tamu.scholars.middleware.discovery.annotation.NestedObject; import edu.tamu.scholars.middleware.discovery.annotation.NestedObject.Reference; public class DiscoveryUtility { - private final static Set> DISCOVERY_DOCUMENT_TYPES = new HashSet<>(); + private final static Map> TYPES = new HashMap<>(); - private final static BidiMap DISCOVERY_DOCUMENT_PROPERTY_PATH_MAPPING = new DualHashBidiMap(); + private final static Map>> TYPE_FIELDS = new HashMap<>(); + + private final static BidiMap MAPPING = new DualHashBidiMap(); static { ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(false); @@ -37,28 +42,49 @@ public class DiscoveryUtility { Set beanDefinitions = provider.findCandidateComponents(DISCOVERY_MODEL_PACKAGE); for (BeanDefinition beanDefinition : beanDefinitions) { try { - DISCOVERY_DOCUMENT_TYPES.add(Class.forName(beanDefinition.getBeanClassName())); + Class type = Class.forName(beanDefinition.getBeanClassName()); + TYPES.put(type.getSimpleName(), type); + + Map> fields = FieldUtils.getFieldsListWithAnnotation(type, FieldType.class) + .stream() + .collect(Collectors.toMap(field -> { + FieldType fieldType = field.getAnnotation(FieldType.class); + return StringUtils.isNotEmpty(fieldType.value()) + ? fieldType.value() + : field.getName(); + }, field -> field.getType())); + + fields.put(CLASS, String.class); + TYPE_FIELDS.put(type.getSimpleName(), fields); + } catch (ClassNotFoundException e) { throw new RuntimeException("Unable to find class for " + beanDefinition.getBeanClassName(), e); } } } - public static Set> getDiscoveryDocumentTypes() { - return DISCOVERY_DOCUMENT_TYPES; - } - - public static Class getDiscoveryDocumentTypeByName(String name) { - String typeName = String.format("%s.%s", DISCOVERY_MODEL_PACKAGE, name); - Optional> documentType = DISCOVERY_DOCUMENT_TYPES.stream().filter(type -> type.getName().equals(typeName)).findAny(); + public static Class getDiscoveryDocumentType(String name) { + Optional> documentType = Optional.ofNullable(TYPES.get(name)); if (documentType.isPresent()) { return documentType.get(); } throw new RuntimeException("Unable to find class for " + name); } + public static Map> getDiscoveryDocumentTypeFields(String name) { + Optional>> documentTypeFields = Optional.ofNullable(TYPE_FIELDS.get(name)); + if (documentTypeFields.isPresent()) { + return documentTypeFields.get(); + } + throw new RuntimeException("Unable to find class for " + name); + } + public static String[] processFields(String[] fields) { - return Arrays.asList(fields).stream().map(DiscoveryUtility::findProperty).collect(Collectors.toList()).toArray(new String[fields.length]); + return Arrays.asList(fields) + .stream() + .map(DiscoveryUtility::findProperty) + .collect(Collectors.toList()) + .toArray(new String[fields.length]); } public static String processFields(String fields) { @@ -73,7 +99,7 @@ public static String processFields(String fields) { } public static String findPath(String property) { - String actualProperty = DISCOVERY_DOCUMENT_PROPERTY_PATH_MAPPING.getKey(property); + String actualProperty = MAPPING.getKey(property); if (StringUtils.isNoneEmpty(actualProperty)) { return actualProperty; } @@ -81,19 +107,19 @@ public static String findPath(String property) { } public static String findProperty(String path) { - String actualPath = DISCOVERY_DOCUMENT_PROPERTY_PATH_MAPPING.get(path); + String actualPath = MAPPING.get(path); if (StringUtils.isNotEmpty(actualPath)) { return actualPath; } List properties = new ArrayList(Arrays.asList(path.split(PATH_DELIMETER_REGEX))); - for (Class type : DISCOVERY_DOCUMENT_TYPES) { + for (Class type : TYPES.values()) { Optional property = findProperty(type, properties); if (property.isPresent()) { - DISCOVERY_DOCUMENT_PROPERTY_PATH_MAPPING.put(path, property.get()); + MAPPING.put(path, property.get()); return property.get(); } } - DISCOVERY_DOCUMENT_PROPERTY_PATH_MAPPING.put(path, path); + MAPPING.put(path, path); return path; } diff --git a/src/main/java/edu/tamu/scholars/middleware/export/service/CsvExporter.java b/src/main/java/edu/tamu/scholars/middleware/export/service/CsvExporter.java index e2207486d..eb53cf9ba 100644 --- a/src/main/java/edu/tamu/scholars/middleware/export/service/CsvExporter.java +++ b/src/main/java/edu/tamu/scholars/middleware/export/service/CsvExporter.java @@ -5,7 +5,6 @@ import java.io.IOException; import java.io.OutputStreamWriter; import java.util.ArrayList; -import java.util.Collection; import java.util.List; import java.util.Map; import java.util.stream.Collectors; @@ -61,12 +60,12 @@ public StreamingResponseBody streamIndividuals(Flux individuals, Lis .create() .setHeader(headers) .build(); + List properties = export.stream() + .map(e -> e.getField()) + .collect(Collectors.toList()); try (CSVPrinter printer = new CSVPrinter(outputStreamWriter, format)) { individuals.subscribe( individual -> { - List properties = export.stream() - .map(e -> e.getField()) - .collect(Collectors.toList()); try { List row = getRow(individual, properties); printer.printRecord(row.toArray(new Object[row.size()])); @@ -101,27 +100,42 @@ private String[] getColumnHeaders(List export) { } private List getRow(Individual individual, List properties) throws InvalidValuePathException, IllegalArgumentException, IllegalAccessException { - Map> content = individual.getContent(); + Map content = individual.getContent(); List row = new ArrayList(); for (String property : properties) { if (property.equals(config.getIndividualKey())) { row.add(String.format("%s/%s", config.getIndividualBaseUri(), individual.getId())); continue; } - String value = StringUtils.EMPTY; + + String data = StringUtils.EMPTY; + if (content.containsKey(property)) { - Collection values = content.get(property); - if (values.size() > 0) { - value = String.join(DELIMITER, values.stream().map(this::serialize).collect(Collectors.toList())); + + Object value = content.get(property); + + if (List.class.isAssignableFrom(value.getClass())) { + + @SuppressWarnings("unchecked") + List values = (List) value; + + if (values.size() > 0) { + data = String.join(DELIMITER, values.stream() + .map(v -> (String) v) + .map(this::serialize) + .collect(Collectors.toList())); + } + + } else { + data = (String) value; } } - row.add(serialize(value)); + row.add(serialize(data)); } return row; } - private String serialize(Object obj) { - String value = String.valueOf(obj); + private String serialize(String value) { return value.contains(NESTED_DELIMITER) ? value.substring(0, value.indexOf(NESTED_DELIMITER)) : value; diff --git a/src/main/java/edu/tamu/scholars/middleware/export/service/DocxExporter.java b/src/main/java/edu/tamu/scholars/middleware/export/service/DocxExporter.java index 82fdc816f..69db110b5 100644 --- a/src/main/java/edu/tamu/scholars/middleware/export/service/DocxExporter.java +++ b/src/main/java/edu/tamu/scholars/middleware/export/service/DocxExporter.java @@ -43,8 +43,8 @@ public String contentType() { } @Override - public StreamingResponseBody streamIndividual(Individual document, String name) { - final List type = document.getType(); + public StreamingResponseBody streamIndividual(Individual individual, String name) { + final List type = individual.getType(); Optional displayView = displayViewRepo.findByTypesIn(type); @@ -64,7 +64,7 @@ public StreamingResponseBody streamIndividual(Individual document, String name) return outputStream -> { try { - final ObjectNode node = mapper.valueToTree(document); + final ObjectNode node = mapper.valueToTree(individual.getContent()); final WordprocessingMLPackage pkg = createDocx(node, exportView.get()); pkg.save(outputStream); diff --git a/src/main/java/edu/tamu/scholars/middleware/export/utility/FilenameUtility.java b/src/main/java/edu/tamu/scholars/middleware/export/utility/FilenameUtility.java index f2035720c..72933818f 100644 --- a/src/main/java/edu/tamu/scholars/middleware/export/utility/FilenameUtility.java +++ b/src/main/java/edu/tamu/scholars/middleware/export/utility/FilenameUtility.java @@ -1,6 +1,5 @@ package edu.tamu.scholars.middleware.export.utility; -import java.util.Collection; import java.util.Date; import java.util.Locale; import java.util.Map; @@ -33,27 +32,27 @@ public static String normalizeExportFilename(AbstractIndexDocument refDoc) { } public static String normalizeExportFilename(Individual individual) { - Map> content = individual.getContent(); + Map content = individual.getContent(); StringBuilder label = new StringBuilder(); - String clazz = individual.getClazz(); + String proxy = individual.getProxy(); - if (clazz.equals(Organization.class.getSimpleName()) && content.containsKey(NAME)) { - label.append(content.get(NAME).iterator().next()) + if (proxy.equals(Organization.class.getSimpleName()) && content.containsKey(NAME)) { + label.append((String) content.get(NAME)) .append(UNDERSCORE); - } else if (clazz.equals(Person.class.getSimpleName()) && content.containsKey(LAST_NAME)) { - label.append(content.get(LAST_NAME).iterator().next()) + } else if (proxy.equals(Person.class.getSimpleName()) && content.containsKey(LAST_NAME)) { + label.append((String) content.get(LAST_NAME)) .append(UNDERSCORE); if (content.containsKey(FIRST_NAME)) { - label.append(content.get(FIRST_NAME).iterator().next()) + label.append((String) content.get(FIRST_NAME)) .append(UNDERSCORE); } } - return localizeWhileUnderscoreReplaceSpaceWithUnderscore(label - .append(individual.getId()) - .toString()); + label.append(individual.getId()); + + return localizeWhileUnderscoreReplaceSpaceWithUnderscore(label.toString()); } private static String localizeWhileUnderscoreReplaceSpaceWithUnderscore(String value) { diff --git a/src/main/resources/defaults/directoryViews/research/default.html b/src/main/resources/defaults/directoryViews/research/default.html index 0e8b41860..e4450a33a 100644 --- a/src/main/resources/defaults/directoryViews/research/default.html +++ b/src/main/resources/defaults/directoryViews/research/default.html @@ -60,7 +60,7 @@ {{#if tags}} {{#each tags}} - + {{toUNGoal this}} diff --git a/src/main/resources/defaults/discoveryViews/publications/default.html b/src/main/resources/defaults/discoveryViews/publications/default.html index 6ed785b16..ebf5281e5 100644 --- a/src/main/resources/defaults/discoveryViews/publications/default.html +++ b/src/main/resources/defaults/discoveryViews/publications/default.html @@ -69,7 +69,7 @@ {{#if tags}} {{#each tags}} - + {{toUNGoal this}} diff --git a/src/main/resources/defaults/displayViews/documents/other/tags.html b/src/main/resources/defaults/displayViews/documents/other/tags.html index 037fad634..1587ae6c3 100644 --- a/src/main/resources/defaults/displayViews/documents/other/tags.html +++ b/src/main/resources/defaults/displayViews/documents/other/tags.html @@ -1,6 +1,6 @@
{{#each tags}} - + {{/each}} diff --git a/src/main/resources/defaults/displayViews/persons/asideTemplate.html b/src/main/resources/defaults/displayViews/persons/asideTemplate.html index 2c61d3188..6dee3a40e 100644 --- a/src/main/resources/defaults/displayViews/persons/asideTemplate.html +++ b/src/main/resources/defaults/displayViews/persons/asideTemplate.html @@ -20,7 +20,7 @@
{{#tags publications}} - + {{/tags}} @@ -118,7 +118,7 @@
{{#tags publications}} - + {{/tags}} diff --git a/src/main/resources/defaults/displayViews/persons/publications/selectedPublications/academicArticles.html b/src/main/resources/defaults/displayViews/persons/publications/selectedPublications/academicArticles.html index fe32ffabe..57498c5f3 100644 --- a/src/main/resources/defaults/displayViews/persons/publications/selectedPublications/academicArticles.html +++ b/src/main/resources/defaults/displayViews/persons/publications/selectedPublications/academicArticles.html @@ -81,7 +81,7 @@ {{#if tags}} {{#each tags}} - + {{toUNGoal this}} diff --git a/src/main/resources/defaults/displayViews/persons/publications/selectedPublications/book.html b/src/main/resources/defaults/displayViews/persons/publications/selectedPublications/book.html index e12dc0ec5..1269f5db0 100644 --- a/src/main/resources/defaults/displayViews/persons/publications/selectedPublications/book.html +++ b/src/main/resources/defaults/displayViews/persons/publications/selectedPublications/book.html @@ -55,7 +55,7 @@ {{#if tags}} {{#each tags}} - + {{toUNGoal this}} diff --git a/src/main/resources/defaults/displayViews/persons/publications/selectedPublications/chapter.html b/src/main/resources/defaults/displayViews/persons/publications/selectedPublications/chapter.html index 8025f2bcc..a466363a8 100644 --- a/src/main/resources/defaults/displayViews/persons/publications/selectedPublications/chapter.html +++ b/src/main/resources/defaults/displayViews/persons/publications/selectedPublications/chapter.html @@ -80,7 +80,7 @@ {{#if tags}} {{#each tags}} - + {{toUNGoal this}} diff --git a/src/main/resources/defaults/displayViews/persons/publications/selectedPublications/conferencePapers.html b/src/main/resources/defaults/displayViews/persons/publications/selectedPublications/conferencePapers.html index 768adc3e4..28857fe3d 100644 --- a/src/main/resources/defaults/displayViews/persons/publications/selectedPublications/conferencePapers.html +++ b/src/main/resources/defaults/displayViews/persons/publications/selectedPublications/conferencePapers.html @@ -85,7 +85,7 @@ {{#if tags}} {{#each tags}} - + {{toUNGoal this}} diff --git a/src/main/resources/defaults/displayViews/persons/publications/selectedPublications/default.html b/src/main/resources/defaults/displayViews/persons/publications/selectedPublications/default.html index 55a04ec96..666bed476 100644 --- a/src/main/resources/defaults/displayViews/persons/publications/selectedPublications/default.html +++ b/src/main/resources/defaults/displayViews/persons/publications/selectedPublications/default.html @@ -81,7 +81,7 @@ {{#if tags}} {{#each tags}} - + {{toUNGoal this}} diff --git a/src/main/resources/defaults/displayViews/persons/publications/selectedPublications/internetPublication.html b/src/main/resources/defaults/displayViews/persons/publications/selectedPublications/internetPublication.html index e1aac76d8..901bab507 100644 --- a/src/main/resources/defaults/displayViews/persons/publications/selectedPublications/internetPublication.html +++ b/src/main/resources/defaults/displayViews/persons/publications/selectedPublications/internetPublication.html @@ -81,7 +81,7 @@ {{#if tags}} {{#each tags}} - + {{toUNGoal this}} diff --git a/src/main/resources/defaults/displayViews/persons/publications/selectedPublications/report.html b/src/main/resources/defaults/displayViews/persons/publications/selectedPublications/report.html index e1aac76d8..901bab507 100644 --- a/src/main/resources/defaults/displayViews/persons/publications/selectedPublications/report.html +++ b/src/main/resources/defaults/displayViews/persons/publications/selectedPublications/report.html @@ -81,7 +81,7 @@ {{#if tags}} {{#each tags}} - + {{toUNGoal this}} diff --git a/src/main/resources/defaults/displayViews/persons/publications/selectedPublications/thesis.html b/src/main/resources/defaults/displayViews/persons/publications/selectedPublications/thesis.html index e1aac76d8..901bab507 100644 --- a/src/main/resources/defaults/displayViews/persons/publications/selectedPublications/thesis.html +++ b/src/main/resources/defaults/displayViews/persons/publications/selectedPublications/thesis.html @@ -81,7 +81,7 @@ {{#if tags}} {{#each tags}} - + {{toUNGoal this}} diff --git a/src/test/java/edu/tamu/scholars/middleware/discovery/AbstractSolrDocumentIntegrationTest.java b/src/test/java/edu/tamu/scholars/middleware/discovery/AbstractSolrDocumentIntegrationTest.java index c1c2479b6..693bfc43b 100644 --- a/src/test/java/edu/tamu/scholars/middleware/discovery/AbstractSolrDocumentIntegrationTest.java +++ b/src/test/java/edu/tamu/scholars/middleware/discovery/AbstractSolrDocumentIntegrationTest.java @@ -1,7 +1,6 @@ package edu.tamu.scholars.middleware.discovery; import static edu.tamu.scholars.middleware.discovery.DiscoveryConstants.DEFAULT_QUERY; -import static edu.tamu.scholars.middleware.discovery.utility.DiscoveryUtility.getDiscoveryDocumentTypeByName; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; @@ -12,13 +11,12 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.Map; import java.util.stream.Collectors; import org.apache.solr.client.solrj.SolrClient; import org.apache.solr.client.solrj.SolrServerException; -import org.apache.solr.client.solrj.beans.DocumentObjectBinder; import org.apache.solr.client.solrj.request.CoreAdminRequest; -import org.apache.solr.common.SolrInputDocument; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.TestInstance; @@ -28,11 +26,13 @@ import org.springframework.context.annotation.Import; import org.springframework.core.io.Resource; -import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.ObjectMapper; import edu.tamu.scholars.middleware.config.SolrTestConfig; +import edu.tamu.scholars.middleware.discovery.component.Indexer; import edu.tamu.scholars.middleware.discovery.model.AbstractIndexDocument; +import edu.tamu.scholars.middleware.discovery.model.Individual; import edu.tamu.scholars.middleware.discovery.model.repo.IndividualRepo; @Import(SolrTestConfig.class) @@ -48,6 +48,9 @@ public abstract class AbstractSolrDocumentIntegrationTest indexers; + @Autowired protected IndividualRepo repo; @@ -72,6 +75,12 @@ private void createCore() throws SolrServerException, IOException { createRequest.setCoreName(collectionName); createRequest.setConfigSet(collectionName); solrClient.request(createRequest); + + indexers.stream() + .filter(i -> i.type().equals(getType())) + .forEach(indexer -> { + indexer.init(); + }); } private void deleteCore() throws SolrServerException, IOException { @@ -81,33 +90,23 @@ private void deleteCore() throws SolrServerException, IOException { } private void createDocuments() throws SolrServerException, IOException { - assertEquals(0, repo.count(DEFAULT_QUERY, Collections.emptyList())); - DocumentObjectBinder binder = solrClient.getBinder(); - ObjectMapper objectMapper = new ObjectMapper(); - List mockFiles = getMockFiles(); - for (File file : mockFiles) { - JsonNode mockDocumentNode = objectMapper.readTree(file); - String name = mockDocumentNode.get("class").asText(); - Class type = getDiscoveryDocumentTypeByName(name); - SolrInputDocument document = binder.toSolrInputDocument(objectMapper.convertValue(mockDocumentNode, type)); - // NOTE: the null values must be removed, until https://issues.apache.org/jira/browse/SOLR-15112 is resolved - for (String fieldName : new ArrayList<>(document.getFieldNames())) { - if (document.getField(fieldName).getValue() == null) { - document.removeField(fieldName); - } - } - solrClient.add(collectionName, document); - if (type.equals(getType())) { - @SuppressWarnings("unchecked") - D mockDocument = (D) objectMapper.readValue(file, getType()); - assertNotNull(mockDocument); - mockDocuments.add(mockDocument); - } - } - assertTrue(mockDocuments.size() > 0, "No mock documents processed"); - solrClient.commit(collectionName); - numberOfDocuments = (int) repo.count(DEFAULT_QUERY, Collections.emptyList()); - assertEquals(mockFiles.size(), numberOfDocuments, "Indexed documents count not matching mock documents count"); + assertEquals(0, repo.count(DEFAULT_QUERY, Collections.emptyList())); + ObjectMapper objectMapper = new ObjectMapper(); + List mockFiles = getMockFiles(); + for (File file : mockFiles) { + Map content = objectMapper.readValue(file, new TypeReference>() {}); + + solrClient.addBean(collectionName, Individual.from(content)); + + @SuppressWarnings("unchecked") + D mockDocument = (D) objectMapper.readValue(file, getType()); + assertNotNull(mockDocument); + mockDocuments.add(mockDocument); + } + assertTrue(mockDocuments.size() > 0, "No mock documents processed"); + solrClient.commit(collectionName); + numberOfDocuments = (int) repo.count(DEFAULT_QUERY, Collections.emptyList()); + assertEquals(mockFiles.size(), numberOfDocuments, "Indexed documents count not matching mock documents count"); } private void deleteDocuments() throws SolrServerException, IOException { @@ -120,7 +119,11 @@ private List getMockFiles() throws IOException { assertTrue(mocksDirectoryResource.isFile()); File mocksDirectory = mocksDirectoryResource.getFile(); assertTrue(mocksDirectory.isDirectory()); - return Files.walk(mocksDirectory.toPath(), 2).map(path -> path.toFile()).filter(file -> file.isFile()).collect(Collectors.toList()); + + return Files.walk(mocksDirectory.toPath().resolve(getDocPath()), 2) + .map(path -> path.toFile()) + .filter(file -> file.isFile()) + .collect(Collectors.toList()); } protected String getDocPath() { @@ -130,6 +133,7 @@ protected String getDocPath() { } else { docPath += "s"; } + return docPath; } diff --git a/src/test/java/edu/tamu/scholars/middleware/discovery/controller/AbstractSolrDocumentControllerTest.java b/src/test/java/edu/tamu/scholars/middleware/discovery/controller/AbstractSolrDocumentControllerTest.java index 68e084c5c..380efa3ea 100644 --- a/src/test/java/edu/tamu/scholars/middleware/discovery/controller/AbstractSolrDocumentControllerTest.java +++ b/src/test/java/edu/tamu/scholars/middleware/discovery/controller/AbstractSolrDocumentControllerTest.java @@ -53,7 +53,7 @@ public void testGetSolrDocumentsPage() throws Exception { .andExpect(content().contentType(HAL_JSON_VALUE)) .andExpect(jsonPath("page.size", equalTo(10))) .andExpect(jsonPath("page.totalElements", equalTo(numberOfDocuments))) - .andExpect(jsonPath("page.totalPages", equalTo(3))) + .andExpect(jsonPath("page.totalPages", equalTo(1))) .andExpect(jsonPath("page.number", equalTo(1))) .andDo( document( @@ -64,10 +64,7 @@ public void testGetSolrDocumentsPage() throws Exception { parameterWithName("sort").description("The page sort [field,asc/desc].") ), links( - linkWithRel("first").description("First page link for this resource."), - linkWithRel("self").description("Canonical link for this resource."), - linkWithRel("next").description("Next page link for this resource."), - linkWithRel("last").description("Last page link for this resource.") + linkWithRel("self").description("Canonical link for this resource.") ), responseFields( subsectionWithPath("_embedded.individual").description(String.format("An array of <>.", "individual", getType().getSimpleName())), diff --git a/src/test/resources/application.yml b/src/test/resources/application.yml index 02a3e0426..158b7f9dd 100644 --- a/src/test/resources/application.yml +++ b/src/test/resources/application.yml @@ -28,7 +28,7 @@ middleware: name: scholars-discovery cron: 0 0 0 * * SUN zone: America/Chicago - schematize: true + schematize: false onStartup: false onStartupDelay: 10000 enableIndividualOnBatchFail: false