Deprecate the old visualisation model code - will be removed in the next release, but stays for now in case it is used by anyone
This commit is contained in:
parent
e0ae5e1f96
commit
e8c6abb871
19 changed files with 494 additions and 178 deletions
|
@ -11,33 +11,49 @@ import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryP
|
|||
import edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.factory.ModelFactoryInterface;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.factory.PersonToGrantsFactory;
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
@SuppressWarnings("deprecation,serial")
|
||||
public class ModelConstructorUtilities {
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
private static final Map<String, ModelFactoryInterface> modelTypeIdentifierToFactory = new HashMap<String, ModelFactoryInterface>() {{
|
||||
// put(PersonToPublicationsModelConstructor.MODEL_TYPE, new PersonToPublicationsFactory());
|
||||
// put(PeopleToPublicationsModelConstructor.MODEL_TYPE, new PeopleToPublicationsFactory());
|
||||
// Currently in use, but probably should be deprecated with the others
|
||||
put(PersonToGrantsModelConstructor.MODEL_TYPE, new PersonToGrantsFactory());
|
||||
// put(PeopleToGrantsModelConstructor.MODEL_TYPE, new PeopleToGrantsFactory());
|
||||
// put(OrganizationToPublicationsForSubOrganizationsModelConstructor.MODEL_TYPE, new OrganizationToPublicationsForSubOrganizationsFactory());
|
||||
// put(OrganizationToGrantsForSubOrganizationsModelConstructor.MODEL_TYPE, new OrganizationToGrantsForSubOrganizationsFactory());
|
||||
// put(OrganizationAssociatedPeopleModelWithTypesConstructor.MODEL_TYPE, new OrganizationAssociatedPeopleModelWithTypesFactory());
|
||||
// put(OrganizationModelWithTypesConstructor.MODEL_TYPE, new OrganizationModelWithTypesFactory());
|
||||
// put(SubOrganizationWithinModelConstructor.MODEL_TYPE, new SubOrganizationWithinModelFactory());
|
||||
|
||||
/**
|
||||
* The following models are deprecated and will be removed
|
||||
*/
|
||||
put(PersonToPublicationsModelConstructor.MODEL_TYPE, new edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.factory.PersonToPublicationsFactory());
|
||||
put(PeopleToPublicationsModelConstructor.MODEL_TYPE, new edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.factory.PeopleToPublicationsFactory());
|
||||
put(PeopleToGrantsModelConstructor.MODEL_TYPE, new edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.factory.PeopleToGrantsFactory());
|
||||
put(OrganizationToPublicationsForSubOrganizationsModelConstructor.MODEL_TYPE, new edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.factory.OrganizationToPublicationsForSubOrganizationsFactory());
|
||||
put(OrganizationToGrantsForSubOrganizationsModelConstructor.MODEL_TYPE, new edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.factory.OrganizationToGrantsForSubOrganizationsFactory());
|
||||
put(OrganizationAssociatedPeopleModelWithTypesConstructor.MODEL_TYPE, new edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.factory.OrganizationAssociatedPeopleModelWithTypesFactory());
|
||||
put(OrganizationModelWithTypesConstructor.MODEL_TYPE, new edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.factory.OrganizationModelWithTypesFactory());
|
||||
put(SubOrganizationWithinModelConstructor.MODEL_TYPE, new edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.factory.SubOrganizationWithinModelFactory());
|
||||
}};
|
||||
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
public static final Map<String, String> modelTypeToHumanReadableName = new HashMap<String, String>() {{
|
||||
// put(PersonToPublicationsModelConstructor.MODEL_TYPE, PersonToPublicationsModelConstructor.MODEL_TYPE_HUMAN_READABLE);
|
||||
// put(PeopleToPublicationsModelConstructor.MODEL_TYPE, PeopleToPublicationsModelConstructor.MODEL_TYPE_HUMAN_READABLE);
|
||||
// Currently in use, but probably should be deprecated with the others
|
||||
put(PersonToGrantsModelConstructor.MODEL_TYPE, PersonToGrantsModelConstructor.MODEL_TYPE_HUMAN_READABLE);
|
||||
// put(PeopleToGrantsModelConstructor.MODEL_TYPE, PeopleToGrantsModelConstructor.MODEL_TYPE_HUMAN_READABLE);
|
||||
// put(OrganizationToPublicationsForSubOrganizationsModelConstructor.MODEL_TYPE, OrganizationToPublicationsForSubOrganizationsModelConstructor.MODEL_TYPE_HUMAN_READABLE);
|
||||
// put(OrganizationToGrantsForSubOrganizationsModelConstructor.MODEL_TYPE, OrganizationToGrantsForSubOrganizationsModelConstructor.MODEL_TYPE_HUMAN_READABLE);
|
||||
// put(OrganizationAssociatedPeopleModelWithTypesConstructor.MODEL_TYPE, OrganizationAssociatedPeopleModelWithTypesConstructor.MODEL_TYPE_HUMAN_READABLE);
|
||||
// put(OrganizationModelWithTypesConstructor.MODEL_TYPE, OrganizationModelWithTypesConstructor.MODEL_TYPE_HUMAN_READABLE);
|
||||
// put(SubOrganizationWithinModelConstructor.MODEL_TYPE, SubOrganizationWithinModelConstructor.MODEL_TYPE_HUMAN_READABLE);
|
||||
|
||||
/**
|
||||
* The following models are deprecated and will be removed
|
||||
*/
|
||||
put(PersonToPublicationsModelConstructor.MODEL_TYPE, PersonToPublicationsModelConstructor.MODEL_TYPE_HUMAN_READABLE);
|
||||
put(PeopleToPublicationsModelConstructor.MODEL_TYPE, PeopleToPublicationsModelConstructor.MODEL_TYPE_HUMAN_READABLE);
|
||||
put(PeopleToGrantsModelConstructor.MODEL_TYPE, PeopleToGrantsModelConstructor.MODEL_TYPE_HUMAN_READABLE);
|
||||
put(OrganizationToPublicationsForSubOrganizationsModelConstructor.MODEL_TYPE, OrganizationToPublicationsForSubOrganizationsModelConstructor.MODEL_TYPE_HUMAN_READABLE);
|
||||
put(OrganizationToGrantsForSubOrganizationsModelConstructor.MODEL_TYPE, OrganizationToGrantsForSubOrganizationsModelConstructor.MODEL_TYPE_HUMAN_READABLE);
|
||||
put(OrganizationAssociatedPeopleModelWithTypesConstructor.MODEL_TYPE, OrganizationAssociatedPeopleModelWithTypesConstructor.MODEL_TYPE_HUMAN_READABLE);
|
||||
put(OrganizationModelWithTypesConstructor.MODEL_TYPE, OrganizationModelWithTypesConstructor.MODEL_TYPE_HUMAN_READABLE);
|
||||
put(SubOrganizationWithinModelConstructor.MODEL_TYPE, SubOrganizationWithinModelConstructor.MODEL_TYPE_HUMAN_READABLE);
|
||||
}};
|
||||
|
||||
|
||||
public static Model getOrConstructModel(String uri, String modelType, RDFService rdfService)
|
||||
throws MalformedQueryParametersException {
|
||||
return modelTypeIdentifierToFactory.get(modelType).getOrCreateModel(uri, rdfService);
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
package edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService;
|
||||
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFServiceException;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
|
@ -17,6 +19,10 @@ import edu.cornell.mannlib.vitro.webapp.visualization.constants.QueryConstants;
|
|||
import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.ModelConstructor;
|
||||
|
||||
/**
|
||||
* No longer used - will be removed
|
||||
*/
|
||||
@Deprecated
|
||||
public class OrganizationAssociatedPeopleModelWithTypesConstructor implements ModelConstructor {
|
||||
|
||||
protected static final Syntax SYNTAX = Syntax.syntaxARQ;
|
||||
|
@ -24,7 +30,7 @@ public class OrganizationAssociatedPeopleModelWithTypesConstructor implements Mo
|
|||
public static final String MODEL_TYPE = "ORGANIZATION_ASSOCIATED_MODEL_WITH_TYPES";
|
||||
public static final String MODEL_TYPE_HUMAN_READABLE = "People for specific organization";
|
||||
|
||||
private Dataset dataset;
|
||||
private RDFService rdfService;
|
||||
|
||||
private Model constructedModel;
|
||||
|
||||
|
@ -34,8 +40,8 @@ public class OrganizationAssociatedPeopleModelWithTypesConstructor implements Mo
|
|||
|
||||
private String organizationURI;
|
||||
|
||||
public OrganizationAssociatedPeopleModelWithTypesConstructor(String organizationURI, Dataset dataset) {
|
||||
this.dataset = dataset;
|
||||
public OrganizationAssociatedPeopleModelWithTypesConstructor(String organizationURI, RDFService rdfService) {
|
||||
this.rdfService = rdfService;
|
||||
this.organizationURI = organizationURI;
|
||||
}
|
||||
|
||||
|
@ -73,25 +79,13 @@ public class OrganizationAssociatedPeopleModelWithTypesConstructor implements Mo
|
|||
before = System.currentTimeMillis();
|
||||
log.debug("CONSTRUCT query string : " + constructQuery);
|
||||
|
||||
Query query = null;
|
||||
|
||||
try {
|
||||
query = QueryFactory.create(QueryConstants.getSparqlPrefixQuery()
|
||||
+ constructQuery, SYNTAX);
|
||||
rdfService.sparqlConstructQuery(QueryConstants.getSparqlPrefixQuery() + constructQuery, constructedModel);
|
||||
} catch (Throwable th) {
|
||||
log.error("Could not create CONSTRUCT SPARQL query for query "
|
||||
+ "string. " + th.getMessage());
|
||||
log.error("Could not create CONSTRUCT SPARQL query for query string. " + th.getMessage());
|
||||
log.error(constructQuery);
|
||||
}
|
||||
|
||||
QueryExecution qe = QueryExecutionFactory.create(query, dataset);
|
||||
|
||||
try {
|
||||
qe.execConstruct(constructedModel);
|
||||
} finally {
|
||||
qe.close();
|
||||
}
|
||||
|
||||
after = System.currentTimeMillis();
|
||||
log.debug("Time taken to execute the CONSTRUCT queries is in milliseconds: "
|
||||
+ (after - before));
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
package edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
|
@ -17,6 +18,10 @@ import edu.cornell.mannlib.vitro.webapp.visualization.constants.QueryConstants;
|
|||
import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.ModelConstructor;
|
||||
|
||||
/**
|
||||
* No longer used - will be removed
|
||||
*/
|
||||
@Deprecated
|
||||
public class OrganizationModelWithTypesConstructor implements ModelConstructor {
|
||||
|
||||
protected static final Syntax SYNTAX = Syntax.syntaxARQ;
|
||||
|
@ -24,7 +29,7 @@ public class OrganizationModelWithTypesConstructor implements ModelConstructor {
|
|||
public static final String MODEL_TYPE = "ORGANIZATION_MODEL_WITH_TYPES";
|
||||
public static final String MODEL_TYPE_HUMAN_READABLE = "Organization hierarchy";
|
||||
|
||||
private Dataset dataset;
|
||||
private RDFService rdfService;
|
||||
|
||||
private Model constructedModel;
|
||||
|
||||
|
@ -32,17 +37,8 @@ public class OrganizationModelWithTypesConstructor implements ModelConstructor {
|
|||
|
||||
private long before, after;
|
||||
|
||||
public OrganizationModelWithTypesConstructor(Dataset dataset) {
|
||||
this.dataset = dataset;
|
||||
}
|
||||
|
||||
/**
|
||||
* This constructor is present so that we can abstract out the model construction process.
|
||||
* @param uri
|
||||
* @param dataset
|
||||
*/
|
||||
public OrganizationModelWithTypesConstructor(String uri, Dataset dataset) {
|
||||
this.dataset = dataset;
|
||||
public OrganizationModelWithTypesConstructor(RDFService rdfService) {
|
||||
this.rdfService = rdfService;
|
||||
}
|
||||
|
||||
private String constructAllSubOrganizationsWithTypesQuery() {
|
||||
|
@ -78,25 +74,13 @@ public class OrganizationModelWithTypesConstructor implements ModelConstructor {
|
|||
before = System.currentTimeMillis();
|
||||
log.debug("CONSTRUCT query string : " + constructQuery);
|
||||
|
||||
Query query = null;
|
||||
|
||||
try {
|
||||
query = QueryFactory.create(QueryConstants.getSparqlPrefixQuery()
|
||||
+ constructQuery, SYNTAX);
|
||||
rdfService.sparqlConstructQuery(QueryConstants.getSparqlPrefixQuery() + constructQuery, constructedModel);
|
||||
} catch (Throwable th) {
|
||||
log.error("Could not create CONSTRUCT SPARQL query for query "
|
||||
+ "string. " + th.getMessage());
|
||||
log.error("Could not create CONSTRUCT SPARQL query for query string. " + th.getMessage());
|
||||
log.error(constructQuery);
|
||||
}
|
||||
|
||||
QueryExecution qe = QueryExecutionFactory.create(query, dataset);
|
||||
|
||||
try {
|
||||
qe.execConstruct(constructedModel);
|
||||
} finally {
|
||||
qe.close();
|
||||
}
|
||||
|
||||
after = System.currentTimeMillis();
|
||||
log.debug("Time taken to execute the CONSTRUCT queries is in milliseconds: "
|
||||
+ (after - before));
|
||||
|
|
|
@ -4,6 +4,7 @@ package edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor;
|
|||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
|
@ -20,11 +21,15 @@ import edu.cornell.mannlib.vitro.webapp.visualization.constants.QueryConstants;
|
|||
import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.ModelConstructor;
|
||||
|
||||
/**
|
||||
* No longer used - will be removed
|
||||
*/
|
||||
@Deprecated
|
||||
public class OrganizationToGrantsForSubOrganizationsModelConstructor implements ModelConstructor {
|
||||
|
||||
protected static final Syntax SYNTAX = Syntax.syntaxARQ;
|
||||
|
||||
private Dataset dataset;
|
||||
private RDFService rdfService;
|
||||
|
||||
public static final String MODEL_TYPE = "ORGANIZATION_TO_GRANTS_FOR_SUBORGANIZATIONS";
|
||||
public static final String MODEL_TYPE_HUMAN_READABLE = "Grants for specific organization via all descendants";
|
||||
|
@ -35,9 +40,9 @@ public class OrganizationToGrantsForSubOrganizationsModelConstructor implements
|
|||
|
||||
private long before, after;
|
||||
|
||||
public OrganizationToGrantsForSubOrganizationsModelConstructor(String organizationURI, Dataset dataset) {
|
||||
public OrganizationToGrantsForSubOrganizationsModelConstructor(String organizationURI, RDFService rdfService) {
|
||||
this.organizationURI = organizationURI;
|
||||
this.dataset = dataset;
|
||||
this.rdfService = rdfService;
|
||||
}
|
||||
|
||||
private Set<String> constructOrganizationGrantsQueryTemplate(String constructProperty, String roleType) {
|
||||
|
@ -171,24 +176,13 @@ public class OrganizationToGrantsForSubOrganizationsModelConstructor implements
|
|||
log.debug("CONSTRUCT query string : " + constructQueries);
|
||||
|
||||
for (String currentQuery : constructQueries) {
|
||||
|
||||
Query query = null;
|
||||
|
||||
try {
|
||||
query = QueryFactory.create(QueryConstants.getSparqlPrefixQuery() + currentQuery, SYNTAX);
|
||||
rdfService.sparqlConstructQuery(QueryConstants.getSparqlPrefixQuery() + currentQuery, constructedModel);
|
||||
} catch (Throwable th) {
|
||||
log.error("Could not create CONSTRUCT SPARQL query for query "
|
||||
+ "string. " + th.getMessage());
|
||||
log.error(currentQuery);
|
||||
}
|
||||
|
||||
QueryExecution qe = QueryExecutionFactory.create(query, dataset);
|
||||
|
||||
try {
|
||||
qe.execConstruct(constructedModel);
|
||||
} finally {
|
||||
qe.close();
|
||||
}
|
||||
}
|
||||
|
||||
after = System.currentTimeMillis();
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
package edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
|
@ -17,11 +18,15 @@ import edu.cornell.mannlib.vitro.webapp.visualization.constants.QueryConstants;
|
|||
import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.ModelConstructor;
|
||||
|
||||
/**
|
||||
* No longer used - will be removed
|
||||
*/
|
||||
@Deprecated
|
||||
public class OrganizationToPublicationsForSubOrganizationsModelConstructor implements ModelConstructor {
|
||||
|
||||
protected static final Syntax SYNTAX = Syntax.syntaxARQ;
|
||||
|
||||
private Dataset dataset;
|
||||
private RDFService rdfService;
|
||||
|
||||
public static final String MODEL_TYPE = "ORGANIZATION_TO_PUBLICATIONS_FOR_SUBORGANIZATIONS";
|
||||
public static final String MODEL_TYPE_HUMAN_READABLE = "Publications for specific organization via all descendants";
|
||||
|
@ -32,9 +37,9 @@ public class OrganizationToPublicationsForSubOrganizationsModelConstructor imple
|
|||
|
||||
private long before, after;
|
||||
|
||||
public OrganizationToPublicationsForSubOrganizationsModelConstructor(String organizationURI, Dataset dataset) {
|
||||
public OrganizationToPublicationsForSubOrganizationsModelConstructor(String organizationURI, RDFService rdfService) {
|
||||
this.organizationURI = organizationURI;
|
||||
this.dataset = dataset;
|
||||
this.rdfService = rdfService;
|
||||
}
|
||||
|
||||
private String constructOrganizationToPublicationsPublicationInformationQuery() {
|
||||
|
@ -89,25 +94,14 @@ public class OrganizationToPublicationsForSubOrganizationsModelConstructor imple
|
|||
before = System.currentTimeMillis();
|
||||
log.debug("CONSTRUCT query string : " + constructQuery);
|
||||
|
||||
Query query = null;
|
||||
|
||||
try {
|
||||
query = QueryFactory.create(QueryConstants.getSparqlPrefixQuery()
|
||||
+ constructQuery, SYNTAX);
|
||||
rdfService.sparqlConstructQuery(QueryConstants.getSparqlPrefixQuery() + constructQuery, constructedModel);
|
||||
} catch (Throwable th) {
|
||||
log.error("Could not create CONSTRUCT SPARQL query for query "
|
||||
+ "string. " + th.getMessage());
|
||||
log.error(constructQuery);
|
||||
}
|
||||
|
||||
QueryExecution qe = QueryExecutionFactory.create(query, dataset);
|
||||
|
||||
try {
|
||||
qe.execConstruct(constructedModel);
|
||||
} finally {
|
||||
qe.close();
|
||||
}
|
||||
|
||||
after = System.currentTimeMillis();
|
||||
log.debug("Time taken to execute the CONSTRUCT queries is in milliseconds: "
|
||||
+ (after - before));
|
||||
|
|
|
@ -4,6 +4,7 @@ package edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor;
|
|||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
|
@ -20,11 +21,15 @@ import edu.cornell.mannlib.vitro.webapp.visualization.constants.QueryConstants;
|
|||
import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.ModelConstructor;
|
||||
|
||||
/**
|
||||
* No longer used - will be removed
|
||||
*/
|
||||
@Deprecated
|
||||
public class PeopleToGrantsModelConstructor implements ModelConstructor {
|
||||
|
||||
protected static final Syntax SYNTAX = Syntax.syntaxARQ;
|
||||
|
||||
private Dataset dataset;
|
||||
private RDFService rdfService;
|
||||
|
||||
public static final String MODEL_TYPE = "PEOPLE_TO_GRANTS";
|
||||
public static final String MODEL_TYPE_HUMAN_READABLE = "Grants for all people via all roles";
|
||||
|
@ -33,8 +38,8 @@ public class PeopleToGrantsModelConstructor implements ModelConstructor {
|
|||
|
||||
private long before, after;
|
||||
|
||||
public PeopleToGrantsModelConstructor(Dataset dataset) {
|
||||
this.dataset = dataset;
|
||||
public PeopleToGrantsModelConstructor(RDFService rdfService) {
|
||||
this.rdfService = rdfService;
|
||||
}
|
||||
|
||||
private Set<String> constructPersonGrantsQueryTemplate(String constructProperty, String roleType) {
|
||||
|
@ -142,26 +147,13 @@ private Set<String> constructPersonGrantsQueryTemplate(String constructProperty,
|
|||
log.debug("CONSTRUCT query string : " + constructQueries);
|
||||
|
||||
for (String currentQuery : constructQueries) {
|
||||
|
||||
|
||||
Query query = null;
|
||||
|
||||
try {
|
||||
query = QueryFactory.create(QueryConstants.getSparqlPrefixQuery() + currentQuery, SYNTAX);
|
||||
rdfService.sparqlConstructQuery(QueryConstants.getSparqlPrefixQuery() + currentQuery, constructedModel);
|
||||
} catch (Throwable th) {
|
||||
log.error("Could not create CONSTRUCT SPARQL query for query "
|
||||
+ "string. " + th.getMessage());
|
||||
log.error(currentQuery);
|
||||
}
|
||||
|
||||
|
||||
QueryExecution qe = QueryExecutionFactory.create(query, dataset);
|
||||
|
||||
try {
|
||||
qe.execConstruct(constructedModel);
|
||||
} finally {
|
||||
qe.close();
|
||||
}
|
||||
}
|
||||
|
||||
after = System.currentTimeMillis();
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
package edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
|
@ -17,11 +18,15 @@ import edu.cornell.mannlib.vitro.webapp.visualization.constants.QueryConstants;
|
|||
import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.ModelConstructor;
|
||||
|
||||
/**
|
||||
* No longer used - will be removed
|
||||
*/
|
||||
@Deprecated
|
||||
public class PeopleToPublicationsModelConstructor implements ModelConstructor {
|
||||
|
||||
protected static final Syntax SYNTAX = Syntax.syntaxARQ;
|
||||
|
||||
private Dataset dataset;
|
||||
private RDFService rdfService;
|
||||
|
||||
public static final String MODEL_TYPE = "PEOPLE_TO_PUBLICATIONS";
|
||||
public static final String MODEL_TYPE_HUMAN_READABLE = "Publications for all people";
|
||||
|
@ -30,8 +35,8 @@ public class PeopleToPublicationsModelConstructor implements ModelConstructor {
|
|||
|
||||
private long before, after;
|
||||
|
||||
public PeopleToPublicationsModelConstructor(Dataset dataset) {
|
||||
this.dataset = dataset;
|
||||
public PeopleToPublicationsModelConstructor(RDFService rdfService) {
|
||||
this.rdfService = rdfService;
|
||||
}
|
||||
|
||||
private String constructPeopleToPublicationsQuery() {
|
||||
|
@ -78,25 +83,14 @@ public class PeopleToPublicationsModelConstructor implements ModelConstructor {
|
|||
before = System.currentTimeMillis();
|
||||
log.debug("CONSTRUCT query string : " + constructQuery);
|
||||
|
||||
Query query = null;
|
||||
|
||||
try {
|
||||
query = QueryFactory.create(QueryConstants.getSparqlPrefixQuery()
|
||||
+ constructQuery, SYNTAX);
|
||||
rdfService.sparqlConstructQuery(QueryConstants.getSparqlPrefixQuery() + constructQuery, constructedModel);
|
||||
} catch (Throwable th) {
|
||||
log.error("Could not create CONSTRUCT SPARQL query for query "
|
||||
+ "string. " + th.getMessage());
|
||||
log.error(constructQuery);
|
||||
}
|
||||
|
||||
QueryExecution qe = QueryExecutionFactory.create(query, dataset);
|
||||
|
||||
try {
|
||||
qe.execConstruct(constructedModel);
|
||||
} finally {
|
||||
qe.close();
|
||||
}
|
||||
|
||||
after = System.currentTimeMillis();
|
||||
log.debug("Try to see Time taken to execute the CONSTRUCT queries is in milliseconds: "
|
||||
+ (after - before));
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
package edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
|
@ -17,11 +18,15 @@ import edu.cornell.mannlib.vitro.webapp.visualization.constants.QueryConstants;
|
|||
import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.ModelConstructor;
|
||||
|
||||
/**
|
||||
* No longer used - will be removed
|
||||
*/
|
||||
@Deprecated
|
||||
public class PersonToPublicationsModelConstructor implements ModelConstructor {
|
||||
|
||||
protected static final Syntax SYNTAX = Syntax.syntaxARQ;
|
||||
|
||||
private Dataset dataset;
|
||||
private RDFService rdfService;
|
||||
|
||||
public static final String MODEL_TYPE = "PERSON_TO_PUBLICATIONS";
|
||||
public static final String MODEL_TYPE_HUMAN_READABLE = "Specific Person to Publications";
|
||||
|
@ -32,9 +37,9 @@ public class PersonToPublicationsModelConstructor implements ModelConstructor {
|
|||
|
||||
private long before, after;
|
||||
|
||||
public PersonToPublicationsModelConstructor(String personURI, Dataset dataset) {
|
||||
public PersonToPublicationsModelConstructor(String personURI, RDFService rdfService) {
|
||||
this.personURI = personURI;
|
||||
this.dataset = dataset;
|
||||
this.rdfService = rdfService;
|
||||
}
|
||||
|
||||
private String constructPersonToPublicationsWithPublicationInformationQuery() {
|
||||
|
@ -80,25 +85,14 @@ public class PersonToPublicationsModelConstructor implements ModelConstructor {
|
|||
before = System.currentTimeMillis();
|
||||
log.debug("CONSTRUCT query string : " + constructQuery);
|
||||
|
||||
Query query = null;
|
||||
|
||||
try {
|
||||
query = QueryFactory.create(QueryConstants.getSparqlPrefixQuery()
|
||||
+ constructQuery, SYNTAX);
|
||||
rdfService.sparqlConstructQuery(QueryConstants.getSparqlPrefixQuery() + constructQuery, constructedModel);
|
||||
} catch (Throwable th) {
|
||||
log.error("Could not create CONSTRUCT SPARQL query for query "
|
||||
+ "string. " + th.getMessage());
|
||||
log.error(constructQuery);
|
||||
}
|
||||
|
||||
QueryExecution qe = QueryExecutionFactory.create(query, dataset);
|
||||
|
||||
try {
|
||||
qe.execConstruct(constructedModel);
|
||||
} finally {
|
||||
qe.close();
|
||||
}
|
||||
|
||||
after = System.currentTimeMillis();
|
||||
log.debug("Try to see Time taken to execute the CONSTRUCT queries is in milliseconds: "
|
||||
+ (after - before));
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
package edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
|
@ -17,6 +18,10 @@ import edu.cornell.mannlib.vitro.webapp.visualization.constants.QueryConstants;
|
|||
import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.ModelConstructor;
|
||||
|
||||
/**
|
||||
* No longer used - will be removed
|
||||
*/
|
||||
@Deprecated
|
||||
public class SubOrganizationWithinModelConstructor implements ModelConstructor {
|
||||
|
||||
protected static final Syntax SYNTAX = Syntax.syntaxARQ;
|
||||
|
@ -24,7 +29,7 @@ public class SubOrganizationWithinModelConstructor implements ModelConstructor {
|
|||
public static final String MODEL_TYPE = "SUBORGANIZATION_WITHIN_HIERARCHY_MODEL";
|
||||
public static final String MODEL_TYPE_HUMAN_READABLE = "Bottom-up Organization hierarchy";
|
||||
|
||||
private Dataset dataset;
|
||||
private RDFService rdfService;
|
||||
|
||||
private Model constructedModel;
|
||||
|
||||
|
@ -32,17 +37,8 @@ public class SubOrganizationWithinModelConstructor implements ModelConstructor {
|
|||
|
||||
private long before, after;
|
||||
|
||||
public SubOrganizationWithinModelConstructor(Dataset dataset) {
|
||||
this.dataset = dataset;
|
||||
}
|
||||
|
||||
/**
|
||||
* This constructor is present so that we can abstract out the model construction process.
|
||||
* @param uri
|
||||
* @param dataset
|
||||
*/
|
||||
public SubOrganizationWithinModelConstructor(String uri, Dataset dataset) {
|
||||
this.dataset = dataset;
|
||||
public SubOrganizationWithinModelConstructor(RDFService rdfService) {
|
||||
this.rdfService = rdfService;
|
||||
}
|
||||
|
||||
private String constructAllSubOrganizationsWithinQuery() {
|
||||
|
@ -74,25 +70,14 @@ public class SubOrganizationWithinModelConstructor implements ModelConstructor {
|
|||
before = System.currentTimeMillis();
|
||||
log.debug("CONSTRUCT query string : " + constructQuery);
|
||||
|
||||
Query query = null;
|
||||
|
||||
try {
|
||||
query = QueryFactory.create(QueryConstants.getSparqlPrefixQuery()
|
||||
+ constructQuery, SYNTAX);
|
||||
rdfService.sparqlConstructQuery(QueryConstants.getSparqlPrefixQuery() + constructQuery, constructedModel);
|
||||
} catch (Throwable th) {
|
||||
log.error("Could not create CONSTRUCT SPARQL query for query "
|
||||
+ "string. " + th.getMessage());
|
||||
log.error(constructQuery);
|
||||
}
|
||||
|
||||
QueryExecution qe = QueryExecutionFactory.create(query, dataset);
|
||||
|
||||
try {
|
||||
qe.execConstruct(constructedModel);
|
||||
} finally {
|
||||
qe.close();
|
||||
}
|
||||
|
||||
after = System.currentTimeMillis();
|
||||
log.debug("Time taken to execute the CONSTRUCT queries is in milliseconds: "
|
||||
+ (after - before));
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
package edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.factory;
|
||||
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.ConstructedModelTracker;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.ModelConstructor;
|
||||
|
||||
/**
|
||||
* No longer used - will be removed
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("deprecation")
|
||||
public class OrganizationAssociatedPeopleModelWithTypesFactory implements ModelFactoryInterface {
|
||||
@Override
|
||||
public Model getOrCreateModel(String uri, RDFService rdfService) throws MalformedQueryParametersException {
|
||||
Model candidateModel = ConstructedModelTracker.getModel(
|
||||
ConstructedModelTracker
|
||||
.generateModelIdentifier(
|
||||
uri,
|
||||
edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.OrganizationAssociatedPeopleModelWithTypesConstructor.MODEL_TYPE));
|
||||
|
||||
if (candidateModel != null) {
|
||||
|
||||
return candidateModel;
|
||||
|
||||
} else {
|
||||
|
||||
ModelConstructor model = new edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.OrganizationAssociatedPeopleModelWithTypesConstructor(uri, rdfService);
|
||||
|
||||
Model constructedModel = model.getConstructedModel();
|
||||
ConstructedModelTracker.trackModel(
|
||||
ConstructedModelTracker
|
||||
.generateModelIdentifier(
|
||||
uri,
|
||||
edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.OrganizationAssociatedPeopleModelWithTypesConstructor.MODEL_TYPE),
|
||||
constructedModel);
|
||||
|
||||
return constructedModel;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
package edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.factory;
|
||||
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.ConstructedModelTracker;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.ModelConstructor;
|
||||
|
||||
/**
|
||||
* No longer used - will be removed
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("deprecation")
|
||||
public class OrganizationModelWithTypesFactory implements ModelFactoryInterface {
|
||||
@Override
|
||||
public Model getOrCreateModel(String uri, RDFService rdfService) throws MalformedQueryParametersException {
|
||||
Model candidateModel = ConstructedModelTracker.getModel(
|
||||
ConstructedModelTracker
|
||||
.generateModelIdentifier(
|
||||
null,
|
||||
edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.OrganizationModelWithTypesConstructor.MODEL_TYPE));
|
||||
|
||||
if (candidateModel != null) {
|
||||
|
||||
return candidateModel;
|
||||
|
||||
} else {
|
||||
|
||||
ModelConstructor model = new edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.OrganizationModelWithTypesConstructor(rdfService);
|
||||
Model constructedModel = model.getConstructedModel();
|
||||
|
||||
ConstructedModelTracker.trackModel(
|
||||
ConstructedModelTracker
|
||||
.generateModelIdentifier(
|
||||
null,
|
||||
edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.OrganizationModelWithTypesConstructor.MODEL_TYPE),
|
||||
constructedModel);
|
||||
|
||||
return constructedModel;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
package edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.factory;
|
||||
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.ConstructedModelTracker;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.ModelConstructor;
|
||||
|
||||
/**
|
||||
* No longer used - will be removed
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("deprecation")
|
||||
public class OrganizationToGrantsForSubOrganizationsFactory implements ModelFactoryInterface {
|
||||
@Override
|
||||
public Model getOrCreateModel(String uri, RDFService rdfService) throws MalformedQueryParametersException {
|
||||
Model candidateModel = ConstructedModelTracker.getModel(
|
||||
ConstructedModelTracker
|
||||
.generateModelIdentifier(
|
||||
uri,
|
||||
edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.OrganizationToGrantsForSubOrganizationsModelConstructor.MODEL_TYPE));
|
||||
|
||||
if (candidateModel != null) {
|
||||
|
||||
return candidateModel;
|
||||
|
||||
} else {
|
||||
|
||||
ModelConstructor model = new edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.OrganizationToGrantsForSubOrganizationsModelConstructor(uri, rdfService);
|
||||
|
||||
Model constructedModel = model.getConstructedModel();
|
||||
ConstructedModelTracker.trackModel(
|
||||
ConstructedModelTracker
|
||||
.generateModelIdentifier(
|
||||
uri,
|
||||
edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.OrganizationToGrantsForSubOrganizationsModelConstructor.MODEL_TYPE),
|
||||
constructedModel);
|
||||
|
||||
return constructedModel;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
package edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.factory;
|
||||
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.ConstructedModelTracker;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.ModelConstructor;
|
||||
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.apache.commons.logging.Log;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.CustomLock;
|
||||
|
||||
/**
|
||||
* No longer used - will be removed
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("deprecation")
|
||||
public class OrganizationToPublicationsForSubOrganizationsFactory implements ModelFactoryInterface {
|
||||
private Log log = LogFactory.getLog(OrganizationToPublicationsForSubOrganizationsFactory.class);
|
||||
|
||||
@Override
|
||||
public Model getOrCreateModel(String uri, RDFService rdfService) throws MalformedQueryParametersException {
|
||||
Model candidateModel = ConstructedModelTracker.getModel(
|
||||
ConstructedModelTracker
|
||||
.generateModelIdentifier(
|
||||
uri,
|
||||
edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.OrganizationToPublicationsForSubOrganizationsModelConstructor.MODEL_TYPE));
|
||||
|
||||
if (candidateModel != null) {
|
||||
|
||||
return candidateModel;
|
||||
|
||||
} else {
|
||||
Lock customLock = CustomLock.getLock();
|
||||
if (customLock.tryLock()) //Acquiring lock if available to construct the model
|
||||
{
|
||||
try
|
||||
{
|
||||
ModelConstructor model = new edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.OrganizationToPublicationsForSubOrganizationsModelConstructor(uri, rdfService);
|
||||
|
||||
Model constructedModel = model.getConstructedModel();
|
||||
ConstructedModelTracker.trackModel(
|
||||
ConstructedModelTracker
|
||||
.generateModelIdentifier(
|
||||
uri,
|
||||
edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.OrganizationToPublicationsForSubOrganizationsModelConstructor.MODEL_TYPE),
|
||||
constructedModel);
|
||||
return constructedModel;
|
||||
} finally {
|
||||
customLock.unlock();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
log.info("The Model construction process is going on");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
package edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.factory;
|
||||
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.ConstructedModelTracker;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.ModelConstructor;
|
||||
|
||||
/**
|
||||
* No longer used - will be removed
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("deprecation")
|
||||
public class PeopleToGrantsFactory implements ModelFactoryInterface {
|
||||
@Override
|
||||
public Model getOrCreateModel(String uri, RDFService rdfService) throws MalformedQueryParametersException {
|
||||
Model candidateModel = ConstructedModelTracker.getModel(
|
||||
ConstructedModelTracker
|
||||
.generateModelIdentifier(
|
||||
null,
|
||||
edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.PeopleToGrantsModelConstructor.MODEL_TYPE));
|
||||
|
||||
if (candidateModel != null) {
|
||||
|
||||
return candidateModel;
|
||||
|
||||
} else {
|
||||
|
||||
ModelConstructor model = new edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.PeopleToGrantsModelConstructor(rdfService);
|
||||
|
||||
Model constructedModel = model.getConstructedModel();
|
||||
ConstructedModelTracker.trackModel(
|
||||
ConstructedModelTracker
|
||||
.generateModelIdentifier(
|
||||
null,
|
||||
edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.PeopleToGrantsModelConstructor.MODEL_TYPE),
|
||||
constructedModel);
|
||||
|
||||
return constructedModel;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
package edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.factory;
|
||||
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.ConstructedModelTracker;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.ModelConstructor;
|
||||
|
||||
/**
|
||||
* No longer used - will be removed
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("deprecation")
|
||||
public class PeopleToPublicationsFactory implements ModelFactoryInterface {
|
||||
@Override
|
||||
public Model getOrCreateModel(String uri, RDFService rdfService) throws MalformedQueryParametersException {
|
||||
Model candidateModel = ConstructedModelTracker.getModel(
|
||||
ConstructedModelTracker
|
||||
.generateModelIdentifier(
|
||||
null,
|
||||
edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.PeopleToPublicationsModelConstructor.MODEL_TYPE));
|
||||
|
||||
if (candidateModel != null) {
|
||||
|
||||
return candidateModel;
|
||||
|
||||
} else {
|
||||
|
||||
ModelConstructor model = new edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.PeopleToPublicationsModelConstructor(rdfService);
|
||||
|
||||
Model constructedModel = model.getConstructedModel();
|
||||
ConstructedModelTracker.trackModel(
|
||||
ConstructedModelTracker
|
||||
.generateModelIdentifier(
|
||||
null,
|
||||
edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.PeopleToPublicationsModelConstructor.MODEL_TYPE),
|
||||
constructedModel);
|
||||
|
||||
return constructedModel;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,46 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
package edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.factory;
|
||||
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.ConstructedModelTracker;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.ModelConstructor;
|
||||
|
||||
/**
|
||||
* No longer used - will be removed
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("deprecation")
|
||||
public class PersonToPublicationsFactory implements ModelFactoryInterface {
|
||||
@Override
|
||||
public Model getOrCreateModel(String uri, RDFService rdfService) throws MalformedQueryParametersException {
|
||||
Model candidateModel = ConstructedModelTracker.getModel(
|
||||
ConstructedModelTracker
|
||||
.generateModelIdentifier(
|
||||
uri,
|
||||
edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.PersonToPublicationsModelConstructor.MODEL_TYPE));
|
||||
|
||||
if (candidateModel != null) {
|
||||
|
||||
return candidateModel;
|
||||
|
||||
} else {
|
||||
|
||||
ModelConstructor model = new edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.PersonToPublicationsModelConstructor(uri, rdfService);
|
||||
|
||||
Model constructedModel = model.getConstructedModel();
|
||||
ConstructedModelTracker.trackModel(
|
||||
ConstructedModelTracker
|
||||
.generateModelIdentifier(
|
||||
uri,
|
||||
edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.PersonToPublicationsModelConstructor.MODEL_TYPE),
|
||||
constructedModel);
|
||||
|
||||
return constructedModel;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
package edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.factory;
|
||||
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.ConstructedModelTracker;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.visutils.ModelConstructor;
|
||||
|
||||
/**
|
||||
* No longer used - will be removed
|
||||
*/
|
||||
@Deprecated
|
||||
@SuppressWarnings("deprecation")
|
||||
public class SubOrganizationWithinModelFactory implements ModelFactoryInterface {
|
||||
@Override
|
||||
public Model getOrCreateModel(String uri, RDFService rdfService) throws MalformedQueryParametersException {
|
||||
Model candidateModel = ConstructedModelTracker.getModel(
|
||||
ConstructedModelTracker
|
||||
.generateModelIdentifier(
|
||||
null,
|
||||
edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.SubOrganizationWithinModelConstructor.MODEL_TYPE));
|
||||
|
||||
if (candidateModel != null) {
|
||||
|
||||
return candidateModel;
|
||||
|
||||
} else {
|
||||
|
||||
ModelConstructor model = new edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.SubOrganizationWithinModelConstructor(rdfService);
|
||||
Model constructedModel = model.getConstructedModel();
|
||||
|
||||
ConstructedModelTracker.trackModel(
|
||||
ConstructedModelTracker
|
||||
.generateModelIdentifier(
|
||||
null,
|
||||
edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.SubOrganizationWithinModelConstructor.MODEL_TYPE),
|
||||
constructedModel);
|
||||
|
||||
return constructedModel;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -3,6 +3,7 @@ package edu.cornell.mannlib.vitro.webapp.visualization.valueobjects;
|
|||
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.ModelConstructorUtilities;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class ConstructedModel {
|
||||
|
||||
private String uri;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||
package edu.cornell.mannlib.vitro.webapp.visualization.visutils;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
|
@ -10,29 +9,16 @@ import java.util.Set;
|
|||
import edu.cornell.mannlib.vitro.webapp.rdfservice.RDFService;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
import com.hp.hpl.jena.query.Dataset;
|
||||
import com.hp.hpl.jena.query.QuerySolution;
|
||||
import com.hp.hpl.jena.query.ResultSet;
|
||||
import com.hp.hpl.jena.rdf.model.Model;
|
||||
import com.hp.hpl.jena.rdf.model.RDFNode;
|
||||
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.constants.QueryFieldLabels;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.constants.VOConstants;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.exceptions.MalformedQueryParametersException;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.ModelConstructorUtilities;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.OrganizationAssociatedPeopleModelWithTypesConstructor;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.OrganizationModelWithTypesConstructor;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.OrganizationToGrantsForSubOrganizationsModelConstructor;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.OrganizationToPublicationsForSubOrganizationsModelConstructor;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.PeopleToGrantsModelConstructor;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.PeopleToPublicationsModelConstructor;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.PersonToGrantsModelConstructor;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.PersonToPublicationsModelConstructor;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.modelconstructor.SubOrganizationWithinModelConstructor;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.Activity;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.Entity;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.Individual;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.MapOfScienceActivity;
|
||||
import edu.cornell.mannlib.vitro.webapp.visualization.valueobjects.SubEntity;
|
||||
|
||||
public class SelectOnModelUtilities {
|
||||
|
|
Loading…
Add table
Reference in a new issue