Removed publication_year_using_1_1_property from the queries for better response times with visualizations and fixed the issue with publications with unknown dates not appearing with temporal vis for publications.
This commit is contained in:
parent
ad3497d0bc
commit
e41a4522f7
8 changed files with 310 additions and 410 deletions
|
@ -361,21 +361,6 @@ public class CoAuthorshipQueryRunner implements QueryRunner<CoAuthorshipData> {
|
||||||
|
|
||||||
BiboDocument biboDocument = new BiboDocument(documentURL);
|
BiboDocument biboDocument = new BiboDocument(documentURL);
|
||||||
|
|
||||||
RDFNode documentLabelNode = solution.get(QueryFieldLabels.DOCUMENT_LABEL);
|
|
||||||
if (documentLabelNode != null) {
|
|
||||||
biboDocument.setDocumentLabel(documentLabelNode.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
RDFNode documentBlurbNode = solution.get(QueryFieldLabels.DOCUMENT_BLURB);
|
|
||||||
if (documentBlurbNode != null) {
|
|
||||||
biboDocument.setDocumentBlurb(documentBlurbNode.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
RDFNode documentMonikerNode = solution.get(QueryFieldLabels.DOCUMENT_MONIKER);
|
|
||||||
if (documentMonikerNode != null) {
|
|
||||||
biboDocument.setDocumentMoniker(documentMonikerNode.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
RDFNode publicationDateNode = solution.get(QueryFieldLabels.DOCUMENT_PUBLICATION_DATE);
|
RDFNode publicationDateNode = solution.get(QueryFieldLabels.DOCUMENT_PUBLICATION_DATE);
|
||||||
if (publicationDateNode != null) {
|
if (publicationDateNode != null) {
|
||||||
biboDocument.setPublicationDate(publicationDateNode.toString());
|
biboDocument.setPublicationDate(publicationDateNode.toString());
|
||||||
|
@ -384,10 +369,10 @@ public class CoAuthorshipQueryRunner implements QueryRunner<CoAuthorshipData> {
|
||||||
/*
|
/*
|
||||||
* This is being used so that date in the data from pre-1.2 ontology can be captured.
|
* This is being used so that date in the data from pre-1.2 ontology can be captured.
|
||||||
* */
|
* */
|
||||||
RDFNode publicationYearUsing_1_1_PropertyNode = solution.get(QueryFieldLabels.DOCUMENT_PUBLICATION_YEAR_USING_1_1_PROPERTY);
|
// RDFNode publicationYearUsing_1_1_PropertyNode = solution.get(QueryFieldLabels.DOCUMENT_PUBLICATION_YEAR_USING_1_1_PROPERTY);
|
||||||
if (publicationYearUsing_1_1_PropertyNode != null) {
|
// if (publicationYearUsing_1_1_PropertyNode != null) {
|
||||||
biboDocument.setPublicationYear(publicationYearUsing_1_1_PropertyNode.toString());
|
// biboDocument.setPublicationYear(publicationYearUsing_1_1_PropertyNode.toString());
|
||||||
}
|
// }
|
||||||
|
|
||||||
return biboDocument;
|
return biboDocument;
|
||||||
}
|
}
|
||||||
|
@ -412,31 +397,24 @@ public class CoAuthorshipQueryRunner implements QueryRunner<CoAuthorshipData> {
|
||||||
+ " (str(?coAuthorPerson) as ?" + QueryFieldLabels.CO_AUTHOR_URL + ") \n"
|
+ " (str(?coAuthorPerson) as ?" + QueryFieldLabels.CO_AUTHOR_URL + ") \n"
|
||||||
+ " (str(?coAuthorPersonLabel) as ?" + QueryFieldLabels.CO_AUTHOR_LABEL + ") \n"
|
+ " (str(?coAuthorPersonLabel) as ?" + QueryFieldLabels.CO_AUTHOR_LABEL + ") \n"
|
||||||
+ " (str(?document) as ?" + QueryFieldLabels.DOCUMENT_URL + ") \n"
|
+ " (str(?document) as ?" + QueryFieldLabels.DOCUMENT_URL + ") \n"
|
||||||
+ " (str(?documentLabel) as ?" + QueryFieldLabels.DOCUMENT_LABEL + ") \n"
|
|
||||||
+ " (str(?documentMoniker) as ?" + QueryFieldLabels.DOCUMENT_MONIKER + ") \n"
|
|
||||||
+ " (str(?documentBlurb) as ?" + QueryFieldLabels.DOCUMENT_BLURB + ") \n"
|
|
||||||
+ " (str(?publicationDate) as ?" + QueryFieldLabels.DOCUMENT_PUBLICATION_DATE + ") \n"
|
+ " (str(?publicationDate) as ?" + QueryFieldLabels.DOCUMENT_PUBLICATION_DATE + ") \n"
|
||||||
+ " (str(?publicationYearUsing_1_1_property) as ?" + QueryFieldLabels.DOCUMENT_PUBLICATION_YEAR_USING_1_1_PROPERTY + ") \n"
|
// + " (str(?publicationYearUsing_1_1_property) as ?" + QueryFieldLabels.DOCUMENT_PUBLICATION_YEAR_USING_1_1_PROPERTY + ") \n"
|
||||||
+ "WHERE { \n"
|
+ "WHERE { \n"
|
||||||
+ "<" + queryURI + "> rdf:type foaf:Person ;"
|
+ "<" + queryURI + "> rdf:type foaf:Person ;"
|
||||||
+ " rdfs:label ?authorLabel ;"
|
+ " rdfs:label ?authorLabel ;"
|
||||||
+ " core:authorInAuthorship ?authorshipNode . \n"
|
+ " core:authorInAuthorship ?authorshipNode . \n"
|
||||||
+ "?authorshipNode rdf:type core:Authorship ;"
|
+ "?authorshipNode rdf:type core:Authorship ;"
|
||||||
+ " core:linkedInformationResource ?document . \n"
|
+ " core:linkedInformationResource ?document . \n"
|
||||||
+ "?document rdfs:label ?documentLabel . \n"
|
|
||||||
+ "?document core:informationResourceInAuthorship ?coAuthorshipNode . \n"
|
+ "?document core:informationResourceInAuthorship ?coAuthorshipNode . \n"
|
||||||
+ "?coAuthorshipNode core:linkedAuthor ?coAuthorPerson . \n"
|
+ "?coAuthorshipNode core:linkedAuthor ?coAuthorPerson . \n"
|
||||||
+ "?coAuthorPerson rdfs:label ?coAuthorPersonLabel . \n"
|
+ "?coAuthorPerson rdfs:label ?coAuthorPersonLabel . \n"
|
||||||
+ "OPTIONAL { ?document core:dateTimeValue ?dateTimeValue . \n"
|
+ "OPTIONAL { ?document core:dateTimeValue ?dateTimeValue . \n"
|
||||||
+ " ?dateTimeValue core:dateTime ?publicationDate } .\n"
|
+ " ?dateTimeValue core:dateTime ?publicationDate } .\n"
|
||||||
+ "OPTIONAL { ?document core:year ?publicationYearUsing_1_1_property } .\n"
|
// + "OPTIONAL { ?document core:year ?publicationYearUsing_1_1_property } .\n"
|
||||||
+ "OPTIONAL { ?document vitro:moniker ?documentMoniker } . \n"
|
|
||||||
+ "OPTIONAL { ?document vitro:blurb ?documentBlurb } . \n"
|
|
||||||
+ "OPTIONAL { ?document vitro:description ?documentDescription } \n"
|
|
||||||
+ "} \n"
|
+ "} \n"
|
||||||
+ "ORDER BY ?document ?coAuthorPerson\n";
|
+ "ORDER BY ?document ?coAuthorPerson\n";
|
||||||
|
|
||||||
// System.out.println("COAUTHORSHIP QUERY - " + sparqlQuery);
|
log.debug("COAUTHORSHIP QUERY - " + sparqlQuery);
|
||||||
|
|
||||||
return sparqlQuery;
|
return sparqlQuery;
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,18 +67,33 @@ public class EntityPublicationCountConstructQueryRunner {
|
||||||
+ "?Person rdfs:label ?PersonLabel . "
|
+ "?Person rdfs:label ?PersonLabel . "
|
||||||
+ "?Resource core:linkedInformationResource ?Document . "
|
+ "?Resource core:linkedInformationResource ?Document . "
|
||||||
+ "?Document rdf:type bibo:Document . "
|
+ "?Document rdf:type bibo:Document . "
|
||||||
+ "?Document rdfs:label ?DocumentLabel "
|
+ "?Document rdfs:label ?DocumentLabel . "
|
||||||
|
+ "?Document core:dateTimeValue ?dateTimeValue . "
|
||||||
|
+ "?dateTimeValue core:dateTime ?publicationDate . "
|
||||||
|
// + "?Document core:year ?publicationYearUsing_1_1_property "
|
||||||
+"}"
|
+"}"
|
||||||
+ "WHERE { "
|
+ "WHERE { "
|
||||||
+ "<"+queryURI+ "> core:hasSubOrganization ?subOrganization . "
|
+ "{"
|
||||||
+ "?subOrganization rdfs:label ?subOrganizationLabel . "
|
+ "<"+queryURI+ "> core:hasSubOrganization ?subOrganization . "
|
||||||
+ "?subOrganization core:organizationForPosition ?Position . "
|
+ "?subOrganization rdfs:label ?subOrganizationLabel . "
|
||||||
+ "?Position core:positionForPerson ?Person . "
|
+ "?subOrganization core:organizationForPosition ?Position . "
|
||||||
+ "?Person core:authorInAuthorship ?Resource . "
|
+ "?Position core:positionForPerson ?Person . "
|
||||||
+ "?Person rdfs:label ?PersonLabel . "
|
+ "?Person core:authorInAuthorship ?Resource . "
|
||||||
+ "?Resource core:linkedInformationResource ?Document . "
|
+ "?Person rdfs:label ?PersonLabel . "
|
||||||
+ "?Document rdf:type bibo:Document . "
|
+ "?Resource core:linkedInformationResource ?Document . "
|
||||||
+ "?Document rdfs:label ?DocumentLabel "
|
// + "?Document rdf:type bibo:Document . "
|
||||||
|
+ "?Document rdfs:label ?DocumentLabel "
|
||||||
|
+ "}"
|
||||||
|
+ "UNION "
|
||||||
|
+ "{"
|
||||||
|
+ "?Document core:dateTimeValue ?dateTimeValue . "
|
||||||
|
+ "?dateTimeValue core:dateTime ?publicationDate "
|
||||||
|
+ "}"
|
||||||
|
// + "UNION "
|
||||||
|
// + "{"
|
||||||
|
// + "?Document core:year ?publicationYearUsing_1_1_property "
|
||||||
|
// + "}"
|
||||||
|
|
||||||
+ "}" ;
|
+ "}" ;
|
||||||
|
|
||||||
|
|
||||||
|
@ -97,16 +112,31 @@ public class EntityPublicationCountConstructQueryRunner {
|
||||||
+ "?Person rdfs:label ?PersonLabel . "
|
+ "?Person rdfs:label ?PersonLabel . "
|
||||||
+ "?Resource core:linkedInformationResource ?Document . "
|
+ "?Resource core:linkedInformationResource ?Document . "
|
||||||
+ "?Document rdf:type bibo:Document . "
|
+ "?Document rdf:type bibo:Document . "
|
||||||
+ "?Document rdfs:label ?DocumentLabel "
|
+ "?Document rdfs:label ?DocumentLabel . "
|
||||||
|
+ "?Document core:dateTimeValue ?dateTimeValue . "
|
||||||
|
+ "?dateTimeValue core:dateTime ?publicationDate . "
|
||||||
|
// + "?Document core:year ?publicationYearUsing_1_1_property ."
|
||||||
+"}"
|
+"}"
|
||||||
+ "WHERE { "
|
+ "WHERE { "
|
||||||
+ "<"+queryURI+ "> core:organizationForPosition ?Position . "
|
+ "{"
|
||||||
+ "?Position core:positionForPerson ?Person . "
|
+ "<"+queryURI+ "> core:organizationForPosition ?Position . "
|
||||||
+ "?Person core:authorInAuthorship ?Resource . "
|
+ "?Position core:positionForPerson ?Person . "
|
||||||
+ "?Person rdfs:label ?PersonLabel . "
|
+ "?Person core:authorInAuthorship ?Resource . "
|
||||||
+ "?Resource core:linkedInformationResource ?Document . "
|
+ "?Person rdfs:label ?PersonLabel . "
|
||||||
+ "?Document rdf:type bibo:Document . "
|
+ "?Resource core:linkedInformationResource ?Document . "
|
||||||
+ "?Document rdfs:label ?DocumentLabel "
|
// + "?Document rdf:type bibo:Document . "
|
||||||
|
+ "?Document rdfs:label ?DocumentLabel "
|
||||||
|
+ "}"
|
||||||
|
+ "UNION"
|
||||||
|
+ "{"
|
||||||
|
+ "?Document core:dateTimeValue ?dateTimeValue . "
|
||||||
|
+ "?dateTimeValue core:dateTime ?publicationDate "
|
||||||
|
+ "}"
|
||||||
|
// + "UNION "
|
||||||
|
// + "{"
|
||||||
|
// + "?Document core:year ?publicationYearUsing_1_1_property "
|
||||||
|
// + "}"
|
||||||
|
|
||||||
+ "}" ;
|
+ "}" ;
|
||||||
|
|
||||||
|
|
||||||
|
@ -114,93 +144,90 @@ public class EntityPublicationCountConstructQueryRunner {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String generateConstructQueryForDocumentDateTimeValueOneLevelDeep(String queryURI){
|
// private String generateConstructQueryForDocumentDateTimeValueOneLevelDeep(String queryURI){
|
||||||
|
//
|
||||||
|
// String sparqlQuery =
|
||||||
|
//
|
||||||
|
// "CONSTRUCT { "
|
||||||
|
// + "<"+queryURI+ "> core:hasSubOrganization ?subOrganization . "
|
||||||
|
// + "?subOrganization core:organizationForPosition ?Position . "
|
||||||
|
// + "?Position core:positionForPerson ?Person . "
|
||||||
|
// + "?Person core:authorInAuthorship ?Resource . "
|
||||||
|
// + "?Resource core:linkedInformationResource ?Document . "
|
||||||
|
// + "?Document rdf:type bibo:Document . "
|
||||||
|
// + "?Document core:dateTimeValue ?dateTimeValue . "
|
||||||
|
// + "?dateTimeValue core:dateTime ?publicationDate . "
|
||||||
|
// + "?Document core:year ?publicationYearUsing_1_1_property "
|
||||||
|
// +"}"
|
||||||
|
// + "WHERE { "
|
||||||
|
// + "<"+queryURI+ "> core:hasSubOrganization ?subOrganization . "
|
||||||
|
// + "?subOrganization core:organizationForPosition ?Position . "
|
||||||
|
// + "?Position core:positionForPerson ?Person . "
|
||||||
|
// + "?Person core:authorInAuthorship ?Resource . "
|
||||||
|
// + "?Resource core:linkedInformationResource ?Document . "
|
||||||
|
// + "?Document rdf:type bibo:Document . "
|
||||||
|
// + "{"
|
||||||
|
// + "?Document core:dateTimeValue ?dateTimeValue . "
|
||||||
|
// + "?dateTimeValue core:dateTime ?publicationDate "
|
||||||
|
// + "}"
|
||||||
|
// + "UNION "
|
||||||
|
// + "{"
|
||||||
|
// + "?Document core:year ?publicationYearUsing_1_1_property "
|
||||||
|
// + "}"
|
||||||
|
// + "}" ;
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// return sparqlQuery;
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
|
||||||
String sparqlQuery =
|
// private String generateConstructQueryForDocumentDateTimeValue(String queryURI){
|
||||||
|
//
|
||||||
"CONSTRUCT { "
|
// String sparqlQuery =
|
||||||
+ "<"+queryURI+ "> core:hasSubOrganization ?subOrganization . "
|
//
|
||||||
+ "?subOrganization core:organizationForPosition ?Position . "
|
// "CONSTRUCT { "
|
||||||
+ "?Position core:positionForPerson ?Person . "
|
// + "<"+queryURI+ "> core:organizationForPosition ?Position . "
|
||||||
+ "?Person core:authorInAuthorship ?Resource . "
|
// + "?Position core:positionForPerson ?Person . "
|
||||||
+ "?Resource core:linkedInformationResource ?Document . "
|
// + "?Person core:authorInAuthorship ?Resource . "
|
||||||
+ "?Document rdf:type bibo:Document . "
|
// + "?Resource core:linkedInformationResource ?Document . "
|
||||||
+ "?Document core:dateTimeValue ?dateTimeValue . "
|
// + "?Document rdf:type bibo:Document . "
|
||||||
+ "?dateTimeValue core:dateTime ?publicationDate . "
|
// + "?Document core:dateTimeValue ?dateTimeValue . "
|
||||||
+ "?Document core:year ?publicationYearUsing_1_1_property "
|
// + "?dateTimeValue core:dateTime ?publicationDate . "
|
||||||
+"}"
|
// + "?Document core:year ?publicationYearUsing_1_1_property "
|
||||||
+ "WHERE { "
|
// +"}"
|
||||||
+ "<"+queryURI+ "> core:hasSubOrganization ?subOrganization . "
|
// + "WHERE { "
|
||||||
+ "?subOrganization core:organizationForPosition ?Position . "
|
// + "<"+queryURI+ "> core:organizationForPosition ?Position . "
|
||||||
+ "?Position core:positionForPerson ?Person . "
|
// + "?Position core:positionForPerson ?Person . "
|
||||||
+ "?Person core:authorInAuthorship ?Resource . "
|
// + "?Person core:authorInAuthorship ?Resource . "
|
||||||
+ "?Resource core:linkedInformationResource ?Document . "
|
// + "?Resource core:linkedInformationResource ?Document . "
|
||||||
+ "?Document rdf:type bibo:Document . "
|
// + "?Document rdf:type bibo:Document . "
|
||||||
+ "{"
|
// + "{"
|
||||||
+ "?Document core:dateTimeValue ?dateTimeValue . "
|
// + "?Document core:dateTimeValue ?dateTimeValue . "
|
||||||
+ "?dateTimeValue core:dateTime ?publicationDate "
|
// + "?dateTimeValue core:dateTime ?publicationDate "
|
||||||
+ "}"
|
// + "}"
|
||||||
+ "UNION "
|
// + "UNION "
|
||||||
+ "{"
|
// + "{"
|
||||||
+ "?Document core:year ?publicationYearUsing_1_1_property "
|
// + "?Document core:year ?publicationYearUsing_1_1_property "
|
||||||
+ "}"
|
// + "}"
|
||||||
+ "}" ;
|
// + "}" ;
|
||||||
|
//
|
||||||
|
//
|
||||||
return sparqlQuery;
|
// return sparqlQuery;
|
||||||
|
//
|
||||||
}
|
// }
|
||||||
|
|
||||||
private String generateConstructQueryForDocumentDateTimeValue(String queryURI){
|
|
||||||
|
|
||||||
String sparqlQuery =
|
|
||||||
|
|
||||||
"CONSTRUCT { "
|
|
||||||
+ "<"+queryURI+ "> core:organizationForPosition ?Position . "
|
|
||||||
+ "?Position core:positionForPerson ?Person . "
|
|
||||||
+ "?Person core:authorInAuthorship ?Resource . "
|
|
||||||
+ "?Resource core:linkedInformationResource ?Document . "
|
|
||||||
+ "?Document rdf:type bibo:Document . "
|
|
||||||
+ "?Document core:dateTimeValue ?dateTimeValue . "
|
|
||||||
+ "?dateTimeValue core:dateTime ?publicationDate . "
|
|
||||||
+ "?Document core:year ?publicationYearUsing_1_1_property "
|
|
||||||
+"}"
|
|
||||||
+ "WHERE { "
|
|
||||||
+ "<"+queryURI+ "> core:organizationForPosition ?Position . "
|
|
||||||
+ "?Position core:positionForPerson ?Person . "
|
|
||||||
+ "?Person core:authorInAuthorship ?Resource . "
|
|
||||||
+ "?Resource core:linkedInformationResource ?Document . "
|
|
||||||
+ "?Document rdf:type bibo:Document . "
|
|
||||||
+ "{"
|
|
||||||
+ "?Document core:dateTimeValue ?dateTimeValue . "
|
|
||||||
+ "?dateTimeValue core:dateTime ?publicationDate "
|
|
||||||
+ "}"
|
|
||||||
+ "UNION "
|
|
||||||
+ "{"
|
|
||||||
+ "?Document core:year ?publicationYearUsing_1_1_property "
|
|
||||||
+ "}"
|
|
||||||
+ "}" ;
|
|
||||||
|
|
||||||
|
|
||||||
return sparqlQuery;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private Model executeQuery(Set<String> constructQueries, Dataset Dataset) {
|
private Model executeQuery(Set<String> constructQueries, Dataset Dataset) {
|
||||||
|
|
||||||
Model constructedModel = ModelFactory.createDefaultModel();
|
Model constructedModel = ModelFactory.createDefaultModel();
|
||||||
|
|
||||||
before = System.currentTimeMillis();
|
|
||||||
|
|
||||||
for (String queryString : constructQueries) {
|
for (String queryString : constructQueries) {
|
||||||
|
before = System.currentTimeMillis();
|
||||||
log.debug("CONSTRUCT query string : " + queryString);
|
log.debug("CONSTRUCT query string : " + queryString);
|
||||||
|
|
||||||
Query query = null;
|
Query query = null;
|
||||||
|
|
||||||
try{
|
try{
|
||||||
query = QueryFactory.create(QueryConstants.getSparqlPrefixQuery() + queryString, SYNTAX);
|
query = QueryFactory.create(QueryConstants.getSparqlPrefixQuery() + queryString, SYNTAX);
|
||||||
//log.info("query: "+ queryString);
|
|
||||||
}catch(Throwable th){
|
}catch(Throwable th){
|
||||||
log.error("Could not create CONSTRUCT SPARQL query for query " +
|
log.error("Could not create CONSTRUCT SPARQL query for query " +
|
||||||
"string. " + th.getMessage());
|
"string. " + th.getMessage());
|
||||||
|
@ -209,16 +236,16 @@ public class EntityPublicationCountConstructQueryRunner {
|
||||||
|
|
||||||
QueryExecution qe = QueryExecutionFactory.create(
|
QueryExecution qe = QueryExecutionFactory.create(
|
||||||
query, Dataset);
|
query, Dataset);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
qe.execConstruct(constructedModel);
|
qe.execConstruct(constructedModel);
|
||||||
} finally {
|
} finally {
|
||||||
qe.close();
|
qe.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
after = System.currentTimeMillis();
|
||||||
|
log.debug("Time taken to execute the CONSTRUCT queries is in milliseconds: " + (after - before) );
|
||||||
}
|
}
|
||||||
|
|
||||||
after = System.currentTimeMillis();
|
|
||||||
log.info("Time taken to execute the CONSTRUCT queries is in milliseconds: " + (after - before) );
|
|
||||||
// constructedModel.write(System.out);
|
// constructedModel.write(System.out);
|
||||||
return constructedModel;
|
return constructedModel;
|
||||||
}
|
}
|
||||||
|
@ -258,8 +285,8 @@ public class EntityPublicationCountConstructQueryRunner {
|
||||||
constructQueries.add(generateConstructQueryForOrganizationLabel(this.egoURI));
|
constructQueries.add(generateConstructQueryForOrganizationLabel(this.egoURI));
|
||||||
constructQueries.add(generateConstructQueryForSubOrganizations(this.egoURI));
|
constructQueries.add(generateConstructQueryForSubOrganizations(this.egoURI));
|
||||||
constructQueries.add(generateConstructQueryForPersons(this.egoURI));
|
constructQueries.add(generateConstructQueryForPersons(this.egoURI));
|
||||||
constructQueries.add(generateConstructQueryForDocumentDateTimeValueOneLevelDeep(this.egoURI));
|
// constructQueries.add(generateConstructQueryForDocumentDateTimeValueOneLevelDeep(this.egoURI));
|
||||||
constructQueries.add(generateConstructQueryForDocumentDateTimeValue(this.egoURI));
|
// constructQueries.add(generateConstructQueryForDocumentDateTimeValue(this.egoURI));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,11 +108,11 @@ public class EntityPublicationCountQueryRunner implements QueryRunner<Entity> {
|
||||||
biboDocument = new BiboDocument(documentNode.toString());
|
biboDocument = new BiboDocument(documentNode.toString());
|
||||||
biboDocumentURLToVO.put(documentNode.toString(), biboDocument);
|
biboDocumentURLToVO.put(documentNode.toString(), biboDocument);
|
||||||
|
|
||||||
RDFNode documentLabelNode = solution
|
// RDFNode documentLabelNode = solution
|
||||||
.get(QueryFieldLabels.DOCUMENT_LABEL);
|
// .get(QueryFieldLabels.DOCUMENT_LABEL);
|
||||||
if (documentLabelNode != null) {
|
// if (documentLabelNode != null) {
|
||||||
biboDocument.setDocumentLabel(documentLabelNode.toString());
|
// biboDocument.setDocumentLabel(documentLabelNode.toString());
|
||||||
}
|
// }
|
||||||
|
|
||||||
RDFNode publicationDateNode = solution.get(QueryFieldLabels.DOCUMENT_PUBLICATION_DATE);
|
RDFNode publicationDateNode = solution.get(QueryFieldLabels.DOCUMENT_PUBLICATION_DATE);
|
||||||
if (publicationDateNode != null) {
|
if (publicationDateNode != null) {
|
||||||
|
|
|
@ -54,9 +54,6 @@ public class EntitySubOrganizationTypesConstructQueryRunner {
|
||||||
|
|
||||||
private String generateConstructQueryForSubOrganizationTypes(String queryURI){
|
private String generateConstructQueryForSubOrganizationTypes(String queryURI){
|
||||||
|
|
||||||
//bdc34: this query was lacking the personLabel, personType, and personTypeLabel in the WHERE clause
|
|
||||||
//it seems like they are needed since they are referenced in the CONSTRUCT clause.
|
|
||||||
|
|
||||||
String sparqlQuery =
|
String sparqlQuery =
|
||||||
|
|
||||||
"CONSTRUCT { "
|
"CONSTRUCT { "
|
||||||
|
|
|
@ -12,7 +12,7 @@ import org.apache.commons.logging.LogFactory;
|
||||||
import com.hp.hpl.jena.iri.IRI;
|
import com.hp.hpl.jena.iri.IRI;
|
||||||
import com.hp.hpl.jena.iri.IRIFactory;
|
import com.hp.hpl.jena.iri.IRIFactory;
|
||||||
import com.hp.hpl.jena.iri.Violation;
|
import com.hp.hpl.jena.iri.Violation;
|
||||||
import com.hp.hpl.jena.query.DataSource;
|
import com.hp.hpl.jena.query.Dataset;
|
||||||
import com.hp.hpl.jena.query.Query;
|
import com.hp.hpl.jena.query.Query;
|
||||||
import com.hp.hpl.jena.query.QueryExecution;
|
import com.hp.hpl.jena.query.QueryExecution;
|
||||||
import com.hp.hpl.jena.query.QueryExecutionFactory;
|
import com.hp.hpl.jena.query.QueryExecutionFactory;
|
||||||
|
@ -26,181 +26,188 @@ import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryP
|
||||||
|
|
||||||
public class PersonGrantCountConstructQueryRunner {
|
public class PersonGrantCountConstructQueryRunner {
|
||||||
|
|
||||||
protected static final Syntax SYNTAX = Syntax.syntaxARQ;
|
protected static final Syntax SYNTAX = Syntax.syntaxARQ;
|
||||||
|
|
||||||
private String egoURI;
|
private String egoURI;
|
||||||
|
|
||||||
private DataSource dataSource;
|
private Dataset Dataset;
|
||||||
|
|
||||||
private Log log = LogFactory.getLog(PersonGrantCountConstructQueryRunner.class.getName());
|
private Log log = LogFactory.getLog(PersonGrantCountConstructQueryRunner.class.getName());
|
||||||
|
|
||||||
public PersonGrantCountConstructQueryRunner(String egoURI, DataSource dataSource, Log log){
|
public PersonGrantCountConstructQueryRunner(String egoURI, Dataset Dataset, Log log){
|
||||||
this.egoURI = egoURI;
|
this.egoURI = egoURI;
|
||||||
this.dataSource = dataSource;
|
this.Dataset = Dataset;
|
||||||
//this.log = log;
|
//this.log = log;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String generateConstructQueryForInvestigatorLabel(String queryURI) {
|
private String generateConstructQueryForInvestigatorLabel(String queryURI) {
|
||||||
|
|
||||||
String sparqlQuery =
|
String sparqlQuery =
|
||||||
"CONSTRUCT { "
|
"CONSTRUCT { "
|
||||||
+ "<"+queryURI+ "> rdfs:label ?investigatorLabel ."
|
+ "<"+queryURI+ "> rdfs:label ?investigatorLabel ."
|
||||||
+ "}"
|
+ "}"
|
||||||
+ "WHERE {"
|
+ "WHERE {"
|
||||||
+ "<"+queryURI+ "> rdfs:label ?investigatorLabel "
|
+ "<"+queryURI+ "> rdfs:label ?investigatorLabel "
|
||||||
+ "}";
|
+ "}";
|
||||||
|
|
||||||
return sparqlQuery;
|
return sparqlQuery;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String generateConstructQueryForInvestigatorGrants(String queryURI){
|
private String generateConstructQueryForInvestigatorGrants(String queryURI, String preboundProperty){
|
||||||
|
|
||||||
String sparqlQuery = ""
|
String sparqlQuery = ""
|
||||||
+ "CONSTRUCT { "
|
+ "CONSTRUCT { "
|
||||||
+ "<"+queryURI+ "> ?preboundProperty ?Role . "
|
+ "<"+queryURI+ ">" + preboundProperty + " ?Role . "
|
||||||
+ "?Role core:roleIn ?Grant ."
|
+ "?Role core:roleIn ?Grant ."
|
||||||
+ "?Grant rdfs:label ?GrantLabel "
|
+ "?Grant rdfs:label ?GrantLabel "
|
||||||
+ "} "
|
+ "} "
|
||||||
+ "WHERE { "
|
+ "WHERE { "
|
||||||
+ "<"+queryURI+ "> ?preboundProperty ?Role . "
|
+ "<"+queryURI+ ">" + preboundProperty + " ?Role . "
|
||||||
+ "?Role core:roleIn ?Grant ."
|
+ "?Role core:roleIn ?Grant ."
|
||||||
+ "?Grant rdfs:label ?GrantLabel "
|
+ "?Grant rdfs:label ?GrantLabel "
|
||||||
+ "} ";
|
+ "} ";
|
||||||
|
|
||||||
return sparqlQuery;
|
return sparqlQuery;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String generateConstructQueryForDateTimeValueofRole(String queryURI){
|
private String generateConstructQueryForDateTimeValueofRole(String queryURI, String preboundProperty){
|
||||||
|
|
||||||
String sparqlQuery =
|
String sparqlQuery =
|
||||||
"CONSTRUCT { "
|
"CONSTRUCT { "
|
||||||
+ "<"+queryURI+ "> ?preboundProperty ?Role . "
|
+ "<"+queryURI+ ">" + preboundProperty + " ?Role . "
|
||||||
+ "?Role core:dateTimeInterval ?dateTimeIntervalValue . "
|
+ "?Role core:dateTimeInterval ?dateTimeIntervalValue . "
|
||||||
+ "?dateTimeIntervalValue core:start ?startDate . "
|
+ "?dateTimeIntervalValue core:start ?startDate . "
|
||||||
+ "?startDate core:dateTime ?startDateTimeValue . "
|
+ "?startDate core:dateTime ?startDateTimeValue . "
|
||||||
+ "?dateTimeIntervalValue core:end ?endDate . "
|
+ "?dateTimeIntervalValue core:end ?endDate . "
|
||||||
+ "?endDate core:dateTime ?endDateTimeValue . "
|
+ "?endDate core:dateTime ?endDateTimeValue . "
|
||||||
+ "}"
|
+ "}"
|
||||||
+ "WHERE { "
|
+ "WHERE { "
|
||||||
+ "{"
|
+ "{"
|
||||||
+ "<"+queryURI+ "> ?preboundProperty ?Role . "
|
+ "<"+queryURI+ ">" + preboundProperty + " ?Role . "
|
||||||
+ "?Role core:dateTimeInterval ?dateTimeIntervalValue . "
|
+ "?Role core:dateTimeInterval ?dateTimeIntervalValue . "
|
||||||
+ "?dateTimeIntervalValue core:start ?startDate . "
|
+ "?dateTimeIntervalValue core:start ?startDate . "
|
||||||
+ "?startDate core:dateTime ?startDateTimeValue . "
|
+ "?startDate core:dateTime ?startDateTimeValue . "
|
||||||
+ "} UNION "
|
+ "} UNION "
|
||||||
+ "{"
|
+ "{"
|
||||||
+ "<"+queryURI+ "> ?preboundProperty ?Role . "
|
+ "<"+queryURI+ ">" + preboundProperty + " ?Role . "
|
||||||
+ "?Role core:dateTimeInterval ?dateTimeIntervalValue . "
|
+ "?Role core:dateTimeInterval ?dateTimeIntervalValue . "
|
||||||
+ "?dateTimeIntervalValue core:end ?endDate . "
|
+ "?dateTimeIntervalValue core:end ?endDate . "
|
||||||
+ "?endDate core:dateTime ?endDateTimeValue . "
|
+ "?endDate core:dateTime ?endDateTimeValue . "
|
||||||
+ "}"
|
+ "}"
|
||||||
+ "}";
|
+ "}";
|
||||||
|
|
||||||
return sparqlQuery;
|
return sparqlQuery;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String generateConstructQueryForDateTimeValueofGrant(String queryURI){
|
private String generateConstructQueryForDateTimeValueofGrant(String queryURI, String preboundProperty){
|
||||||
|
|
||||||
String sparqlQuery =
|
String sparqlQuery =
|
||||||
"CONSTRUCT { "
|
"CONSTRUCT { "
|
||||||
+ "<"+queryURI+ "> ?preboundProperty ?Role . "
|
+ "<"+queryURI+ ">" + preboundProperty + " ?Role . "
|
||||||
+ "?Role core:roleIn ?Grant ."
|
+ "?Role core:roleIn ?Grant ."
|
||||||
+ "?Grant core:dateTimeInterval ?dateTimeIntervalValueForGrant . "
|
+ "?Grant core:dateTimeInterval ?dateTimeIntervalValueForGrant . "
|
||||||
+ "?dateTimeIntervalValueForGrant core:start ?startDateForGrant . "
|
+ "?dateTimeIntervalValueForGrant core:start ?startDateForGrant . "
|
||||||
+ "?startDateForGrant core:dateTime ?startDateTimeValueForGrant . "
|
+ "?startDateForGrant core:dateTime ?startDateTimeValueForGrant . "
|
||||||
+ "?dateTimeIntervalValueForGrant core:end ?endDateForGrant . "
|
+ "?dateTimeIntervalValueForGrant core:end ?endDateForGrant . "
|
||||||
+ "?endDateForGrant core:dateTime ?endDateTimeValueForGrant . "
|
+ "?endDateForGrant core:dateTime ?endDateTimeValueForGrant . "
|
||||||
+ "}"
|
+ "}"
|
||||||
+ "WHERE { "
|
+ "WHERE { "
|
||||||
+ "{"
|
+ "{"
|
||||||
+ "<"+queryURI+ "> ?preboundProperty ?Role . "
|
+ "<"+queryURI+ ">" + preboundProperty + " ?Role . "
|
||||||
+ "?Role core:roleIn ?Grant ."
|
+ "?Role core:roleIn ?Grant ."
|
||||||
+ "?Grant core:dateTimeInterval ?dateTimeIntervalValueForGrant . "
|
+ "?Grant core:dateTimeInterval ?dateTimeIntervalValueForGrant . "
|
||||||
+ "?dateTimeIntervalValueForGrant core:start ?startDateForGrant . "
|
+ "?dateTimeIntervalValueForGrant core:start ?startDateForGrant . "
|
||||||
+ "?startDateForGrant core:dateTime ?startDateTimeValueForGrant . "
|
+ "?startDateForGrant core:dateTime ?startDateTimeValueForGrant . "
|
||||||
+ "} UNION "
|
+ "} UNION "
|
||||||
+ "{"
|
+ "{"
|
||||||
+ "<"+queryURI+ "> ?preboundProperty ?Role . "
|
+ "<"+queryURI+ ">" + preboundProperty + " ?Role . "
|
||||||
+ "?Role core:roleIn ?Grant ."
|
+ "?Role core:roleIn ?Grant ."
|
||||||
+ "?Grant core:dateTimeInterval ?dateTimeIntervalValueForGrant . "
|
+ "?Grant core:dateTimeInterval ?dateTimeIntervalValueForGrant . "
|
||||||
+ "?dateTimeIntervalValueForGrant core:end ?endDateForGrant . "
|
+ "?dateTimeIntervalValueForGrant core:end ?endDateForGrant . "
|
||||||
+ "?endDateForGrant core:dateTime ?endDateTimeValueForGrant . "
|
+ "?endDateForGrant core:dateTime ?endDateTimeValueForGrant . "
|
||||||
+ "}"
|
+ "}"
|
||||||
+ "}";
|
+ "}";
|
||||||
|
|
||||||
return sparqlQuery;
|
return sparqlQuery;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Model executeQuery(Set<String> constructQueries, DataSource dataSource) {
|
private Model executeQuery(Set<String> constructQueries, Dataset Dataset) {
|
||||||
|
|
||||||
Model constructedModel = ModelFactory.createDefaultModel();
|
Model constructedModel = ModelFactory.createDefaultModel();
|
||||||
|
|
||||||
for (String queryString : constructQueries) {
|
for (String queryString : constructQueries) {
|
||||||
|
long start = System.currentTimeMillis();
|
||||||
|
log.debug("CONSTRUCT query string : " + queryString);
|
||||||
|
|
||||||
log.debug("CONSTRUCT query string : " + queryString);
|
Query query = null;
|
||||||
|
|
||||||
Query query = null;
|
try{
|
||||||
|
query = QueryFactory.create(QueryConstants.getSparqlPrefixQuery() + queryString, SYNTAX);
|
||||||
try{
|
}catch(Throwable th){
|
||||||
query = QueryFactory.create(QueryConstants.getSparqlPrefixQuery() + queryString, SYNTAX);
|
|
||||||
}catch(Throwable th){
|
|
||||||
log.error("Could not create CONSTRUCT SPARQL query for query " +
|
log.error("Could not create CONSTRUCT SPARQL query for query " +
|
||||||
"string. " + th.getMessage());
|
"string. " + th.getMessage());
|
||||||
log.error(queryString);
|
log.error(queryString);
|
||||||
}
|
}
|
||||||
|
|
||||||
QueryExecution qe = QueryExecutionFactory.create(
|
QueryExecution qe = QueryExecutionFactory.create(
|
||||||
query, dataSource);
|
query, Dataset);
|
||||||
try {
|
try {
|
||||||
qe.execConstruct(constructedModel);
|
qe.execConstruct(constructedModel);
|
||||||
} finally {
|
} finally {
|
||||||
qe.close();
|
qe.close();
|
||||||
}
|
}
|
||||||
|
log.debug("time to run construct: " + (System.currentTimeMillis() - start));
|
||||||
}
|
}
|
||||||
|
|
||||||
return constructedModel;
|
return constructedModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Model getConstructedModel()
|
public Model getConstructedModel()
|
||||||
throws MalformedQueryParametersException {
|
throws MalformedQueryParametersException {
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(this.egoURI)) {
|
if (StringUtils.isNotBlank(this.egoURI)) {
|
||||||
/*
|
/*
|
||||||
* To test for the validity of the URI submitted.
|
* To test for the validity of the URI submitted.
|
||||||
* */
|
* */
|
||||||
IRIFactory iRIFactory = IRIFactory.jenaImplementation();
|
IRIFactory iRIFactory = IRIFactory.jenaImplementation();
|
||||||
IRI iri = iRIFactory.create(this.egoURI);
|
IRI iri = iRIFactory.create(this.egoURI);
|
||||||
if (iri.hasViolation(false)) {
|
if (iri.hasViolation(false)) {
|
||||||
String errorMsg = ((Violation) iri.violations(false).next()).getShortMessage();
|
String errorMsg = ((Violation) iri.violations(false).next()).getShortMessage();
|
||||||
log.error("Person Grant Count Construct Query " + errorMsg);
|
log.error("Person Grant Count Construct Query " + errorMsg);
|
||||||
throw new MalformedQueryParametersException(
|
throw new MalformedQueryParametersException(
|
||||||
"URI provided for an individual is malformed.");
|
"URI provided for an individual is malformed.");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new MalformedQueryParametersException("URI parameter is either null or empty.");
|
throw new MalformedQueryParametersException("URI parameter is either null or empty.");
|
||||||
}
|
}
|
||||||
|
|
||||||
Set<String> constructQueries = new HashSet<String>();
|
Set<String> constructQueries = new HashSet<String>();
|
||||||
|
|
||||||
populateConstructQueries(constructQueries);
|
populateConstructQueries(constructQueries);
|
||||||
|
|
||||||
Model model = executeQuery(constructQueries,
|
Model model = executeQuery(constructQueries,
|
||||||
this.dataSource);
|
this.Dataset);
|
||||||
|
|
||||||
return model;
|
return model;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void populateConstructQueries(Set<String> constructQueries) {
|
private void populateConstructQueries(Set<String> constructQueries) {
|
||||||
|
|
||||||
constructQueries.add(generateConstructQueryForInvestigatorLabel(this.egoURI));
|
constructQueries.add(generateConstructQueryForInvestigatorLabel(this.egoURI));
|
||||||
constructQueries.add(generateConstructQueryForInvestigatorGrants(this.egoURI));
|
|
||||||
constructQueries.add(generateConstructQueryForDateTimeValueofRole(this.egoURI));
|
|
||||||
constructQueries.add(generateConstructQueryForDateTimeValueofGrant(this.egoURI));
|
|
||||||
|
|
||||||
|
constructQueries.add(generateConstructQueryForInvestigatorGrants(this.egoURI, " core:hasInvestigatorRole "));
|
||||||
|
constructQueries.add(generateConstructQueryForDateTimeValueofRole(this.egoURI, " core:hasInvestigatorRole "));
|
||||||
|
constructQueries.add(generateConstructQueryForDateTimeValueofGrant(this.egoURI, " core:hasInvestigatorRole "));
|
||||||
|
|
||||||
}
|
constructQueries.add(generateConstructQueryForInvestigatorGrants(this.egoURI, " core:hasPrincipalInvestigatorRole "));
|
||||||
|
constructQueries.add(generateConstructQueryForDateTimeValueofRole(this.egoURI, " core:hasPrincipalInvestigatorRole "));
|
||||||
|
constructQueries.add(generateConstructQueryForDateTimeValueofGrant(this.egoURI, " core:hasPrincipalInvestigatorRole "));
|
||||||
|
|
||||||
|
constructQueries.add(generateConstructQueryForInvestigatorGrants(this.egoURI, " core:hasCo-PrincipalInvestigatorRole "));
|
||||||
|
constructQueries.add(generateConstructQueryForDateTimeValueofRole(this.egoURI, " core:hasCo-PrincipalInvestigatorRole "));
|
||||||
|
constructQueries.add(generateConstructQueryForDateTimeValueofGrant(this.egoURI, " core:hasCo-PrincipalInvestigatorRole "));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -1,41 +0,0 @@
|
||||||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
|
||||||
|
|
||||||
package edu.cornell.mannlib.vitro.webapp.visualization.freemarker.personpubcount;
|
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
|
|
||||||
import com.hp.hpl.jena.query.Dataset;
|
|
||||||
import com.hp.hpl.jena.query.Syntax;
|
|
||||||
|
|
||||||
public class PersonPublicationCountConstructQueryRunner {
|
|
||||||
|
|
||||||
protected static final Syntax SYNTAX = Syntax.syntaxARQ;
|
|
||||||
|
|
||||||
private String egoURI;
|
|
||||||
|
|
||||||
private Dataset Dataset;
|
|
||||||
|
|
||||||
private Log log = LogFactory.getLog(PersonPublicationCountConstructQueryRunner.class.getName());
|
|
||||||
|
|
||||||
private long before, after;
|
|
||||||
|
|
||||||
public PersonPublicationCountConstructQueryRunner(String egoURI, Dataset Dataset, Log log){
|
|
||||||
this.egoURI = egoURI;
|
|
||||||
this.Dataset = Dataset;
|
|
||||||
//this.log = log;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String generateConstructQueryForAuthorLabel(String queryURI) {
|
|
||||||
|
|
||||||
String sparqlQuery =
|
|
||||||
"CONSTRUCT { "
|
|
||||||
+ "<"+queryURI+ "> rdfs:label ?authorLabel ."
|
|
||||||
+ "}"
|
|
||||||
+ "WHERE {"
|
|
||||||
+ "<"+queryURI+ "> rdfs:label ?authorLabel ."
|
|
||||||
+ "}";
|
|
||||||
|
|
||||||
return sparqlQuery;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -54,21 +54,14 @@ public class PersonPublicationCountQueryRunner implements QueryRunner<Set<BiboDo
|
||||||
private static final String SPARQL_QUERY_COMMON_SELECT_CLAUSE = ""
|
private static final String SPARQL_QUERY_COMMON_SELECT_CLAUSE = ""
|
||||||
+ "SELECT (str(?authorLabel) as ?" + QueryFieldLabels.AUTHOR_LABEL + ") \n"
|
+ "SELECT (str(?authorLabel) as ?" + QueryFieldLabels.AUTHOR_LABEL + ") \n"
|
||||||
+ " (str(?document) as ?" + QueryFieldLabels.DOCUMENT_URL + ") \n"
|
+ " (str(?document) as ?" + QueryFieldLabels.DOCUMENT_URL + ") \n"
|
||||||
+ " (str(?documentMoniker) as ?" + QueryFieldLabels.DOCUMENT_MONIKER + ") \n"
|
+ " (str(?publicationDate) as ?" + QueryFieldLabels.DOCUMENT_PUBLICATION_DATE + ") \n";
|
||||||
+ " (str(?documentLabel) as ?" + QueryFieldLabels.DOCUMENT_LABEL + ") \n"
|
// + " (str(?publicationYearUsing_1_1_property) as ?" + QueryFieldLabels.DOCUMENT_PUBLICATION_YEAR_USING_1_1_PROPERTY + ") \n";
|
||||||
+ " (str(?documentBlurb) as ?" + QueryFieldLabels.DOCUMENT_BLURB + ") \n"
|
|
||||||
+ " (str(?publicationDate) as ?" + QueryFieldLabels.DOCUMENT_PUBLICATION_DATE + ") \n"
|
|
||||||
+ " (str(?publicationYearUsing_1_1_property) as ?" + QueryFieldLabels.DOCUMENT_PUBLICATION_YEAR_USING_1_1_PROPERTY + ") \n"
|
|
||||||
+ " (str(?documentDescription) as ?" + QueryFieldLabels.DOCUMENT_DESCRIPTION + ") \n";
|
|
||||||
|
|
||||||
private static final String SPARQL_QUERY_COMMON_WHERE_CLAUSE = ""
|
private static final String SPARQL_QUERY_COMMON_WHERE_CLAUSE = ""
|
||||||
+ "?document rdfs:label ?documentLabel .\n"
|
+ "?document rdfs:label ?documentLabel .\n"
|
||||||
+ "OPTIONAL { ?document core:dateTimeValue ?dateTimeValue . \n"
|
+ "OPTIONAL { ?document core:dateTimeValue ?dateTimeValue . \n"
|
||||||
+ " ?dateTimeValue core:dateTime ?publicationDate } .\n"
|
+ " ?dateTimeValue core:dateTime ?publicationDate } .\n" ;
|
||||||
+ "OPTIONAL { ?document core:year ?publicationYearUsing_1_1_property } .\n"
|
//+ "OPTIONAL { ?document core:year ?publicationYearUsing_1_1_property } ." ;
|
||||||
+ "OPTIONAL { ?document vitro:moniker ?documentMoniker } .\n"
|
|
||||||
+ "OPTIONAL { ?document vitro:blurb ?documentBlurb } .\n"
|
|
||||||
+ "OPTIONAL { ?document vitro:description ?documentDescription }\n";
|
|
||||||
|
|
||||||
public PersonPublicationCountQueryRunner(String personURI,
|
public PersonPublicationCountQueryRunner(String personURI,
|
||||||
Dataset Dataset, Log log) {
|
Dataset Dataset, Log log) {
|
||||||
|
@ -89,27 +82,6 @@ public class PersonPublicationCountQueryRunner implements QueryRunner<Set<BiboDo
|
||||||
solution.get(QueryFieldLabels.DOCUMENT_URL)
|
solution.get(QueryFieldLabels.DOCUMENT_URL)
|
||||||
.toString());
|
.toString());
|
||||||
|
|
||||||
RDFNode documentLabelNode = solution.get(QueryFieldLabels.DOCUMENT_LABEL);
|
|
||||||
if (documentLabelNode != null) {
|
|
||||||
biboDocument.setDocumentLabel(documentLabelNode.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
RDFNode documentBlurbNode = solution.get(QueryFieldLabels.DOCUMENT_BLURB);
|
|
||||||
if (documentBlurbNode != null) {
|
|
||||||
biboDocument.setDocumentBlurb(documentBlurbNode.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
RDFNode documentmonikerNode = solution.get(QueryFieldLabels.DOCUMENT_MONIKER);
|
|
||||||
if (documentmonikerNode != null) {
|
|
||||||
biboDocument.setDocumentMoniker(documentmonikerNode.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
RDFNode documentDescriptionNode = solution.get(QueryFieldLabels.DOCUMENT_DESCRIPTION);
|
|
||||||
if (documentDescriptionNode != null) {
|
|
||||||
biboDocument.setDocumentDescription(documentDescriptionNode.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
RDFNode publicationDateNode = solution.get(QueryFieldLabels.DOCUMENT_PUBLICATION_DATE);
|
RDFNode publicationDateNode = solution.get(QueryFieldLabels.DOCUMENT_PUBLICATION_DATE);
|
||||||
if (publicationDateNode != null) {
|
if (publicationDateNode != null) {
|
||||||
biboDocument.setPublicationDate(publicationDateNode.toString());
|
biboDocument.setPublicationDate(publicationDateNode.toString());
|
||||||
|
@ -118,10 +90,10 @@ public class PersonPublicationCountQueryRunner implements QueryRunner<Set<BiboDo
|
||||||
/*
|
/*
|
||||||
* This is being used so that date in the data from pre-1.2 ontology can be captured.
|
* This is being used so that date in the data from pre-1.2 ontology can be captured.
|
||||||
* */
|
* */
|
||||||
RDFNode publicationYearUsing_1_1_PropertyNode = solution.get(QueryFieldLabels.DOCUMENT_PUBLICATION_YEAR_USING_1_1_PROPERTY);
|
// RDFNode publicationYearUsing_1_1_PropertyNode = solution.get(QueryFieldLabels.DOCUMENT_PUBLICATION_YEAR_USING_1_1_PROPERTY);
|
||||||
if (publicationYearUsing_1_1_PropertyNode != null) {
|
// if (publicationYearUsing_1_1_PropertyNode != null) {
|
||||||
biboDocument.setPublicationYear(publicationYearUsing_1_1_PropertyNode.toString());
|
// biboDocument.setPublicationYear(publicationYearUsing_1_1_PropertyNode.toString());
|
||||||
}
|
// }
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Since we are getting publication count for just one author at a time we need
|
* Since we are getting publication count for just one author at a time we need
|
||||||
|
@ -165,7 +137,7 @@ public class PersonPublicationCountQueryRunner implements QueryRunner<Set<BiboDo
|
||||||
+ SPARQL_QUERY_COMMON_WHERE_CLAUSE
|
+ SPARQL_QUERY_COMMON_WHERE_CLAUSE
|
||||||
+ "}\n";
|
+ "}\n";
|
||||||
|
|
||||||
// System.out.println(sparqlQuery);
|
log.debug(sparqlQuery);
|
||||||
|
|
||||||
return sparqlQuery;
|
return sparqlQuery;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,6 @@ import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.joda.time.DateTime;
|
import org.joda.time.DateTime;
|
||||||
import org.joda.time.format.DateTimeFormatter;
|
|
||||||
import org.joda.time.format.ISODateTimeFormat;
|
|
||||||
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.constants.VOConstants;
|
import edu.cornell.mannlib.vitro.webapp.visualization.constants.VOConstants;
|
||||||
import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.visutils.UtilityFunctions;
|
import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.visutils.UtilityFunctions;
|
||||||
|
@ -18,9 +16,6 @@ import edu.cornell.mannlib.vitro.webapp.visualization.freemarker.visutils.Utilit
|
||||||
*/
|
*/
|
||||||
public class BiboDocument extends Individual {
|
public class BiboDocument extends Individual {
|
||||||
|
|
||||||
private String documentMoniker;
|
|
||||||
private String documentBlurb;
|
|
||||||
private String documentDescription;
|
|
||||||
private String publicationYear;
|
private String publicationYear;
|
||||||
private String publicationDate;
|
private String publicationDate;
|
||||||
private String parsedPublicationYear = VOConstants.DEFAULT_PUBLICATION_YEAR;
|
private String parsedPublicationYear = VOConstants.DEFAULT_PUBLICATION_YEAR;
|
||||||
|
@ -33,34 +28,6 @@ public class BiboDocument extends Individual {
|
||||||
return this.getIndividualURI();
|
return this.getIndividualURI();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDocumentMoniker() {
|
|
||||||
return documentMoniker;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDocumentMoniker(String documentMoniker) {
|
|
||||||
this.documentMoniker = documentMoniker;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDocumentLabel() {
|
|
||||||
return this.getIndividualLabel();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDocumentLabel(String documentLabel) {
|
|
||||||
this.setIndividualLabel(documentLabel);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDocumentBlurb() {
|
|
||||||
return documentBlurb;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDocumentBlurb(String documentBlurb) {
|
|
||||||
this.documentBlurb = documentBlurb;
|
|
||||||
|
|
||||||
// if (documentBlurb != null) {
|
|
||||||
// this.setParsedPublicationYear(parsePublicationYear(documentBlurb));
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
private String parsePublicationYear(String documentBlurb) {
|
private String parsePublicationYear(String documentBlurb) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -94,13 +61,6 @@ public class BiboDocument extends Individual {
|
||||||
return publishedYear;
|
return publishedYear;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDocumentDescription() {
|
|
||||||
return documentDescription;
|
|
||||||
}
|
|
||||||
public void setDocumentDescription(String documentDescription) {
|
|
||||||
this.documentDescription = documentDescription;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method will be called to get the final/inferred year for the publication.
|
* This method will be called to get the final/inferred year for the publication.
|
||||||
* The 3 choices, in order, are,
|
* The 3 choices, in order, are,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue