NIHVIVO-3186 clean up queries.
This commit is contained in:
parent
58b8176a39
commit
d9f25b1067
1 changed files with 47 additions and 69 deletions
|
@ -5,7 +5,6 @@ import java.util.Arrays;
|
||||||
|
|
||||||
import javax.servlet.http.HttpSession;
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
import com.hp.hpl.jena.vocabulary.RDFS;
|
|
||||||
import com.hp.hpl.jena.vocabulary.XSD;
|
import com.hp.hpl.jena.vocabulary.XSD;
|
||||||
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||||
|
@ -23,19 +22,7 @@ public class OrganizationHasPositionHistoryGenerator extends VivoBaseGenerator
|
||||||
private static final String URI_PRECISION_NONE = Precision.NONE.uri();
|
private static final String URI_PRECISION_NONE = Precision.NONE.uri();
|
||||||
private static final String URI_PRECISION_YEAR = Precision.YEAR.uri();
|
private static final String URI_PRECISION_YEAR = Precision.YEAR.uri();
|
||||||
|
|
||||||
private final static String URI_POSITION_CLASS = vivoCore("Position");
|
private final static String URI_POSITION_CLASS = NS_VIVO_CORE + "Position";
|
||||||
private final static String URI_INTERVAL_FOR_POSITION = vivoCore("dateTimeInterval");
|
|
||||||
private final static String URI_DATE_TIME_INTERVAL_CLASS = vivoCore("DateTimeInterval");
|
|
||||||
private final static String URI_DATE_TIME_VALUE_CLASS = vivoCore("DateTimeValue");
|
|
||||||
private final static String URI_DATE_TIME_VALUE = vivoCore("dateTime");
|
|
||||||
private final static String URI_DATE_TIME_PRECISION = vivoCore("dateTimePrecision");
|
|
||||||
|
|
||||||
private final static String URI_INTERVAL_TO_START = vivoCore("start");
|
|
||||||
private final static String URI_INTERVAL_TO_END = vivoCore("end");
|
|
||||||
|
|
||||||
private static String vivoCore(String localName) {
|
|
||||||
return NS_VIVO_CORE + localName;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final String QUERY_EXISTING_POSITION_TITLE = ""
|
private static final String QUERY_EXISTING_POSITION_TITLE = ""
|
||||||
+ "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n"
|
+ "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \n"
|
||||||
|
@ -65,66 +52,57 @@ public class OrganizationHasPositionHistoryGenerator extends VivoBaseGenerator
|
||||||
+ " ?position core:dateTimeInterval ?existingIntervalNode . \n"
|
+ " ?position core:dateTimeInterval ?existingIntervalNode . \n"
|
||||||
+ " ?existingIntervalNode a core:DateTimeInterval . }";
|
+ " ?existingIntervalNode a core:DateTimeInterval . }";
|
||||||
|
|
||||||
private static final String QUERY_EXISTING_START_NODE = String.format(
|
private static final String QUERY_EXISTING_START_NODE = ""
|
||||||
"SELECT ?existingStartNode WHERE { \n"
|
+ "PREFIX core: <http://vivoweb.org/ontology/core#> \n"
|
||||||
+ " ?position <%1$s> ?intervalNode .\n"
|
+ "SELECT ?existingStartNode WHERE { \n"
|
||||||
+ " ?intervalNode a <%2$s> ;\n"
|
+ " ?position core:dateTimeInterval ?intervalNode .\n"
|
||||||
+ " <%3$s> ?existingStartNode . \n"
|
+ " ?intervalNode a core:DateTimeInterval ;\n"
|
||||||
+ " ?existingStartNode a <%4$s> . }",
|
+ " core:start ?existingStartNode . \n"
|
||||||
URI_INTERVAL_FOR_POSITION, URI_DATE_TIME_INTERVAL_CLASS,
|
+ " ?existingStartNode a core:DateTimeValue . }";
|
||||||
URI_INTERVAL_TO_START, URI_DATE_TIME_VALUE_CLASS);
|
|
||||||
|
|
||||||
private static final String QUERY_EXISTING_START_VALUE = String.format(
|
private static final String QUERY_EXISTING_START_VALUE = ""
|
||||||
"SELECT ?existingDateStart WHERE { \n"
|
+ "PREFIX core: <http://vivoweb.org/ontology/core#> \n"
|
||||||
+ " ?position <%1$s> ?intervalNode .\n"
|
+ "SELECT ?existingDateStart WHERE { \n"
|
||||||
+ " ?intervalNode a <%2$s> ; \n"
|
+ " ?position core:dateTimeInterval ?intervalNode .\n"
|
||||||
+ " <%3$s> ?startNode . \n"
|
+ " ?intervalNode a core:DateTimeInterval ; \n"
|
||||||
+ " ?startNode a <%4$s> ; \n"
|
+ " core:start ?startNode . \n"
|
||||||
+ " <%5$s> ?existingDateStart . }",
|
+ " ?startNode a core:DateTimeValue ; \n"
|
||||||
URI_INTERVAL_FOR_POSITION, URI_DATE_TIME_INTERVAL_CLASS,
|
+ " core:dateTime ?existingDateStart . }";
|
||||||
URI_INTERVAL_TO_START, URI_DATE_TIME_VALUE_CLASS,
|
|
||||||
URI_DATE_TIME_VALUE);
|
|
||||||
|
|
||||||
private static final String QUERY_EXISTING_START_PRECISION = String.format(
|
private static final String QUERY_EXISTING_START_PRECISION = ""
|
||||||
"SELECT ?existingStartPrecision WHERE { \n"
|
+ "PREFIX core: <http://vivoweb.org/ontology/core#> \n"
|
||||||
+ " ?position <%1$s> ?intervalNode .\n"
|
+ "SELECT ?existingStartPrecision WHERE { \n"
|
||||||
+ " ?intervalNode a <%2$s> ;\n"
|
+ " ?position core:dateTimeInterval ?intervalNode .\n"
|
||||||
+ " <%3$s> ?startNode . \n"
|
+ " ?intervalNode a core:DateTimeInterval ;\n"
|
||||||
+ " ?startNode a <%4$s> ; \n"
|
+ " core:start ?startNode . \n"
|
||||||
+ " <%5$s> ?existingStartPrecision . }",
|
+ " ?startNode a core:DateTimeValue ; \n"
|
||||||
URI_INTERVAL_FOR_POSITION, URI_DATE_TIME_INTERVAL_CLASS,
|
+ " core:dateTimePrecision ?existingStartPrecision . }";
|
||||||
URI_INTERVAL_TO_START, URI_DATE_TIME_VALUE_CLASS,
|
|
||||||
URI_DATE_TIME_PRECISION);
|
|
||||||
|
|
||||||
private static final String QUERY_EXISTING_END_VALUE = String
|
private static final String QUERY_EXISTING_END_NODE = ""
|
||||||
.format("SELECT ?existingDateEnd WHERE { \n"
|
+ "PREFIX core: <http://vivoweb.org/ontology/core#> \n"
|
||||||
+ " ?position <%1$s> ?intervalNode .\n"
|
+ "SELECT ?existingEndNode WHERE { \n"
|
||||||
+ " ?intervalNode a <%2$s> ; \n"
|
+ " ?position core:dateTimeInterval ?intervalNode .\n"
|
||||||
+ " <%3$s> ?endNode . \n"
|
+ " ?intervalNode a core:DateTimeInterval ;\n"
|
||||||
+ " ?endNode a <%4$s> ; \n"
|
+ " core:end ?existingEndNode . \n"
|
||||||
+ " <%5$s> ?existingDateEnd . }",
|
+ " ?existingEndNode a core:DateTimeValue . }";
|
||||||
URI_INTERVAL_FOR_POSITION, URI_DATE_TIME_INTERVAL_CLASS,
|
|
||||||
URI_INTERVAL_TO_END, URI_DATE_TIME_VALUE_CLASS,
|
|
||||||
URI_DATE_TIME_VALUE);
|
|
||||||
|
|
||||||
private static final String QUERY_EXISTING_END_PRECISION = String.format(
|
private static final String QUERY_EXISTING_END_VALUE = ""
|
||||||
"SELECT ?existingEndPrecision WHERE { \n"
|
+ "PREFIX core: <http://vivoweb.org/ontology/core#> \n"
|
||||||
+ " ?position <%1$s> ?intervalNode .\n"
|
+ "SELECT ?existingDateEnd WHERE { \n"
|
||||||
+ " ?intervalNode a <%2$s> ;\n"
|
+ " ?position core:dateTimeInterval ?intervalNode .\n"
|
||||||
+ " <%3$s> ?endNode . \n" + " ?endNode a <%4$s> ; \n"
|
+ " ?intervalNode a core:DateTimeInterval ; \n"
|
||||||
+ " <%5$s> ?existingEndPrecision . }",
|
+ " core:end ?endNode . \n"
|
||||||
URI_INTERVAL_FOR_POSITION, URI_DATE_TIME_INTERVAL_CLASS,
|
+ " ?endNode a core:DateTimeValue ; \n"
|
||||||
URI_INTERVAL_TO_END, URI_DATE_TIME_VALUE_CLASS,
|
+ " core:dateTime ?existingDateEnd . }";
|
||||||
URI_DATE_TIME_PRECISION);
|
|
||||||
|
|
||||||
private static final String QUERY_EXISTING_END_NODE = String.format(
|
private static final String QUERY_EXISTING_END_PRECISION = ""
|
||||||
"SELECT ?existingEndNode WHERE { \n"
|
+ "PREFIX core: <http://vivoweb.org/ontology/core#> \n"
|
||||||
+ " ?position <%1$s> ?intervalNode .\n"
|
+ "SELECT ?existingEndPrecision WHERE { \n"
|
||||||
+ " ?intervalNode a <%2$s> ;\n"
|
+ " ?position core:dateTimeInterval ?intervalNode .\n"
|
||||||
+ " <%3$s> ?existingEndNode . \n"
|
+ " ?intervalNode a core:DateTimeInterval ;\n"
|
||||||
+ " ?existingEndNode a <%4$s> .}",
|
+ " core:end ?endNode . \n"
|
||||||
URI_INTERVAL_FOR_POSITION, URI_DATE_TIME_INTERVAL_CLASS,
|
+ " ?endNode a core:DateTimeValue ; \n"
|
||||||
URI_INTERVAL_TO_END, URI_DATE_TIME_VALUE_CLASS);
|
+ " core:dateTimePrecision ?existingEndPrecision . }";
|
||||||
|
|
||||||
private static final String N3_NEW_POSITION = ""
|
private static final String N3_NEW_POSITION = ""
|
||||||
+ "@prefix core: <http://vivoweb.org/ontology/core#> . \n"
|
+ "@prefix core: <http://vivoweb.org/ontology/core#> . \n"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue