diff --git a/.gitignore b/.gitignore index ad444b40..914f8d25 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,8 @@ utilities/rdbmigration/.work **/target **/overlays + +# Eclipse artifacts +**/.settings +**/.classpath +**/.project diff --git a/api/src/main/java/edu/cornell/mannlib/vitro/webapp/searchindex/extensions/LabelsAcrossContextNodes.java b/api/src/main/java/edu/cornell/mannlib/vitro/webapp/searchindex/extensions/LabelsAcrossContextNodes.java index 64d07580..5bc9ebed 100644 --- a/api/src/main/java/edu/cornell/mannlib/vitro/webapp/searchindex/extensions/LabelsAcrossContextNodes.java +++ b/api/src/main/java/edu/cornell/mannlib/vitro/webapp/searchindex/extensions/LabelsAcrossContextNodes.java @@ -4,7 +4,7 @@ package edu.cornell.mannlib.vitro.webapp.searchindex.extensions; import static edu.cornell.mannlib.vitro.webapp.search.VitroSearchTermNames.ALLTEXT; import static edu.cornell.mannlib.vitro.webapp.search.VitroSearchTermNames.ALLTEXTUNSTEMMED; -import static edu.cornell.mannlib.vitro.webapp.utils.sparql.SelectQueryRunner.createQueryContext; +import static edu.cornell.mannlib.vitro.webapp.utils.sparqlrunner.SparqlQueryRunner.createSelectQueryContext; import java.util.ArrayList; import java.util.Collection; @@ -222,25 +222,26 @@ public class LabelsAcrossContextNodes implements IndexingUriFinder, private void addLabelsFromAllContextNodeClasses(Individual ind, SearchInputDocument doc) { - addValuesToTextFields(doc, - createQueryContext(rdfService, LABELS_WITHOUT_RESTRICTION) + addValuesToTextFields( + doc, + createSelectQueryContext(rdfService, LABELS_WITHOUT_RESTRICTION) .bindVariableToUri("uri", ind.getURI()) .bindVariableToUri("incoming", incomingPropertyUri) .bindVariableToUri("outgoing", outgoingPropertyUri) - .execute().getStringFields("label").flatten()); + .execute().toStringFields("label").flatten()); } private void addLabelsFromContextNodeClass(Individual ind, SearchInputDocument doc, String contextNodeClass) { addValuesToTextFields( doc, - createQueryContext(rdfService, + createSelectQueryContext(rdfService, LABELS_FOR_SPECIFIC_CONTEXT_NODE_TYPE) .bindVariableToUri("uri", ind.getURI()) .bindVariableToUri("nodeType", contextNodeClass) .bindVariableToUri("incoming", incomingPropertyUri) .bindVariableToUri("outgoing", outgoingPropertyUri) - .execute().getStringFields("label").flatten()); + .execute().toStringFields("label").flatten()); } private void addValuesToTextFields(SearchInputDocument doc, @@ -329,23 +330,23 @@ public class LabelsAcrossContextNodes implements IndexingUriFinder, } private Set locatePartnersWithoutRestriction(String uri) { - return createQueryContext(rdfService, + return createSelectQueryContext(rdfService, LOCATE_PARTNERS_WITHOUT_RESTRICTION) .bindVariableToUri("uri", uri) .bindVariableToUri("incoming", incomingPropertyUri) .bindVariableToUri("outgoing", outgoingPropertyUri).execute() - .getStringFields("partner").flattenToSet(); + .toStringFields("partner").flattenToSet(); } private Collection locatePartnersAcrossContextNodeClass( String uri, String contextNodeClass) { - return createQueryContext(rdfService, + return createSelectQueryContext(rdfService, LOCATE_PARTNERS_ON_CONTEXT_NODE_TYPE) .bindVariableToUri("uri", uri) .bindVariableToUri("nodeType", contextNodeClass) .bindVariableToUri("incoming", incomingPropertyUri) .bindVariableToUri("outgoing", outgoingPropertyUri).execute() - .getStringFields("partner").flattenToSet(); + .toStringFields("partner").flattenToSet(); } private boolean isIncomingStatementOnAcceptableContextNode(Statement stmt) { @@ -368,9 +369,9 @@ public class LabelsAcrossContextNodes implements IndexingUriFinder, } private Set getTypes(String uri) { - return createQueryContext(rdfService, GET_TYPES) - .bindVariableToUri("uri", uri).execute() - .getStringFields("type").flattenToSet(); + return createSelectQueryContext(rdfService, GET_TYPES) + .bindVariableToUri("uri", uri).execute().toStringFields("type") + .flattenToSet(); } private Set locateOtherPartners(Statement stmt) { @@ -382,12 +383,12 @@ public class LabelsAcrossContextNodes implements IndexingUriFinder, String objectUri = (stmt.getObject().isURIResource()) ? stmt .getObject().asResource().getURI() : "NO_MATCH"; - return createQueryContext(rdfService, + return createSelectQueryContext(rdfService, LOCATE_OTHER_PARTNERS_ON_THIS_NODE) .bindVariableToUri("contextNode", nodeUri) .bindVariableToUri("uri", objectUri) .bindVariableToUri("outgoing", outgoingPropertyUri).execute() - .getStringFields("partner").flattenToSet(); + .toStringFields("partner").flattenToSet(); } private List filterByType(Collection uris) { diff --git a/api/src/main/java/edu/cornell/mannlib/vivo/orcid/OrcidIdDataGetter.java b/api/src/main/java/edu/cornell/mannlib/vivo/orcid/OrcidIdDataGetter.java index 7fae1ad1..2f983281 100644 --- a/api/src/main/java/edu/cornell/mannlib/vivo/orcid/OrcidIdDataGetter.java +++ b/api/src/main/java/edu/cornell/mannlib/vivo/orcid/OrcidIdDataGetter.java @@ -18,15 +18,14 @@ import org.apache.jena.rdf.model.Resource; import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle; import edu.cornell.mannlib.vitro.webapp.auth.identifier.RequestIdentifiers; -import edu.cornell.mannlib.vitro.webapp.auth.identifier.common.HasAssociatedIndividual; import edu.cornell.mannlib.vitro.webapp.auth.identifier.common.HasProfile; import edu.cornell.mannlib.vitro.webapp.auth.identifier.common.HasProxyEditingRights; import edu.cornell.mannlib.vitro.webapp.auth.identifier.common.IsRootUser; import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder; -import edu.cornell.mannlib.vitro.webapp.utils.SparqlQueryRunner; -import edu.cornell.mannlib.vitro.webapp.utils.SparqlQueryRunner.QueryParser; import edu.cornell.mannlib.vitro.webapp.utils.dataGetter.DataGetter; +import edu.cornell.mannlib.vitro.webapp.utils.sparqlrunner.ResultSetParser; +import edu.cornell.mannlib.vitro.webapp.utils.sparqlrunner.SparqlQueryRunner; import edu.cornell.mannlib.vivo.orcid.controller.OrcidIntegrationController; /** @@ -122,8 +121,9 @@ public class OrcidIdDataGetter implements DataGetter { private List runSparqlQuery(String individualUri) { String queryStr = String.format(QUERY_TEMPLATE, individualUri, ORCID_ID, ORCID_IS_CONFIRMED); - SparqlQueryRunner runner = new SparqlQueryRunner(vreq.getJenaOntModel()); - return runner.executeSelect(new OrcidResultParser(), queryStr); + return SparqlQueryRunner + .createSelectQueryContext(vreq.getJenaOntModel(), queryStr) + .execute().parse(new OrcidResultParser()); } private Map buildMap(boolean isAuthorizedToConfirm, @@ -154,7 +154,7 @@ public class OrcidIdDataGetter implements DataGetter { /** * Parse the results of the SPARQL query. */ - private static class OrcidResultParser extends QueryParser> { + private static class OrcidResultParser extends ResultSetParser> { @Override protected List defaultValue() { return Collections.emptyList();