NIHVIVO-1570 changes to support SPARQL queries with GRAPH filtering in non-SDB Jena implementation
This commit is contained in:
parent
546b214a86
commit
4848117fc9
12 changed files with 168 additions and 71 deletions
|
@ -64,11 +64,10 @@ public class DataPropertyDaoJena extends PropertyDaoJena implements
|
||||||
protected static final String dataPropertyQueryString =
|
protected static final String dataPropertyQueryString =
|
||||||
PREFIXES + "\n" +
|
PREFIXES + "\n" +
|
||||||
"SELECT DISTINCT ?property WHERE { \n" +
|
"SELECT DISTINCT ?property WHERE { \n" +
|
||||||
//" GRAPH ?g {\n" +
|
" GRAPH ?g { ?subject ?property ?object } \n" +
|
||||||
" ?subject ?property ?object . \n" +
|
" GRAPH ?h { ?property rdf:type owl:DatatypeProperty } \n" +
|
||||||
" ?property rdf:type owl:DatatypeProperty . \n" +
|
|
||||||
propertyFilters +
|
propertyFilters +
|
||||||
//" }\n" +
|
" }\n" +
|
||||||
"}";
|
"}";
|
||||||
|
|
||||||
static protected Query dataPropertyQuery;
|
static protected Query dataPropertyQuery;
|
||||||
|
@ -93,8 +92,9 @@ public class DataPropertyDaoJena extends PropertyDaoJena implements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public DataPropertyDaoJena(WebappDaoFactoryJena wadf) {
|
public DataPropertyDaoJena(DatasetWrapperFactory dwf,
|
||||||
super(wadf);
|
WebappDaoFactoryJena wadf) {
|
||||||
|
super(dwf, wadf);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteDataProperty(DataProperty dtp) {
|
public void deleteDataProperty(DataProperty dtp) {
|
||||||
|
|
|
@ -10,6 +10,7 @@ import com.hp.hpl.jena.datatypes.TypeMapper;
|
||||||
import com.hp.hpl.jena.ontology.DatatypeProperty;
|
import com.hp.hpl.jena.ontology.DatatypeProperty;
|
||||||
import com.hp.hpl.jena.ontology.OntModel;
|
import com.hp.hpl.jena.ontology.OntModel;
|
||||||
import com.hp.hpl.jena.ontology.OntResource;
|
import com.hp.hpl.jena.ontology.OntResource;
|
||||||
|
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;
|
||||||
|
@ -39,11 +40,13 @@ import edu.cornell.mannlib.vitro.webapp.dao.jena.event.IndividualUpdateEvent;
|
||||||
public class DataPropertyStatementDaoJena extends JenaBaseDao implements DataPropertyStatementDao
|
public class DataPropertyStatementDaoJena extends JenaBaseDao implements DataPropertyStatementDao
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private DatasetWrapperFactory dwf;
|
||||||
|
|
||||||
protected static final String dataPropertyValueQueryString =
|
protected static final String dataPropertyValueQueryString =
|
||||||
"SELECT ?value WHERE { \n" +
|
"SELECT ?value WHERE { \n" +
|
||||||
//" GRAPH ?g {\n" +
|
" GRAPH ?g {\n" +
|
||||||
" ?subject ?property ?value . \n" +
|
" ?subject ?property ?value . \n" +
|
||||||
//" }\n" +
|
" }\n" +
|
||||||
"}";
|
"}";
|
||||||
|
|
||||||
static protected Query dataPropertyValueQuery;
|
static protected Query dataPropertyValueQuery;
|
||||||
|
@ -56,8 +59,10 @@ public class DataPropertyStatementDaoJena extends JenaBaseDao implements DataPro
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public DataPropertyStatementDaoJena(WebappDaoFactoryJena wadf) {
|
public DataPropertyStatementDaoJena(DatasetWrapperFactory dwf,
|
||||||
|
WebappDaoFactoryJena wadf) {
|
||||||
super(wadf);
|
super(wadf);
|
||||||
|
this.dwf = dwf;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteDataPropertyStatement(DataPropertyStatement dataPropertyStmt) {
|
public void deleteDataPropertyStatement(DataPropertyStatement dataPropertyStmt) {
|
||||||
|
@ -296,16 +301,27 @@ public class DataPropertyStatementDaoJena extends JenaBaseDao implements DataPro
|
||||||
bindings.add("property", ResourceFactory.createResource(propertyUri));
|
bindings.add("property", ResourceFactory.createResource(propertyUri));
|
||||||
|
|
||||||
// Run the SPARQL query to get the properties
|
// Run the SPARQL query to get the properties
|
||||||
QueryExecution qexec = QueryExecutionFactory.create(dataPropertyValueQuery, getOntModelSelector().getFullModel(), bindings);
|
List<DataPropertyStatement> statements =
|
||||||
|
new ArrayList<DataPropertyStatement>();
|
||||||
|
DatasetWrapper w = dwf.getDatasetWrapper();
|
||||||
|
Dataset dataset = w.getDataset();
|
||||||
|
dataset.getLock().enterCriticalSection(Lock.READ);
|
||||||
|
try {
|
||||||
|
QueryExecution qexec = QueryExecutionFactory.create(
|
||||||
|
dataPropertyValueQuery, dataset, bindings);
|
||||||
ResultSet results = qexec.execSelect();
|
ResultSet results = qexec.execSelect();
|
||||||
|
|
||||||
List<DataPropertyStatement> statements = new ArrayList<DataPropertyStatement>();
|
|
||||||
while (results.hasNext()) {
|
while (results.hasNext()) {
|
||||||
QuerySolution sol = results.next();
|
QuerySolution sol = results.next();
|
||||||
Literal value = sol.getLiteral("value");
|
Literal value = sol.getLiteral("value");
|
||||||
DataPropertyStatement dps = new DataPropertyStatementImpl(subjectUri, propertyUri, value.getLexicalForm());
|
DataPropertyStatement dps = new DataPropertyStatementImpl(
|
||||||
|
subjectUri, propertyUri, value.getLexicalForm());
|
||||||
statements.add(dps);
|
statements.add(dps);
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
|
dataset.getLock().leaveCriticalSection();
|
||||||
|
w.close();
|
||||||
|
}
|
||||||
return statements;
|
return statements;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class DataPropertyStatementDaoSDB extends DataPropertyStatementDaoJena
|
||||||
private DatasetWrapperFactory dwf;
|
private DatasetWrapperFactory dwf;
|
||||||
|
|
||||||
public DataPropertyStatementDaoSDB(DatasetWrapperFactory datasetWrapperFactory, WebappDaoFactoryJena wadf) {
|
public DataPropertyStatementDaoSDB(DatasetWrapperFactory datasetWrapperFactory, WebappDaoFactoryJena wadf) {
|
||||||
super (wadf);
|
super (datasetWrapperFactory, wadf);
|
||||||
this.dwf = datasetWrapperFactory;
|
this.dwf = datasetWrapperFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,11 +55,10 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
|
||||||
protected static final String objectPropertyQueryString =
|
protected static final String objectPropertyQueryString =
|
||||||
PREFIXES + "\n" +
|
PREFIXES + "\n" +
|
||||||
"SELECT DISTINCT ?property WHERE { \n" +
|
"SELECT DISTINCT ?property WHERE { \n" +
|
||||||
//" GRAPH ?g {\n" +
|
" GRAPH ?g { ?subject ?property ?object } \n" +
|
||||||
" ?subject ?property ?object . \n" +
|
" GRAPH ?h { ?property rdf:type owl:ObjectProperty } \n" +
|
||||||
" ?property rdf:type owl:ObjectProperty . \n" +
|
|
||||||
propertyFilters +
|
propertyFilters +
|
||||||
//" }\n" +
|
" }\n" +
|
||||||
"}";
|
"}";
|
||||||
|
|
||||||
static protected Query objectPropertyQuery;
|
static protected Query objectPropertyQuery;
|
||||||
|
@ -90,8 +89,9 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
|
||||||
|
|
||||||
Map<ObjectProperty, String> customListViewConfigFileMap = null;
|
Map<ObjectProperty, String> customListViewConfigFileMap = null;
|
||||||
|
|
||||||
public ObjectPropertyDaoJena(WebappDaoFactoryJena wadf) {
|
public ObjectPropertyDaoJena(DatasetWrapperFactory dwf,
|
||||||
super(wadf);
|
WebappDaoFactoryJena wadf) {
|
||||||
|
super(dwf, wadf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -11,6 +11,7 @@ import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
import com.hp.hpl.jena.ontology.OntModel;
|
import com.hp.hpl.jena.ontology.OntModel;
|
||||||
|
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;
|
||||||
|
@ -38,8 +39,12 @@ public class ObjectPropertyStatementDaoJena extends JenaBaseDao implements Objec
|
||||||
|
|
||||||
protected static final Log log = LogFactory.getLog(ObjectPropertyStatementDaoJena.class);
|
protected static final Log log = LogFactory.getLog(ObjectPropertyStatementDaoJena.class);
|
||||||
|
|
||||||
public ObjectPropertyStatementDaoJena(WebappDaoFactoryJena wadf) {
|
private DatasetWrapperFactory dwf;
|
||||||
|
|
||||||
|
public ObjectPropertyStatementDaoJena(DatasetWrapperFactory dwf,
|
||||||
|
WebappDaoFactoryJena wadf) {
|
||||||
super(wadf);
|
super(wadf);
|
||||||
|
this.dwf = dwf;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -72,7 +77,7 @@ public class ObjectPropertyStatementDaoJena extends JenaBaseDao implements Objec
|
||||||
else {
|
else {
|
||||||
Map<String, ObjectProperty> uriToObjectProperty = new HashMap<String,ObjectProperty>();
|
Map<String, ObjectProperty> uriToObjectProperty = new HashMap<String,ObjectProperty>();
|
||||||
|
|
||||||
ObjectPropertyDaoJena opDaoJena = new ObjectPropertyDaoJena(getWebappDaoFactory());
|
ObjectPropertyDaoJena opDaoJena = new ObjectPropertyDaoJena(dwf, getWebappDaoFactory());
|
||||||
|
|
||||||
OntModel ontModel = getOntModelSelector().getABoxModel();
|
OntModel ontModel = getOntModelSelector().getABoxModel();
|
||||||
ontModel.enterCriticalSection(Lock.READ);
|
ontModel.enterCriticalSection(Lock.READ);
|
||||||
|
@ -266,14 +271,25 @@ public class ObjectPropertyStatementDaoJena extends JenaBaseDao implements Objec
|
||||||
bindings.add("property", ResourceFactory.createResource(propertyUri));
|
bindings.add("property", ResourceFactory.createResource(propertyUri));
|
||||||
|
|
||||||
// Run the SPARQL query to get the properties
|
// Run the SPARQL query to get the properties
|
||||||
QueryExecution qexec = QueryExecutionFactory.create(query, getOntModelSelector().getFullModel(), bindings);
|
|
||||||
ResultSet results = qexec.execSelect();
|
|
||||||
List<Map<String, String>> list = new ArrayList<Map<String, String>>();
|
List<Map<String, String>> list = new ArrayList<Map<String, String>>();
|
||||||
|
DatasetWrapper w = dwf.getDatasetWrapper();
|
||||||
|
Dataset dataset = w.getDataset();
|
||||||
|
dataset.getLock().enterCriticalSection(Lock.READ);
|
||||||
|
try {
|
||||||
|
|
||||||
|
QueryExecution qexec = QueryExecutionFactory.create(
|
||||||
|
query, dataset, bindings);
|
||||||
|
ResultSet results = qexec.execSelect();
|
||||||
|
|
||||||
while (results.hasNext()) {
|
while (results.hasNext()) {
|
||||||
QuerySolution soln = results.nextSolution();
|
QuerySolution soln = results.nextSolution();
|
||||||
list.add(QueryUtils.querySolutionToStringValueMap(soln));
|
list.add(QueryUtils.querySolutionToStringValueMap(soln));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} finally {
|
||||||
|
dataset.getLock().leaveCriticalSection();
|
||||||
|
w.close();
|
||||||
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,10 +34,10 @@ public class ObjectPropertyStatementDaoSDB extends
|
||||||
private DatasetWrapperFactory dwf;
|
private DatasetWrapperFactory dwf;
|
||||||
|
|
||||||
public ObjectPropertyStatementDaoSDB(
|
public ObjectPropertyStatementDaoSDB(
|
||||||
DatasetWrapperFactory datasetWrapperFactory,
|
DatasetWrapperFactory dwf,
|
||||||
WebappDaoFactoryJena wadf) {
|
WebappDaoFactoryJena wadf) {
|
||||||
super (wadf);
|
super (dwf, wadf);
|
||||||
this.dwf = datasetWrapperFactory;
|
this.dwf = dwf;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -15,6 +15,7 @@ import org.apache.commons.logging.LogFactory;
|
||||||
import com.hp.hpl.jena.ontology.OntClass;
|
import com.hp.hpl.jena.ontology.OntClass;
|
||||||
import com.hp.hpl.jena.ontology.OntModel;
|
import com.hp.hpl.jena.ontology.OntModel;
|
||||||
import com.hp.hpl.jena.ontology.OntProperty;
|
import com.hp.hpl.jena.ontology.OntProperty;
|
||||||
|
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;
|
||||||
|
@ -69,8 +70,12 @@ public class PropertyDaoJena extends JenaBaseDao implements PropertyDao {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public PropertyDaoJena(WebappDaoFactoryJena wadf) {
|
private DatasetWrapperFactory dwf;
|
||||||
|
|
||||||
|
public PropertyDaoJena(DatasetWrapperFactory dwf,
|
||||||
|
WebappDaoFactoryJena wadf) {
|
||||||
super(wadf);
|
super(wadf);
|
||||||
|
this.dwf = dwf;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -410,10 +415,21 @@ public class PropertyDaoJena extends JenaBaseDao implements PropertyDao {
|
||||||
log.debug("SPARQL query:\n" + query.toString());
|
log.debug("SPARQL query:\n" + query.toString());
|
||||||
// Bind the subject's uri to the ?subject query term
|
// Bind the subject's uri to the ?subject query term
|
||||||
QuerySolutionMap subjectBinding = new QuerySolutionMap();
|
QuerySolutionMap subjectBinding = new QuerySolutionMap();
|
||||||
subjectBinding.add("subject", ResourceFactory.createResource(subjectUri));
|
subjectBinding.add("subject",
|
||||||
|
ResourceFactory.createResource(subjectUri));
|
||||||
|
|
||||||
// Run the SPARQL query to get the properties
|
// Run the SPARQL query to get the properties
|
||||||
QueryExecution qexec = QueryExecutionFactory.create(query, getOntModelSelector().getFullModel(), subjectBinding);
|
DatasetWrapper w = dwf.getDatasetWrapper();
|
||||||
|
Dataset dataset = w.getDataset();
|
||||||
|
dataset.getLock().enterCriticalSection(Lock.READ);
|
||||||
|
try {
|
||||||
|
QueryExecution qexec = QueryExecutionFactory.create(
|
||||||
|
query, dataset, subjectBinding);
|
||||||
return qexec.execSelect();
|
return qexec.execSelect();
|
||||||
|
} finally {
|
||||||
|
dataset.getLock().leaveCriticalSection();
|
||||||
|
w.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
package edu.cornell.mannlib.vitro.webapp.dao.jena;
|
||||||
|
|
||||||
|
import com.hp.hpl.jena.query.Dataset;
|
||||||
|
|
||||||
|
public class StaticDatasetFactory implements DatasetWrapperFactory {
|
||||||
|
|
||||||
|
private Dataset _dataset;
|
||||||
|
|
||||||
|
public StaticDatasetFactory (Dataset dataset) {
|
||||||
|
_dataset = dataset;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DatasetWrapper getDatasetWrapper() {
|
||||||
|
return new DatasetWrapper(_dataset);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -16,6 +16,9 @@ import com.hp.hpl.jena.iri.Violation;
|
||||||
import com.hp.hpl.jena.ontology.OntClass;
|
import com.hp.hpl.jena.ontology.OntClass;
|
||||||
import com.hp.hpl.jena.ontology.OntModel;
|
import com.hp.hpl.jena.ontology.OntModel;
|
||||||
import com.hp.hpl.jena.ontology.OntResource;
|
import com.hp.hpl.jena.ontology.OntResource;
|
||||||
|
import com.hp.hpl.jena.query.DataSource;
|
||||||
|
import com.hp.hpl.jena.query.Dataset;
|
||||||
|
import com.hp.hpl.jena.query.DatasetFactory;
|
||||||
import com.hp.hpl.jena.rdf.model.Literal;
|
import com.hp.hpl.jena.rdf.model.Literal;
|
||||||
import com.hp.hpl.jena.rdf.model.Model;
|
import com.hp.hpl.jena.rdf.model.Model;
|
||||||
import com.hp.hpl.jena.rdf.model.ModelFactory;
|
import com.hp.hpl.jena.rdf.model.ModelFactory;
|
||||||
|
@ -59,6 +62,7 @@ import edu.cornell.mannlib.vitro.webapp.dao.VClassGroupDao;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.pellet.PelletListener;
|
import edu.cornell.mannlib.vitro.webapp.dao.jena.pellet.PelletListener;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.servlet.setup.JenaDataSourceSetupBase;
|
||||||
|
|
||||||
public class WebappDaoFactoryJena implements WebappDaoFactory {
|
public class WebappDaoFactoryJena implements WebappDaoFactory {
|
||||||
|
|
||||||
|
@ -99,6 +103,8 @@ public class WebappDaoFactoryJena implements WebappDaoFactory {
|
||||||
|
|
||||||
private Map<String,String> properties = new HashMap<String,String>();
|
private Map<String,String> properties = new HashMap<String,String>();
|
||||||
|
|
||||||
|
private DatasetWrapperFactory dwf;
|
||||||
|
|
||||||
// for temporary use to construct URIs for the things that still use integer IDs.
|
// for temporary use to construct URIs for the things that still use integer IDs.
|
||||||
// As these objects get changed to support getURI(), this should become unnecessary.
|
// As these objects get changed to support getURI(), this should become unnecessary.
|
||||||
|
|
||||||
|
@ -114,7 +120,12 @@ public class WebappDaoFactoryJena implements WebappDaoFactory {
|
||||||
this.flag2ClassLabelMap = base.flag2ClassLabelMap;
|
this.flag2ClassLabelMap = base.flag2ClassLabelMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public WebappDaoFactoryJena(OntModelSelector ontModelSelector, String defaultNamespace, HashSet<String> nonuserNamespaces, String[] preferredLanguages, String userURI){
|
public WebappDaoFactoryJena(OntModelSelector ontModelSelector,
|
||||||
|
OntModelSelector inferenceOntModelSelector,
|
||||||
|
String defaultNamespace,
|
||||||
|
HashSet<String> nonuserNamespaces,
|
||||||
|
String[] preferredLanguages,
|
||||||
|
String userURI){
|
||||||
|
|
||||||
this.ontModelSelector = ontModelSelector;
|
this.ontModelSelector = ontModelSelector;
|
||||||
|
|
||||||
|
@ -162,14 +173,43 @@ public class WebappDaoFactoryJena implements WebappDaoFactory {
|
||||||
if (languageUniversalsModel.size()>0) {
|
if (languageUniversalsModel.size()>0) {
|
||||||
this.ontModelSelector.getTBoxModel().addSubModel(languageUniversalsModel);
|
this.ontModelSelector.getTBoxModel().addSubModel(languageUniversalsModel);
|
||||||
}
|
}
|
||||||
|
DataSource dataset = DatasetFactory.create();
|
||||||
|
|
||||||
|
dataset.addNamedModel(JenaDataSourceSetupBase.JENA_DB_MODEL,
|
||||||
|
ontModelSelector.getFullModel());
|
||||||
|
if (inferenceOntModelSelector != null) {
|
||||||
|
dataset.addNamedModel(JenaDataSourceSetupBase.JENA_INF_MODEL,
|
||||||
|
inferenceOntModelSelector.getFullModel());
|
||||||
|
}
|
||||||
|
this.dwf = new StaticDatasetFactory(dataset);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public WebappDaoFactoryJena(OntModelSelector ontModelSelector,
|
||||||
|
String defaultNamespace,
|
||||||
|
HashSet<String> nonuserNamespaces,
|
||||||
|
String[] preferredLanguages,
|
||||||
|
String userURI){
|
||||||
|
this(ontModelSelector,
|
||||||
|
null,
|
||||||
|
defaultNamespace,
|
||||||
|
nonuserNamespaces,
|
||||||
|
preferredLanguages,
|
||||||
|
userURI);
|
||||||
}
|
}
|
||||||
|
|
||||||
public WebappDaoFactoryJena(OntModelSelector ontModelSelector, String defaultNamespace, HashSet<String> nonuserNamespaces, String[] preferredLanguages){
|
public WebappDaoFactoryJena(OntModelSelector ontModelSelector, String defaultNamespace, HashSet<String> nonuserNamespaces, String[] preferredLanguages){
|
||||||
this(ontModelSelector, defaultNamespace, nonuserNamespaces, preferredLanguages, null);
|
this(ontModelSelector, defaultNamespace, nonuserNamespaces, preferredLanguages, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public WebappDaoFactoryJena(OntModelSelector ontModelSelector, OntModelSelector inferenceOntModelSelector, String defaultNamespace, HashSet<String> nonuserNamespaces, String[] preferredLanguages){
|
||||||
|
this(ontModelSelector, inferenceOntModelSelector, defaultNamespace, nonuserNamespaces, preferredLanguages, null);
|
||||||
|
}
|
||||||
|
|
||||||
public WebappDaoFactoryJena(OntModelSelector ontModelSelector) {
|
public WebappDaoFactoryJena(OntModelSelector ontModelSelector) {
|
||||||
this(ontModelSelector, null, null, null, null);
|
this(ontModelSelector, null, null, null, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public WebappDaoFactoryJena(OntModel ontModel, String defaultNamespace, HashSet<String> nonuserNamespaces, String[] preferredLanguages, String userURI){
|
public WebappDaoFactoryJena(OntModel ontModel, String defaultNamespace, HashSet<String> nonuserNamespaces, String[] preferredLanguages, String userURI){
|
||||||
|
@ -181,7 +221,7 @@ public class WebappDaoFactoryJena implements WebappDaoFactory {
|
||||||
}
|
}
|
||||||
|
|
||||||
public WebappDaoFactoryJena(OntModel ontModel) {
|
public WebappDaoFactoryJena(OntModel ontModel) {
|
||||||
this(new SimpleOntModelSelector(ontModel), null, null, null, null);
|
this(new SimpleOntModelSelector(ontModel), null, null, null, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public OntModelSelector getOntModelSelector() {
|
public OntModelSelector getOntModelSelector() {
|
||||||
|
@ -493,7 +533,8 @@ public class WebappDaoFactoryJena implements WebappDaoFactory {
|
||||||
DataPropertyStatementDao dataPropertyStatementDao = null;
|
DataPropertyStatementDao dataPropertyStatementDao = null;
|
||||||
public DataPropertyStatementDao getDataPropertyStatementDao() {
|
public DataPropertyStatementDao getDataPropertyStatementDao() {
|
||||||
if( dataPropertyStatementDao == null )
|
if( dataPropertyStatementDao == null )
|
||||||
dataPropertyStatementDao = new DataPropertyStatementDaoJena(this);
|
dataPropertyStatementDao = new DataPropertyStatementDaoJena(
|
||||||
|
dwf, this);
|
||||||
return dataPropertyStatementDao;
|
return dataPropertyStatementDao;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -507,7 +548,7 @@ public class WebappDaoFactoryJena implements WebappDaoFactory {
|
||||||
DataPropertyDao dataPropertyDao = null;
|
DataPropertyDao dataPropertyDao = null;
|
||||||
public DataPropertyDao getDataPropertyDao() {
|
public DataPropertyDao getDataPropertyDao() {
|
||||||
if( dataPropertyDao == null )
|
if( dataPropertyDao == null )
|
||||||
dataPropertyDao = new DataPropertyDaoJena(this);
|
dataPropertyDao = new DataPropertyDaoJena(dwf, this);
|
||||||
return dataPropertyDao;
|
return dataPropertyDao;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -528,7 +569,8 @@ public class WebappDaoFactoryJena implements WebappDaoFactory {
|
||||||
ObjectPropertyStatementDao objectPropertyStatementDao = null;
|
ObjectPropertyStatementDao objectPropertyStatementDao = null;
|
||||||
public ObjectPropertyStatementDao getObjectPropertyStatementDao() {
|
public ObjectPropertyStatementDao getObjectPropertyStatementDao() {
|
||||||
if( objectPropertyStatementDao == null )
|
if( objectPropertyStatementDao == null )
|
||||||
objectPropertyStatementDao = new ObjectPropertyStatementDaoJena(this);
|
objectPropertyStatementDao = new ObjectPropertyStatementDaoJena(
|
||||||
|
dwf, this);
|
||||||
return objectPropertyStatementDao;
|
return objectPropertyStatementDao;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -542,7 +584,7 @@ public class WebappDaoFactoryJena implements WebappDaoFactory {
|
||||||
private ObjectPropertyDao objectPropertyDao = null;
|
private ObjectPropertyDao objectPropertyDao = null;
|
||||||
public ObjectPropertyDao getObjectPropertyDao() {
|
public ObjectPropertyDao getObjectPropertyDao() {
|
||||||
if( objectPropertyDao == null )
|
if( objectPropertyDao == null )
|
||||||
objectPropertyDao = new ObjectPropertyDaoJena(this);
|
objectPropertyDao = new ObjectPropertyDaoJena(dwf, this);
|
||||||
return objectPropertyDao;
|
return objectPropertyDao;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -595,4 +637,5 @@ public class WebappDaoFactoryJena implements WebappDaoFactory {
|
||||||
public DisplayModelDao getDisplayModelDao(){
|
public DisplayModelDao getDisplayModelDao(){
|
||||||
return new DisplayModelDaoJena( this );
|
return new DisplayModelDaoJena( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,20 +97,6 @@ public class WebappDaoFactorySDB extends WebappDaoFactoryJena {
|
||||||
return vClassDao = new VClassDaoSDB(dwf, this);
|
return vClassDao = new VClassDaoSDB(dwf, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class StaticDatasetFactory implements DatasetWrapperFactory {
|
|
||||||
|
|
||||||
private Dataset _dataset;
|
|
||||||
|
|
||||||
public StaticDatasetFactory (Dataset dataset) {
|
|
||||||
_dataset = dataset;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DatasetWrapper getDatasetWrapper() {
|
|
||||||
return new DatasetWrapper(_dataset);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private class ReconnectingDatasetFactory implements DatasetWrapperFactory {
|
private class ReconnectingDatasetFactory implements DatasetWrapperFactory {
|
||||||
|
|
||||||
private BasicDataSource _bds;
|
private BasicDataSource _bds;
|
||||||
|
|
|
@ -87,17 +87,20 @@ public class JenaDataSourceSetup extends JenaDataSourceSetupBase implements java
|
||||||
checkForNamespaceMismatch( memModel, defaultNamespace );
|
checkForNamespaceMismatch( memModel, defaultNamespace );
|
||||||
|
|
||||||
sce.getServletContext().setAttribute("baseOntModel", memModel);
|
sce.getServletContext().setAttribute("baseOntModel", memModel);
|
||||||
WebappDaoFactory baseWadf = new WebappDaoFactoryJena(baseOms, defaultNamespace, null, null);
|
WebappDaoFactory baseWadf = new WebappDaoFactoryJena(
|
||||||
|
baseOms, defaultNamespace, null, null);
|
||||||
sce.getServletContext().setAttribute("assertionsWebappDaoFactory",baseWadf);
|
sce.getServletContext().setAttribute("assertionsWebappDaoFactory",baseWadf);
|
||||||
sce.getServletContext().setAttribute("baseOntModelSelector", baseOms);
|
sce.getServletContext().setAttribute("baseOntModelSelector", baseOms);
|
||||||
|
|
||||||
sce.getServletContext().setAttribute("inferenceOntModel", inferenceModel);
|
sce.getServletContext().setAttribute("inferenceOntModel", inferenceModel);
|
||||||
WebappDaoFactory infWadf = new WebappDaoFactoryJena(inferenceOms, defaultNamespace, null, null);
|
WebappDaoFactory infWadf = new WebappDaoFactoryJena(
|
||||||
|
inferenceOms, defaultNamespace, null, null);
|
||||||
sce.getServletContext().setAttribute("deductionsWebappDaoFactory", infWadf);
|
sce.getServletContext().setAttribute("deductionsWebappDaoFactory", infWadf);
|
||||||
sce.getServletContext().setAttribute("inferenceOntModelSelector", inferenceOms);
|
sce.getServletContext().setAttribute("inferenceOntModelSelector", inferenceOms);
|
||||||
|
|
||||||
sce.getServletContext().setAttribute("jenaOntModel", unionModel);
|
sce.getServletContext().setAttribute("jenaOntModel", unionModel);
|
||||||
WebappDaoFactory wadf = new WebappDaoFactoryJena(unionOms, defaultNamespace, null, null);
|
WebappDaoFactory wadf = new WebappDaoFactoryJena(
|
||||||
|
baseOms, inferenceOms, defaultNamespace, null, null);
|
||||||
sce.getServletContext().setAttribute("webappDaoFactory",wadf);
|
sce.getServletContext().setAttribute("webappDaoFactory",wadf);
|
||||||
sce.getServletContext().setAttribute("unionOntModelSelector", unionOms);
|
sce.getServletContext().setAttribute("unionOntModelSelector", unionOms);
|
||||||
|
|
||||||
|
|
|
@ -23,9 +23,9 @@
|
||||||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
|
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
|
||||||
|
|
||||||
SELECT ?object ?name ?moniker {
|
SELECT ?object ?name ?moniker {
|
||||||
?subject ?property ?object .
|
GRAPH ?g1 { ?subject ?property ?object }
|
||||||
OPTIONAL { ?object rdfs:label ?name . }
|
OPTIONAL { GRAPH ?g2 { ?object rdfs:label ?name } }
|
||||||
OPTIONAL { ?object vitro:moniker ?moniker . }
|
OPTIONAL { GRAPH ?g3 { ?object vitro:moniker ?moniker } }
|
||||||
}
|
}
|
||||||
</query>
|
</query>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue