Cleanup: remove unused imports and unneeded casts.
This commit is contained in:
parent
bb2ceaeea3
commit
c7b104ca40
39 changed files with 113 additions and 241 deletions
|
@ -8,7 +8,6 @@ import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -24,7 +23,6 @@ import com.hp.hpl.jena.ontology.OntProperty;
|
||||||
import com.hp.hpl.jena.ontology.OntResource;
|
import com.hp.hpl.jena.ontology.OntResource;
|
||||||
import com.hp.hpl.jena.ontology.ProfileException;
|
import com.hp.hpl.jena.ontology.ProfileException;
|
||||||
import com.hp.hpl.jena.ontology.Restriction;
|
import com.hp.hpl.jena.ontology.Restriction;
|
||||||
import com.hp.hpl.jena.ontology.SomeValuesFromRestriction;
|
|
||||||
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;
|
||||||
|
@ -53,7 +51,6 @@ import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyDao;
|
import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyDao;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.InsertException;
|
import edu.cornell.mannlib.vitro.webapp.dao.InsertException;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.OntologyDao;
|
import edu.cornell.mannlib.vitro.webapp.dao.OntologyDao;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.VClassDao;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.event.EditEvent;
|
import edu.cornell.mannlib.vitro.webapp.dao.jena.event.EditEvent;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.pellet.PelletListener;
|
import edu.cornell.mannlib.vitro.webapp.dao.jena.pellet.PelletListener;
|
||||||
|
@ -93,7 +90,7 @@ public class DataPropertyDaoJena extends PropertyDaoJena implements
|
||||||
try {
|
try {
|
||||||
com.hp.hpl.jena.ontology.OntResource ind = ontModel.getOntResource(dataPropertyURI);
|
com.hp.hpl.jena.ontology.OntResource ind = ontModel.getOntResource(dataPropertyURI);
|
||||||
if( ind != null ){
|
if( ind != null ){
|
||||||
ontModel.add(ind,(Property)DATAPROPERTY_ISEXTERNALID, "TRUE");
|
ontModel.add(ind, DATAPROPERTY_ISEXTERNALID, "TRUE");
|
||||||
return true;
|
return true;
|
||||||
}else{
|
}else{
|
||||||
return false;
|
return false;
|
||||||
|
@ -114,7 +111,7 @@ public class DataPropertyDaoJena extends PropertyDaoJena implements
|
||||||
while(restIt.hasNext()) {
|
while(restIt.hasNext()) {
|
||||||
Resource restRes = restIt.next();
|
Resource restRes = restIt.next();
|
||||||
if (restRes.canAs(OntResource.class)) {
|
if (restRes.canAs(OntResource.class)) {
|
||||||
OntResource restOntRes = (OntResource) restRes.as(OntResource.class);
|
OntResource restOntRes = restRes.as(OntResource.class);
|
||||||
smartRemove(restOntRes, ontModel);
|
smartRemove(restOntRes, ontModel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -181,7 +178,7 @@ public class DataPropertyDaoJena extends PropertyDaoJena implements
|
||||||
dp.setNamespace(op.getNameSpace());
|
dp.setNamespace(op.getNameSpace());
|
||||||
dp.setLocalName(op.getLocalName());
|
dp.setLocalName(op.getLocalName());
|
||||||
OntologyDao oDao=getWebappDaoFactory().getOntologyDao();
|
OntologyDao oDao=getWebappDaoFactory().getOntologyDao();
|
||||||
Ontology o = (Ontology)oDao.getOntologyByURI(dp.getNamespace());
|
Ontology o = oDao.getOntologyByURI(dp.getNamespace());
|
||||||
if (o==null) {
|
if (o==null) {
|
||||||
if (!VitroVocabulary.vitroURI.equals(dp.getNamespace())) {
|
if (!VitroVocabulary.vitroURI.equals(dp.getNamespace())) {
|
||||||
log.debug("datapropFromOntProperty(): no ontology object found for the namespace "+dp.getNamespace());
|
log.debug("datapropFromOntProperty(): no ontology object found for the namespace "+dp.getNamespace());
|
||||||
|
@ -206,8 +203,8 @@ public class DataPropertyDaoJena extends PropertyDaoJena implements
|
||||||
dp.setExample(getPropertyStringValue(op,EXAMPLE_ANNOT));
|
dp.setExample(getPropertyStringValue(op,EXAMPLE_ANNOT));
|
||||||
dp.setDescription(getPropertyStringValue(op,DESCRIPTION_ANNOT));
|
dp.setDescription(getPropertyStringValue(op,DESCRIPTION_ANNOT));
|
||||||
dp.setPublicDescription(getPropertyStringValue(op,PUBLIC_DESCRIPTION_ANNOT));
|
dp.setPublicDescription(getPropertyStringValue(op,PUBLIC_DESCRIPTION_ANNOT));
|
||||||
dp.setDisplayTier(((WebappDaoFactoryJena)getWebappDaoFactory()).getJenaBaseDao().getPropertyNonNegativeIntValue(op, DISPLAY_RANK_ANNOT));
|
dp.setDisplayTier((getWebappDaoFactory()).getJenaBaseDao().getPropertyNonNegativeIntValue(op, DISPLAY_RANK_ANNOT));
|
||||||
dp.setDisplayLimit(((WebappDaoFactoryJena)getWebappDaoFactory()).getJenaBaseDao().getPropertyNonNegativeIntValue(op, DISPLAY_LIMIT));
|
dp.setDisplayLimit((getWebappDaoFactory()).getJenaBaseDao().getPropertyNonNegativeIntValue(op, DISPLAY_LIMIT));
|
||||||
|
|
||||||
//There might be multiple HIDDEN_FROM_DISPLAY_BELOW_ROLE_LEVEL_ANNOT properties, only use the highest
|
//There might be multiple HIDDEN_FROM_DISPLAY_BELOW_ROLE_LEVEL_ANNOT properties, only use the highest
|
||||||
StmtIterator it = op.listProperties(HIDDEN_FROM_DISPLAY_BELOW_ROLE_LEVEL_ANNOT);
|
StmtIterator it = op.listProperties(HIDDEN_FROM_DISPLAY_BELOW_ROLE_LEVEL_ANNOT);
|
||||||
|
@ -216,7 +213,7 @@ public class DataPropertyDaoJena extends PropertyDaoJena implements
|
||||||
Statement stmt = it.nextStatement();
|
Statement stmt = it.nextStatement();
|
||||||
RDFNode obj;
|
RDFNode obj;
|
||||||
if( stmt != null && (obj = stmt.getObject()) != null && obj.isURIResource() ){
|
if( stmt != null && (obj = stmt.getObject()) != null && obj.isURIResource() ){
|
||||||
Resource res = (Resource)obj.as(Resource.class);
|
Resource res = obj.as(Resource.class);
|
||||||
if( res != null && res.getURI() != null ){
|
if( res != null && res.getURI() != null ){
|
||||||
BaseResourceBean.RoleLevel roleFromModel = BaseResourceBean.RoleLevel.getRoleByUri(res.getURI());
|
BaseResourceBean.RoleLevel roleFromModel = BaseResourceBean.RoleLevel.getRoleByUri(res.getURI());
|
||||||
if( roleFromModel != null &&
|
if( roleFromModel != null &&
|
||||||
|
@ -235,7 +232,7 @@ public class DataPropertyDaoJena extends PropertyDaoJena implements
|
||||||
Statement stmt = it.nextStatement();
|
Statement stmt = it.nextStatement();
|
||||||
RDFNode obj;
|
RDFNode obj;
|
||||||
if( stmt != null && (obj = stmt.getObject()) != null && obj.isURIResource() ){
|
if( stmt != null && (obj = stmt.getObject()) != null && obj.isURIResource() ){
|
||||||
Resource res = (Resource)obj.as(Resource.class);
|
Resource res = obj.as(Resource.class);
|
||||||
if( res != null && res.getURI() != null ){
|
if( res != null && res.getURI() != null ){
|
||||||
BaseResourceBean.RoleLevel roleFromModel = BaseResourceBean.RoleLevel.getRoleByUri(res.getURI());
|
BaseResourceBean.RoleLevel roleFromModel = BaseResourceBean.RoleLevel.getRoleByUri(res.getURI());
|
||||||
if( roleFromModel != null &&
|
if( roleFromModel != null &&
|
||||||
|
@ -365,7 +362,7 @@ public class DataPropertyDaoJena extends PropertyDaoJena implements
|
||||||
while (restIt.hasNext()) {
|
while (restIt.hasNext()) {
|
||||||
Resource restRes = restIt.next();
|
Resource restRes = restIt.next();
|
||||||
if (restRes.canAs(Restriction.class)) {
|
if (restRes.canAs(Restriction.class)) {
|
||||||
Restriction rest = (Restriction) restRes.as(Restriction.class);
|
Restriction rest = restRes.as(Restriction.class);
|
||||||
if (rest.isAllValuesFromRestriction()) {
|
if (rest.isAllValuesFromRestriction()) {
|
||||||
AllValuesFromRestriction avfrest = rest.asAllValuesFromRestriction();
|
AllValuesFromRestriction avfrest = rest.asAllValuesFromRestriction();
|
||||||
if (avfrest.getAllValuesFrom() != null) {
|
if (avfrest.getAllValuesFrom() != null) {
|
||||||
|
@ -485,7 +482,7 @@ public class DataPropertyDaoJena extends PropertyDaoJena implements
|
||||||
}
|
}
|
||||||
com.hp.hpl.jena.ontology.DatatypeProperty jDataprop = ontModel.createDatatypeProperty(dtp.getURI());
|
com.hp.hpl.jena.ontology.DatatypeProperty jDataprop = ontModel.createDatatypeProperty(dtp.getURI());
|
||||||
if (dtp.getPublicName() != null && dtp.getPublicName().length() > 0) {
|
if (dtp.getPublicName() != null && dtp.getPublicName().length() > 0) {
|
||||||
jDataprop.setLabel(dtp.getPublicName(), (String) getDefaultLanguage());
|
jDataprop.setLabel(dtp.getPublicName(), getDefaultLanguage());
|
||||||
} else {
|
} else {
|
||||||
jDataprop.removeAll(RDFS.label);
|
jDataprop.removeAll(RDFS.label);
|
||||||
}
|
}
|
||||||
|
@ -609,7 +606,7 @@ public class DataPropertyDaoJena extends PropertyDaoJena implements
|
||||||
while (parentNodeIt.hasNext()) {
|
while (parentNodeIt.hasNext()) {
|
||||||
RDFNode parentNode = parentNodeIt.next();
|
RDFNode parentNode = parentNodeIt.next();
|
||||||
if (parentNode.canAs(Property.class)) {
|
if (parentNode.canAs(Property.class)) {
|
||||||
parentList.add((Property) parentNode.as(Property.class));
|
parentList.add(parentNode.as(Property.class));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (parentList.size()==0) {
|
if (parentList.size()==0) {
|
||||||
|
|
|
@ -10,6 +10,9 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
import com.hp.hpl.jena.datatypes.TypeMapper;
|
import com.hp.hpl.jena.datatypes.TypeMapper;
|
||||||
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;
|
||||||
|
@ -27,7 +30,6 @@ 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;
|
||||||
import com.hp.hpl.jena.rdf.model.Property;
|
import com.hp.hpl.jena.rdf.model.Property;
|
||||||
import com.hp.hpl.jena.rdf.model.RDFNode;
|
|
||||||
import com.hp.hpl.jena.rdf.model.Resource;
|
import com.hp.hpl.jena.rdf.model.Resource;
|
||||||
import com.hp.hpl.jena.rdf.model.ResourceFactory;
|
import com.hp.hpl.jena.rdf.model.ResourceFactory;
|
||||||
import com.hp.hpl.jena.rdf.model.Statement;
|
import com.hp.hpl.jena.rdf.model.Statement;
|
||||||
|
@ -40,14 +42,9 @@ import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
|
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatementImpl;
|
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatementImpl;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.edit.ReorderController;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyStatementDao;
|
import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyStatementDao;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.event.IndividualUpdateEvent;
|
import edu.cornell.mannlib.vitro.webapp.dao.jena.event.IndividualUpdateEvent;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.ObjectPropertyStatementDaoJena;
|
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
|
||||||
import org.apache.commons.logging.LogFactory;
|
|
||||||
|
|
||||||
public class DataPropertyStatementDaoJena extends JenaBaseDao implements DataPropertyStatementDao
|
public class DataPropertyStatementDaoJena extends JenaBaseDao implements DataPropertyStatementDao
|
||||||
{
|
{
|
||||||
|
@ -114,7 +111,7 @@ public class DataPropertyStatementDaoJena extends JenaBaseDao implements DataPro
|
||||||
StmtIterator stmtIt = ind.listProperties();
|
StmtIterator stmtIt = ind.listProperties();
|
||||||
while( stmtIt.hasNext() )
|
while( stmtIt.hasNext() )
|
||||||
{
|
{
|
||||||
Statement st = (Statement)stmtIt.next();
|
Statement st = stmtIt.next();
|
||||||
boolean addToList = /*allowAnyNameSpace ? st.getObject().canAs(Literal.class) :*/ st.getObject().isLiteral() &&
|
boolean addToList = /*allowAnyNameSpace ? st.getObject().canAs(Literal.class) :*/ st.getObject().isLiteral() &&
|
||||||
(
|
(
|
||||||
(RDF.value.equals(st.getPredicate()) || VitroVocabulary.value.equals(st.getPredicate().getURI()))
|
(RDF.value.equals(st.getPredicate()) || VitroVocabulary.value.equals(st.getPredicate().getURI()))
|
||||||
|
@ -210,7 +207,7 @@ public class DataPropertyStatementDaoJena extends JenaBaseDao implements DataPro
|
||||||
// do something annoying if we are dealing with a blank node
|
// do something annoying if we are dealing with a blank node
|
||||||
try {
|
try {
|
||||||
getOntModel().enterCriticalSection(Lock.READ);
|
getOntModel().enterCriticalSection(Lock.READ);
|
||||||
OntResource ontRes = (OntResource) getOntModel().createResource(
|
OntResource ontRes = getOntModel().createResource(
|
||||||
new AnonId(entity.getLocalName())).as(OntResource.class);
|
new AnonId(entity.getLocalName())).as(OntResource.class);
|
||||||
if (ontRes == null) {
|
if (ontRes == null) {
|
||||||
return edList;
|
return edList;
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
package edu.cornell.mannlib.vitro.webapp.dao.jena;
|
package edu.cornell.mannlib.vitro.webapp.dao.jena;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.hp.hpl.jena.ontology.OntModel;
|
import com.hp.hpl.jena.ontology.OntModel;
|
||||||
|
@ -12,20 +11,15 @@ import com.hp.hpl.jena.query.Dataset;
|
||||||
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;
|
||||||
import com.hp.hpl.jena.query.QueryFactory;
|
import com.hp.hpl.jena.query.QueryFactory;
|
||||||
import com.hp.hpl.jena.query.QuerySolution;
|
|
||||||
import com.hp.hpl.jena.query.QuerySolutionMap;
|
|
||||||
import com.hp.hpl.jena.query.ResultSet;
|
|
||||||
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;
|
||||||
import com.hp.hpl.jena.rdf.model.Resource;
|
import com.hp.hpl.jena.rdf.model.Resource;
|
||||||
import com.hp.hpl.jena.rdf.model.ResourceFactory;
|
|
||||||
import com.hp.hpl.jena.rdf.model.Statement;
|
import com.hp.hpl.jena.rdf.model.Statement;
|
||||||
import com.hp.hpl.jena.rdf.model.StmtIterator;
|
import com.hp.hpl.jena.rdf.model.StmtIterator;
|
||||||
import com.hp.hpl.jena.shared.Lock;
|
import com.hp.hpl.jena.shared.Lock;
|
||||||
import com.hp.hpl.jena.vocabulary.RDF;
|
import com.hp.hpl.jena.vocabulary.RDF;
|
||||||
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
|
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatementImpl;
|
import edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatementImpl;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||||
|
@ -85,7 +79,7 @@ public class DataPropertyStatementDaoSDB extends DataPropertyStatementDaoJena
|
||||||
StmtIterator stmtIt = ind.listProperties();
|
StmtIterator stmtIt = ind.listProperties();
|
||||||
while( stmtIt.hasNext() )
|
while( stmtIt.hasNext() )
|
||||||
{
|
{
|
||||||
Statement st = (Statement)stmtIt.next();
|
Statement st = stmtIt.next();
|
||||||
boolean addToList = /*allowAnyNameSpace ? st.getObject().canAs(Literal.class) :*/ st.getObject().isLiteral() &&
|
boolean addToList = /*allowAnyNameSpace ? st.getObject().canAs(Literal.class) :*/ st.getObject().isLiteral() &&
|
||||||
(
|
(
|
||||||
(RDF.value.equals(st.getPredicate()) || VitroVocabulary.value.equals(st.getPredicate().getURI()))
|
(RDF.value.equals(st.getPredicate()) || VitroVocabulary.value.equals(st.getPredicate().getURI()))
|
||||||
|
|
|
@ -4,14 +4,10 @@ package edu.cornell.mannlib.vitro.webapp.dao.jena;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.hp.hpl.jena.ontology.OntModel;
|
|
||||||
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.Datatype;
|
import edu.cornell.mannlib.vitro.webapp.beans.Datatype;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.DatatypeDao;
|
import edu.cornell.mannlib.vitro.webapp.dao.DatatypeDao;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
|
||||||
|
|
||||||
public class DatatypeDaoJena extends JenaBaseDao implements DatatypeDao {
|
public class DatatypeDaoJena extends JenaBaseDao implements DatatypeDao {
|
||||||
|
|
||||||
|
|
|
@ -9,7 +9,6 @@ import java.util.List;
|
||||||
import java.util.ListIterator;
|
import java.util.ListIterator;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import com.hp.hpl.jena.ontology.OntModel;
|
|
||||||
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;
|
||||||
import com.hp.hpl.jena.rdf.model.Property;
|
import com.hp.hpl.jena.rdf.model.Property;
|
||||||
|
@ -89,14 +88,13 @@ public class DependentResourceDeleteJena {
|
||||||
* Find all statements where for a given statement in the assertions,
|
* Find all statements where for a given statement in the assertions,
|
||||||
* there is at least one statement in the retractions that has
|
* there is at least one statement in the retractions that has
|
||||||
* the same predicate and object. */
|
* the same predicate and object. */
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
private static List<Statement> getChangedStmts(Model assertions, Model retractions){
|
private static List<Statement> getChangedStmts(Model assertions, Model retractions){
|
||||||
List<Statement> changedStmts = new LinkedList<Statement>();
|
List<Statement> changedStmts = new LinkedList<Statement>();
|
||||||
StmtIterator it = assertions.listStatements();
|
StmtIterator it = assertions.listStatements();
|
||||||
while(it.hasNext()){
|
while(it.hasNext()){
|
||||||
Statement assertionStmtStatement = it.nextStatement();
|
Statement assertionStmtStatement = it.nextStatement();
|
||||||
if( assertionStmtStatement.getObject().canAs( Resource.class )){
|
if( assertionStmtStatement.getObject().canAs( Resource.class )){
|
||||||
Resource asserObj = (Resource) assertionStmtStatement.getObject().as(Resource.class);
|
Resource asserObj = assertionStmtStatement.getObject().as(Resource.class);
|
||||||
StmtIterator retractionStmts =
|
StmtIterator retractionStmts =
|
||||||
retractions.listStatements(
|
retractions.listStatements(
|
||||||
(Resource)null,
|
(Resource)null,
|
||||||
|
@ -138,7 +136,7 @@ public class DependentResourceDeleteJena {
|
||||||
|
|
||||||
if( ( obj.canAs(Resource.class) && isPredicateDependencyRelation(stmt.getPredicate(), model) )
|
if( ( obj.canAs(Resource.class) && isPredicateDependencyRelation(stmt.getPredicate(), model) )
|
||||||
|| ( obj.isAnon() && perviousWasDependentResource ) ){
|
|| ( obj.isAnon() && perviousWasDependentResource ) ){
|
||||||
Resource res = (Resource)obj.as(Resource.class);
|
Resource res = obj.as(Resource.class);
|
||||||
String id = res.isAnon()?res.getId().toString():res.getURI();
|
String id = res.isAnon()?res.getId().toString():res.getURI();
|
||||||
|
|
||||||
if( !visitedUris.contains(id) ){
|
if( !visitedUris.contains(id) ){
|
||||||
|
|
|
@ -7,9 +7,7 @@ import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.FileWriter;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
import java.nio.channels.FileChannel;
|
import java.nio.channels.FileChannel;
|
||||||
|
|
||||||
|
@ -22,7 +20,6 @@ import com.hp.hpl.jena.rdf.model.Property;
|
||||||
import com.hp.hpl.jena.rdf.model.Resource;
|
import com.hp.hpl.jena.rdf.model.Resource;
|
||||||
import com.hp.hpl.jena.rdf.model.ResourceFactory;
|
import com.hp.hpl.jena.rdf.model.ResourceFactory;
|
||||||
import com.hp.hpl.jena.rdf.model.Statement;
|
import com.hp.hpl.jena.rdf.model.Statement;
|
||||||
import com.hp.hpl.jena.util.FileManager;
|
|
||||||
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.DisplayModelDao;
|
import edu.cornell.mannlib.vitro.webapp.dao.DisplayModelDao;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary;
|
import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary;
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
|
|
||||||
package edu.cornell.mannlib.vitro.webapp.dao.jena;
|
package edu.cornell.mannlib.vitro.webapp.dao.jena;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
|
||||||
import org.apache.commons.collections.iterators.EmptyIterator;
|
import org.apache.commons.collections.iterators.EmptyIterator;
|
||||||
|
|
|
@ -146,7 +146,7 @@ public class IndividualDaoJena extends JenaBaseDao implements IndividualDao {
|
||||||
|
|
||||||
|
|
||||||
if (theClass.isAnon() && theClass.canAs(UnionClass.class)) {
|
if (theClass.isAnon() && theClass.canAs(UnionClass.class)) {
|
||||||
UnionClass u = (UnionClass) theClass.as(UnionClass.class);
|
UnionClass u = theClass.as(UnionClass.class);
|
||||||
for (OntClass operand : u.listOperands().toList()) {
|
for (OntClass operand : u.listOperands().toList()) {
|
||||||
VClass vc = new VClassJena(operand, getWebappDaoFactory());
|
VClass vc = new VClassJena(operand, getWebappDaoFactory());
|
||||||
ents.addAll(getIndividualsByVClass(vc));
|
ents.addAll(getIndividualsByVClass(vc));
|
||||||
|
@ -159,8 +159,8 @@ public class IndividualDaoJena extends JenaBaseDao implements IndividualDao {
|
||||||
try {
|
try {
|
||||||
while (stmtIt.hasNext()) {
|
while (stmtIt.hasNext()) {
|
||||||
Statement stmt = stmtIt.nextStatement();
|
Statement stmt = stmtIt.nextStatement();
|
||||||
OntResource ind = (OntResource) stmt.getSubject().as(OntResource.class);
|
OntResource ind = stmt.getSubject().as(OntResource.class);
|
||||||
ents.add(new IndividualJena(ind, (WebappDaoFactoryJena) getWebappDaoFactory()));
|
ents.add(new IndividualJena(ind, getWebappDaoFactory()));
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
stmtIt.close();
|
stmtIt.close();
|
||||||
|
@ -232,7 +232,7 @@ public class IndividualDaoJena extends JenaBaseDao implements IndividualDao {
|
||||||
ontModel.getBaseModel().notifyEvent(new IndividualCreationEvent(getWebappDaoFactory().getUserURI(),true,entURI));
|
ontModel.getBaseModel().notifyEvent(new IndividualCreationEvent(getWebappDaoFactory().getUserURI(),true,entURI));
|
||||||
com.hp.hpl.jena.ontology.Individual ind = ontModel.createIndividual(entURI,cls);
|
com.hp.hpl.jena.ontology.Individual ind = ontModel.createIndividual(entURI,cls);
|
||||||
if (ent.getName() != null) {
|
if (ent.getName() != null) {
|
||||||
ind.setLabel(ent.getName(), (String) getDefaultLanguage());
|
ind.setLabel(ent.getName(), getDefaultLanguage());
|
||||||
}
|
}
|
||||||
List<VClass> vclasses = ent.getVClasses(false);
|
List<VClass> vclasses = ent.getVClasses(false);
|
||||||
if (vclasses != null) {
|
if (vclasses != null) {
|
||||||
|
@ -388,7 +388,7 @@ public class IndividualDaoJena extends JenaBaseDao implements IndividualDao {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (res.canAs(OntResource.class)) {
|
if (res.canAs(OntResource.class)) {
|
||||||
OntResource ontRes = (OntResource) res.as(OntResource.class);
|
OntResource ontRes = res.as(OntResource.class);
|
||||||
smartRemove(ontRes, ontModel);
|
smartRemove(ontRes, ontModel);
|
||||||
} else {
|
} else {
|
||||||
ontModel.removeAll(res,null,null);
|
ontModel.removeAll(res,null,null);
|
||||||
|
@ -420,7 +420,7 @@ public class IndividualDaoJena extends JenaBaseDao implements IndividualDao {
|
||||||
OntResource ontRes = (entityURI.startsWith(VitroVocabulary.PSEUDO_BNODE_NS))
|
OntResource ontRes = (entityURI.startsWith(VitroVocabulary.PSEUDO_BNODE_NS))
|
||||||
? (OntResource) ontModel.createResource(new AnonId(entityURI.substring(VitroVocabulary.PSEUDO_BNODE_NS.length()))).as(OntResource.class)
|
? (OntResource) ontModel.createResource(new AnonId(entityURI.substring(VitroVocabulary.PSEUDO_BNODE_NS.length()))).as(OntResource.class)
|
||||||
: ontModel.getOntResource(entityURI);
|
: ontModel.getOntResource(entityURI);
|
||||||
Individual ent = new IndividualJena(ontRes, (WebappDaoFactoryJena) getWebappDaoFactory());
|
Individual ent = new IndividualJena(ontRes, getWebappDaoFactory());
|
||||||
return ent;
|
return ent;
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -494,7 +494,7 @@ public class IndividualDaoJena extends JenaBaseDao implements IndividualDao {
|
||||||
String subUri = ((Resource)sub).getURI();
|
String subUri = ((Resource)sub).getURI();
|
||||||
if( ! individualsMap.containsKey(subUri)){
|
if( ! individualsMap.containsKey(subUri)){
|
||||||
com.hp.hpl.jena.ontology.Individual ind = getOntModel().getIndividual(subUri);
|
com.hp.hpl.jena.ontology.Individual ind = getOntModel().getIndividual(subUri);
|
||||||
individualsMap.put(subUri,new IndividualJena(ind, (WebappDaoFactoryJena) getWebappDaoFactory()));
|
individualsMap.put(subUri,new IndividualJena(ind, getWebappDaoFactory()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -519,7 +519,7 @@ public class IndividualDaoJena extends JenaBaseDao implements IndividualDao {
|
||||||
String subUri = ((Resource)sub).getURI();
|
String subUri = ((Resource)sub).getURI();
|
||||||
if( ! individualsMap.containsKey(subUri)){
|
if( ! individualsMap.containsKey(subUri)){
|
||||||
com.hp.hpl.jena.ontology.Individual ind = getOntModel().getIndividual(subUri);
|
com.hp.hpl.jena.ontology.Individual ind = getOntModel().getIndividual(subUri);
|
||||||
individualsMap.put(subUri,new IndividualJena(ind, (WebappDaoFactoryJena) getWebappDaoFactory()));
|
individualsMap.put(subUri,new IndividualJena(ind, getWebappDaoFactory()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -544,7 +544,7 @@ public class IndividualDaoJena extends JenaBaseDao implements IndividualDao {
|
||||||
String subUri = ((Resource)sub).getURI();
|
String subUri = ((Resource)sub).getURI();
|
||||||
if( ! individualsMap.containsKey(subUri)){
|
if( ! individualsMap.containsKey(subUri)){
|
||||||
com.hp.hpl.jena.ontology.Individual ind = getOntModel().getIndividual(subUri);
|
com.hp.hpl.jena.ontology.Individual ind = getOntModel().getIndividual(subUri);
|
||||||
individualsMap.put(subUri,new IndividualJena(ind, (WebappDaoFactoryJena) getWebappDaoFactory()));
|
individualsMap.put(subUri,new IndividualJena(ind, getWebappDaoFactory()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -594,7 +594,7 @@ public class IndividualDaoJena extends JenaBaseDao implements IndividualDao {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
com.hp.hpl.jena.ontology.Individual ind = getOntModel().getIndividual(st.getURI());
|
com.hp.hpl.jena.ontology.Individual ind = getOntModel().getIndividual(st.getURI());
|
||||||
inds.add(new IndividualJena(ind, (WebappDaoFactoryJena) getWebappDaoFactory()));
|
inds.add(new IndividualJena(ind, getWebappDaoFactory()));
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
if( stmts != null ) stmts.close();
|
if( stmts != null ) stmts.close();
|
||||||
|
|
|
@ -106,7 +106,7 @@ public class IndividualDaoSDB extends IndividualDaoJena {
|
||||||
: ResourceFactory.createResource(vclassURI);
|
: ResourceFactory.createResource(vclassURI);
|
||||||
|
|
||||||
if (theClass.isAnon() && theClass.canAs(UnionClass.class)) {
|
if (theClass.isAnon() && theClass.canAs(UnionClass.class)) {
|
||||||
UnionClass u = (UnionClass) theClass.as(UnionClass.class);
|
UnionClass u = theClass.as(UnionClass.class);
|
||||||
for (OntClass operand : u.listOperands().toList()) {
|
for (OntClass operand : u.listOperands().toList()) {
|
||||||
VClass vc = new VClassJena(operand, getWebappDaoFactory());
|
VClass vc = new VClassJena(operand, getWebappDaoFactory());
|
||||||
ents.addAll(getIndividualsByVClass(vc));
|
ents.addAll(getIndividualsByVClass(vc));
|
||||||
|
@ -523,7 +523,7 @@ public class IndividualDaoSDB extends IndividualDaoJena {
|
||||||
try {
|
try {
|
||||||
ResultSet results = qe.execSelect();
|
ResultSet results = qe.execSelect();
|
||||||
while (results.hasNext()) {
|
while (results.hasNext()) {
|
||||||
QuerySolution qs = (QuerySolution) results.next();
|
QuerySolution qs = results.next();
|
||||||
Resource res = (Resource) qs.get("?ent");
|
Resource res = (Resource) qs.get("?ent");
|
||||||
if (res.getURI() != null) {
|
if (res.getURI() != null) {
|
||||||
individualURIs.add(res.getURI());
|
individualURIs.add(res.getURI());
|
||||||
|
|
|
@ -254,8 +254,8 @@ public class IndividualJena extends IndividualImpl implements Individual {
|
||||||
if (!s.getSubject().canAs(OntResource.class) || !s.getObject().canAs(OntResource.class)) {
|
if (!s.getSubject().canAs(OntResource.class) || !s.getObject().canAs(OntResource.class)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Individual subj = new IndividualJena((OntResource) s.getSubject().as(OntResource.class), webappDaoFactory);
|
Individual subj = new IndividualJena(s.getSubject().as(OntResource.class), webappDaoFactory);
|
||||||
Individual obj = new IndividualJena((OntResource) s.getObject().as(OntResource.class), webappDaoFactory);
|
Individual obj = new IndividualJena(s.getObject().as(OntResource.class), webappDaoFactory);
|
||||||
ObjectProperty op = webappDaoFactory.getObjectPropertyDao().getObjectPropertyByURI(s.getPredicate().getURI());
|
ObjectProperty op = webappDaoFactory.getObjectPropertyDao().getObjectPropertyByURI(s.getPredicate().getURI());
|
||||||
if (subj != null && obj != null && op != null) {
|
if (subj != null && obj != null && op != null) {
|
||||||
ObjectPropertyStatement ops = new ObjectPropertyStatementImpl();
|
ObjectPropertyStatement ops = new ObjectPropertyStatementImpl();
|
||||||
|
@ -287,7 +287,7 @@ public class IndividualJena extends IndividualImpl implements Individual {
|
||||||
RDFNode value = values.nextNode();
|
RDFNode value = values.nextNode();
|
||||||
if (value.canAs(OntResource.class)) {
|
if (value.canAs(OntResource.class)) {
|
||||||
relatedIndividuals.add(
|
relatedIndividuals.add(
|
||||||
new IndividualJena((OntResource) value.as(OntResource.class), webappDaoFactory) );
|
new IndividualJena(value.as(OntResource.class), webappDaoFactory) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -305,7 +305,7 @@ public class IndividualJena extends IndividualImpl implements Individual {
|
||||||
try {
|
try {
|
||||||
RDFNode value = ind.getPropertyValue(ind.getModel().getProperty(propertyURI));
|
RDFNode value = ind.getPropertyValue(ind.getModel().getProperty(propertyURI));
|
||||||
if (value != null && value.canAs(OntResource.class)) {
|
if (value != null && value.canAs(OntResource.class)) {
|
||||||
return new IndividualJena((OntResource) value.as(OntResource.class), webappDaoFactory);
|
return new IndividualJena(value.as(OntResource.class), webappDaoFactory);
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -582,11 +582,11 @@ public class IndividualJena extends IndividualImpl implements Individual {
|
||||||
int rv = 0;
|
int rv = 0;
|
||||||
try {
|
try {
|
||||||
if( val1 instanceof String )
|
if( val1 instanceof String )
|
||||||
rv = collator.compare( ((String)val1) , ((String)val2) );
|
rv = collator.compare(val1 , val2);
|
||||||
//rv = ((String)val1).compareTo((String)val2);
|
//rv = ((String)val1).compareTo((String)val2);
|
||||||
else if( val1 instanceof Date ) {
|
else if( val1 instanceof Date ) {
|
||||||
DateTime dt1 = new DateTime((Date)val1);
|
DateTime dt1 = new DateTime(val1);
|
||||||
DateTime dt2 = new DateTime((Date)val2);
|
DateTime dt2 = new DateTime(val2);
|
||||||
rv = dt1.compareTo(dt2);
|
rv = dt1.compareTo(dt2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -478,8 +478,7 @@ public class IndividualSDB extends IndividualImpl implements Individual {
|
||||||
Individual subj = null;
|
Individual subj = null;
|
||||||
try {
|
try {
|
||||||
subj = new IndividualSDB(
|
subj = new IndividualSDB(
|
||||||
((OntResource) s.getSubject().as(OntResource.class))
|
s.getSubject().as(OntResource.class).getURI(),
|
||||||
.getURI(),
|
|
||||||
this.dwf, datasetMode, webappDaoFactory);
|
this.dwf, datasetMode, webappDaoFactory);
|
||||||
} catch (IndividualNotFoundException e) {
|
} catch (IndividualNotFoundException e) {
|
||||||
// leave null subject
|
// leave null subject
|
||||||
|
@ -487,8 +486,7 @@ public class IndividualSDB extends IndividualImpl implements Individual {
|
||||||
Individual obj = null;
|
Individual obj = null;
|
||||||
try {
|
try {
|
||||||
obj = new IndividualSDB(
|
obj = new IndividualSDB(
|
||||||
((OntResource) s.getObject().as(OntResource.class))
|
s.getObject().as(OntResource.class).getURI(),
|
||||||
.getURI(),
|
|
||||||
this.dwf, datasetMode, webappDaoFactory);
|
this.dwf, datasetMode, webappDaoFactory);
|
||||||
} catch (IndividualNotFoundException e) {
|
} catch (IndividualNotFoundException e) {
|
||||||
// leave null object
|
// leave null object
|
||||||
|
@ -548,8 +546,7 @@ public class IndividualSDB extends IndividualImpl implements Individual {
|
||||||
if (value.canAs(OntResource.class)) {
|
if (value.canAs(OntResource.class)) {
|
||||||
relatedIndividuals.add(
|
relatedIndividuals.add(
|
||||||
new IndividualSDB(
|
new IndividualSDB(
|
||||||
((OntResource) value.as(OntResource.class))
|
value.as(OntResource.class).getURI(),
|
||||||
.getURI(),
|
|
||||||
this.dwf,
|
this.dwf,
|
||||||
datasetMode,
|
datasetMode,
|
||||||
webappDaoFactory) );
|
webappDaoFactory) );
|
||||||
|
@ -588,7 +585,7 @@ public class IndividualSDB extends IndividualImpl implements Individual {
|
||||||
if (value != null && value.canAs(OntResource.class)) {
|
if (value != null && value.canAs(OntResource.class)) {
|
||||||
try {
|
try {
|
||||||
return new IndividualSDB(
|
return new IndividualSDB(
|
||||||
((OntResource) value.as(OntResource.class)).getURI(),
|
value.as(OntResource.class).getURI(),
|
||||||
dwf, datasetMode, webappDaoFactory);
|
dwf, datasetMode, webappDaoFactory);
|
||||||
} catch (IndividualNotFoundException e) {
|
} catch (IndividualNotFoundException e) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -1045,8 +1042,8 @@ public class IndividualSDB extends IndividualImpl implements Individual {
|
||||||
rv = collator.compare( ((String)val1) , ((String)val2) );
|
rv = collator.compare( ((String)val1) , ((String)val2) );
|
||||||
//rv = ((String)val1).compareTo((String)val2);
|
//rv = ((String)val1).compareTo((String)val2);
|
||||||
else if( val1 instanceof Date ) {
|
else if( val1 instanceof Date ) {
|
||||||
DateTime dt1 = new DateTime((Date)val1);
|
DateTime dt1 = new DateTime(val1);
|
||||||
DateTime dt2 = new DateTime((Date)val2);
|
DateTime dt2 = new DateTime(val2);
|
||||||
rv = dt1.compareTo(dt2);
|
rv = dt1.compareTo(dt2);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -12,7 +12,6 @@ import java.util.Date;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
@ -23,7 +22,6 @@ import com.hp.hpl.jena.datatypes.xsd.XSDDatatype;
|
||||||
import com.hp.hpl.jena.graph.Node;
|
import com.hp.hpl.jena.graph.Node;
|
||||||
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.ontology.DatatypeProperty;
|
import com.hp.hpl.jena.ontology.DatatypeProperty;
|
||||||
import com.hp.hpl.jena.ontology.ObjectProperty;
|
import com.hp.hpl.jena.ontology.ObjectProperty;
|
||||||
import com.hp.hpl.jena.ontology.OntClass;
|
import com.hp.hpl.jena.ontology.OntClass;
|
||||||
|
@ -749,10 +747,10 @@ public class JenaBaseDao extends JenaBaseDaoCon {
|
||||||
|
|
||||||
if (label != null && label.length() > 0) {
|
if (label != null && label.length() > 0) {
|
||||||
|
|
||||||
String existingValue = ontRes.getLabel((String) getDefaultLanguage());
|
String existingValue = ontRes.getLabel(getDefaultLanguage());
|
||||||
|
|
||||||
if (existingValue == null || !existingValue.equals(label)) {
|
if (existingValue == null || !existingValue.equals(label)) {
|
||||||
ontRes.setLabel(label, (String) getDefaultLanguage());
|
ontRes.setLabel(label, getDefaultLanguage());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ontRes.removeAll(RDFS.label);
|
ontRes.removeAll(RDFS.label);
|
||||||
|
@ -910,7 +908,7 @@ public class JenaBaseDao extends JenaBaseDaoCon {
|
||||||
if (iri.hasViolation(false) ) {
|
if (iri.hasViolation(false) ) {
|
||||||
String errorStr = ("Bad URI: "+ uri +
|
String errorStr = ("Bad URI: "+ uri +
|
||||||
"\nOnly well-formed absolute URIrefs can be included in RDF/XML output: "
|
"\nOnly well-formed absolute URIrefs can be included in RDF/XML output: "
|
||||||
+ ((Violation)iri.violations(false).next()).getShortMessage());
|
+ (iri.violations(false).next()).getShortMessage());
|
||||||
return errorStr;
|
return errorStr;
|
||||||
} else {
|
} else {
|
||||||
return null;
|
return null;
|
||||||
|
@ -933,7 +931,7 @@ public class JenaBaseDao extends JenaBaseDaoCon {
|
||||||
String idStr = vitroURIStr.split("#")[1];
|
String idStr = vitroURIStr.split("#")[1];
|
||||||
RDFNode rdfNode = ontModel.getRDFNode(Node.createAnon(AnonId.create(idStr)));
|
RDFNode rdfNode = ontModel.getRDFNode(Node.createAnon(AnonId.create(idStr)));
|
||||||
if ( (rdfNode != null) && (rdfNode.canAs(OntClass.class)) ) {
|
if ( (rdfNode != null) && (rdfNode.canAs(OntClass.class)) ) {
|
||||||
cls = (OntClass) rdfNode.as(OntClass.class);
|
cls = rdfNode.as(OntClass.class);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
|
@ -1006,7 +1004,7 @@ public class JenaBaseDao extends JenaBaseDaoCon {
|
||||||
StmtIterator stmtIt = getOntModel().listStatements((Resource)null, prop, value);
|
StmtIterator stmtIt = getOntModel().listStatements((Resource)null, prop, value);
|
||||||
while (stmtIt.hasNext()) {
|
while (stmtIt.hasNext()) {
|
||||||
Statement stmt = stmtIt.nextStatement();
|
Statement stmt = stmtIt.nextStatement();
|
||||||
possibleSubjectSet.add((Resource)stmt.getSubject());
|
possibleSubjectSet.add(stmt.getSubject());
|
||||||
|
|
||||||
}
|
}
|
||||||
Iterator<Resource> possibleSubjectIt = possibleSubjectSet.iterator();
|
Iterator<Resource> possibleSubjectIt = possibleSubjectSet.iterator();
|
||||||
|
@ -1016,7 +1014,7 @@ public class JenaBaseDao extends JenaBaseDaoCon {
|
||||||
boolean hasAlternatePath = false;
|
boolean hasAlternatePath = false;
|
||||||
while (stmtIt.hasNext()) {
|
while (stmtIt.hasNext()) {
|
||||||
Statement stmt = stmtIt.nextStatement();
|
Statement stmt = stmtIt.nextStatement();
|
||||||
if (stmt.getObject().isResource() && possibleSubjectSet.contains((Resource)stmt.getObject())) {
|
if (stmt.getObject().isResource() && possibleSubjectSet.contains(stmt.getObject())) {
|
||||||
hasAlternatePath = true;
|
hasAlternatePath = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,6 @@ import java.util.HashSet;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.openjena.riot.RiotException;
|
|
||||||
|
|
||||||
import com.hp.hpl.jena.rdf.model.Model;
|
import com.hp.hpl.jena.rdf.model.Model;
|
||||||
import com.hp.hpl.jena.rdf.model.ModelChangedListener;
|
import com.hp.hpl.jena.rdf.model.ModelChangedListener;
|
||||||
|
@ -17,7 +16,6 @@ import com.hp.hpl.jena.rdf.model.Statement;
|
||||||
import com.hp.hpl.jena.rdf.model.StmtIterator;
|
import com.hp.hpl.jena.rdf.model.StmtIterator;
|
||||||
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.rdfservice.ChangeListener;
|
import edu.cornell.mannlib.vitro.webapp.rdfservice.ChangeListener;
|
||||||
import edu.cornell.mannlib.vitro.webapp.servlet.setup.JenaDataSourceSetupBase;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.servlet.setup.SimpleReasonerSetup;
|
import edu.cornell.mannlib.vitro.webapp.servlet.setup.SimpleReasonerSetup;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -95,7 +95,7 @@ public class JenaModelUtils {
|
||||||
.getRootClasses();
|
.getRootClasses();
|
||||||
for (Iterator<VClass> rootClassIt = rootClasses.iterator();
|
for (Iterator<VClass> rootClassIt = rootClasses.iterator();
|
||||||
rootClassIt.hasNext(); ) {
|
rootClassIt.hasNext(); ) {
|
||||||
VClass rootClass = (VClass) rootClassIt.next();
|
VClass rootClass = rootClassIt.next();
|
||||||
Individual classGroup = modelForClassgroups.createIndividual(
|
Individual classGroup = modelForClassgroups.createIndividual(
|
||||||
wadf.getDefaultNamespace() + "vitroClassGroup" +
|
wadf.getDefaultNamespace() + "vitroClassGroup" +
|
||||||
rootClass.getLocalName(), classGroupClass);
|
rootClass.getLocalName(), classGroupClass);
|
||||||
|
@ -108,7 +108,7 @@ public class JenaModelUtils {
|
||||||
for (Iterator<String> childIt = myWebappDaoFactory.getVClassDao()
|
for (Iterator<String> childIt = myWebappDaoFactory.getVClassDao()
|
||||||
.getAllSubClassURIs(rootClass.getURI()).iterator();
|
.getAllSubClassURIs(rootClass.getURI()).iterator();
|
||||||
childIt.hasNext(); ) {
|
childIt.hasNext(); ) {
|
||||||
String childURI = (String) childIt.next();
|
String childURI = childIt.next();
|
||||||
Resource childClass = modelForClassgroupAnnotations
|
Resource childClass = modelForClassgroupAnnotations
|
||||||
.getResource(childURI);
|
.getResource(childURI);
|
||||||
if (!modelForClassgroupAnnotations.contains(
|
if (!modelForClassgroupAnnotations.contains(
|
||||||
|
|
|
@ -90,7 +90,7 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
|
||||||
p.setNamespace(op.getNameSpace());
|
p.setNamespace(op.getNameSpace());
|
||||||
p.setLocalName(op.getLocalName());
|
p.setLocalName(op.getLocalName());
|
||||||
OntologyDao oDao=getWebappDaoFactory().getOntologyDao();
|
OntologyDao oDao=getWebappDaoFactory().getOntologyDao();
|
||||||
Ontology o = (Ontology)oDao.getOntologyByURI(p.getNamespace());
|
Ontology o = oDao.getOntologyByURI(p.getNamespace());
|
||||||
if (o==null) {
|
if (o==null) {
|
||||||
if (!VitroVocabulary.vitroURI.equals(p.getNamespace())) {
|
if (!VitroVocabulary.vitroURI.equals(p.getNamespace())) {
|
||||||
log.debug("propertyFromOntProperty(): no ontology object found for the namespace "+p.getNamespace());
|
log.debug("propertyFromOntProperty(): no ontology object found for the namespace "+p.getNamespace());
|
||||||
|
@ -178,7 +178,7 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
|
||||||
Statement stmt = it.nextStatement();
|
Statement stmt = it.nextStatement();
|
||||||
RDFNode obj;
|
RDFNode obj;
|
||||||
if( stmt != null && (obj = stmt.getObject()) != null && obj.isURIResource() ){
|
if( stmt != null && (obj = stmt.getObject()) != null && obj.isURIResource() ){
|
||||||
Resource res = (Resource)obj.as(Resource.class);
|
Resource res = obj.as(Resource.class);
|
||||||
if( res != null && res.getURI() != null ){
|
if( res != null && res.getURI() != null ){
|
||||||
BaseResourceBean.RoleLevel roleFromModel = BaseResourceBean.RoleLevel.getRoleByUri(res.getURI());
|
BaseResourceBean.RoleLevel roleFromModel = BaseResourceBean.RoleLevel.getRoleByUri(res.getURI());
|
||||||
if( roleFromModel != null &&
|
if( roleFromModel != null &&
|
||||||
|
@ -197,7 +197,7 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
|
||||||
Statement stmt = it.nextStatement();
|
Statement stmt = it.nextStatement();
|
||||||
RDFNode obj;
|
RDFNode obj;
|
||||||
if( stmt != null && (obj = stmt.getObject()) != null && obj.isURIResource() ){
|
if( stmt != null && (obj = stmt.getObject()) != null && obj.isURIResource() ){
|
||||||
Resource res = (Resource)obj.as(Resource.class);
|
Resource res = obj.as(Resource.class);
|
||||||
if( res != null && res.getURI() != null ){
|
if( res != null && res.getURI() != null ){
|
||||||
BaseResourceBean.RoleLevel roleFromModel = BaseResourceBean.RoleLevel.getRoleByUri(res.getURI());
|
BaseResourceBean.RoleLevel roleFromModel = BaseResourceBean.RoleLevel.getRoleByUri(res.getURI());
|
||||||
if( roleFromModel != null &&
|
if( roleFromModel != null &&
|
||||||
|
@ -257,7 +257,7 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
|
||||||
while (opIt.hasNext()) {
|
while (opIt.hasNext()) {
|
||||||
Resource res = (Resource) opIt.next();
|
Resource res = (Resource) opIt.next();
|
||||||
if ( (res.canAs(OntProperty.class)) && (!NONUSER_NAMESPACES.contains(res.getNameSpace())) ) {
|
if ( (res.canAs(OntProperty.class)) && (!NONUSER_NAMESPACES.contains(res.getNameSpace())) ) {
|
||||||
props.add(propertyFromOntProperty((OntProperty)res.as(OntProperty.class)));
|
props.add(propertyFromOntProperty(res.as(OntProperty.class)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -296,7 +296,7 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
|
||||||
while(it.hasNext()){
|
while(it.hasNext()){
|
||||||
ObjectPropertyStatement objPropertyStmt = (ObjectPropertyStatement)it.next();
|
ObjectPropertyStatement objPropertyStmt = (ObjectPropertyStatement)it.next();
|
||||||
if (hash.containsKey(objPropertyStmt.getPropertyURI())) {
|
if (hash.containsKey(objPropertyStmt.getPropertyURI())) {
|
||||||
ObjectProperty p = (ObjectProperty) hash.get(objPropertyStmt.getPropertyURI());
|
ObjectProperty p = hash.get(objPropertyStmt.getPropertyURI());
|
||||||
p.addObjectPropertyStatement(objPropertyStmt);
|
p.addObjectPropertyStatement(objPropertyStmt);
|
||||||
} else {
|
} else {
|
||||||
OntProperty op = getOntModel().getOntProperty(objPropertyStmt.getPropertyURI());
|
OntProperty op = getOntModel().getOntProperty(objPropertyStmt.getPropertyURI());
|
||||||
|
@ -601,7 +601,7 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
|
||||||
while(restIt.hasNext()) {
|
while(restIt.hasNext()) {
|
||||||
Resource restRes = restIt.next();
|
Resource restRes = restIt.next();
|
||||||
if (restRes.canAs(OntResource.class)) {
|
if (restRes.canAs(OntResource.class)) {
|
||||||
OntResource restOntRes = (OntResource) restRes.as(OntResource.class);
|
OntResource restOntRes = restRes.as(OntResource.class);
|
||||||
smartRemove(restOntRes, ontModel);
|
smartRemove(restOntRes, ontModel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -625,7 +625,7 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
|
||||||
while(restIt.hasNext()) {
|
while(restIt.hasNext()) {
|
||||||
Resource restRes = restIt.next();
|
Resource restRes = restIt.next();
|
||||||
if (restRes.canAs(OntResource.class)) {
|
if (restRes.canAs(OntResource.class)) {
|
||||||
OntResource restOntRes = (OntResource) restRes.as(OntResource.class);
|
OntResource restOntRes = restRes.as(OntResource.class);
|
||||||
smartRemove(restOntRes, ontModel);
|
smartRemove(restOntRes, ontModel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -658,7 +658,7 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
|
||||||
while (propIt.hasNext()) {
|
while (propIt.hasNext()) {
|
||||||
Resource res = (Resource) propIt.next();
|
Resource res = (Resource) propIt.next();
|
||||||
if (res.canAs(OntProperty.class)) {
|
if (res.canAs(OntProperty.class)) {
|
||||||
com.hp.hpl.jena.ontology.OntProperty op = (com.hp.hpl.jena.ontology.OntProperty) res.as(OntProperty.class);
|
com.hp.hpl.jena.ontology.OntProperty op = res.as(OntProperty.class);
|
||||||
boolean isRoot = false;
|
boolean isRoot = false;
|
||||||
Iterator parentIt = op.listSuperProperties();
|
Iterator parentIt = op.listSuperProperties();
|
||||||
if (parentIt != null) {
|
if (parentIt != null) {
|
||||||
|
|
|
@ -99,7 +99,7 @@ public class ObjectPropertyStatementDaoJena extends JenaBaseDao implements Objec
|
||||||
ClosableIterator<Statement> propIt = ind.listProperties();
|
ClosableIterator<Statement> propIt = ind.listProperties();
|
||||||
try {
|
try {
|
||||||
while (propIt.hasNext()) {
|
while (propIt.hasNext()) {
|
||||||
Statement st = (Statement) propIt.next();
|
Statement st = propIt.next();
|
||||||
|
|
||||||
if (st.getObject().isResource() && !(NONUSER_NAMESPACES.contains(st.getPredicate().getNameSpace()))) {
|
if (st.getObject().isResource() && !(NONUSER_NAMESPACES.contains(st.getPredicate().getNameSpace()))) {
|
||||||
try {
|
try {
|
||||||
|
@ -173,7 +173,7 @@ public class ObjectPropertyStatementDaoJena extends JenaBaseDao implements Objec
|
||||||
try {
|
try {
|
||||||
int count = 0;
|
int count = 0;
|
||||||
while ( (opsIt.hasNext()) && ((endIndex<0) || (count<endIndex)) ) {
|
while ( (opsIt.hasNext()) && ((endIndex<0) || (count<endIndex)) ) {
|
||||||
Statement stmt = (Statement) opsIt.next();
|
Statement stmt = opsIt.next();
|
||||||
if (stmt.getObject().isResource()) {
|
if (stmt.getObject().isResource()) {
|
||||||
++count;
|
++count;
|
||||||
if (startIndex<0 || startIndex<=count) {
|
if (startIndex<0 || startIndex<=count) {
|
||||||
|
|
|
@ -102,7 +102,7 @@ public class ObjectPropertyStatementDaoSDB extends
|
||||||
ClosableIterator<Statement> propIt = ind.listProperties();
|
ClosableIterator<Statement> propIt = ind.listProperties();
|
||||||
try {
|
try {
|
||||||
while (propIt.hasNext()) {
|
while (propIt.hasNext()) {
|
||||||
Statement st = (Statement) propIt.next();
|
Statement st = propIt.next();
|
||||||
if (st.getObject().isResource() && !(NONUSER_NAMESPACES.contains(st.getPredicate().getNameSpace()))) {
|
if (st.getObject().isResource() && !(NONUSER_NAMESPACES.contains(st.getPredicate().getNameSpace()))) {
|
||||||
try {
|
try {
|
||||||
ObjectPropertyStatement objPropertyStmt = new ObjectPropertyStatementImpl();
|
ObjectPropertyStatement objPropertyStmt = new ObjectPropertyStatementImpl();
|
||||||
|
|
|
@ -2,10 +2,8 @@
|
||||||
|
|
||||||
package edu.cornell.mannlib.vitro.webapp.dao.jena;
|
package edu.cornell.mannlib.vitro.webapp.dao.jena;
|
||||||
|
|
||||||
import java.text.Collator;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.hp.hpl.jena.ontology.OntModel;
|
import com.hp.hpl.jena.ontology.OntModel;
|
||||||
|
@ -16,7 +14,6 @@ import com.hp.hpl.jena.util.iterator.ClosableIterator;
|
||||||
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.Ontology;
|
import edu.cornell.mannlib.vitro.webapp.beans.Ontology;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.OntologyDao;
|
import edu.cornell.mannlib.vitro.webapp.dao.OntologyDao;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
|
||||||
|
|
||||||
public class OntologyDaoJena extends JenaBaseDao implements OntologyDao {
|
public class OntologyDaoJena extends JenaBaseDao implements OntologyDao {
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@ import java.util.HashMap;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
|
@ -34,7 +34,6 @@ import com.hp.hpl.jena.rdf.model.Statement;
|
||||||
import com.hp.hpl.jena.rdf.model.StmtIterator;
|
import com.hp.hpl.jena.rdf.model.StmtIterator;
|
||||||
import com.hp.hpl.jena.shared.Lock;
|
import com.hp.hpl.jena.shared.Lock;
|
||||||
import com.hp.hpl.jena.sparql.resultset.ResultSetMem;
|
import com.hp.hpl.jena.sparql.resultset.ResultSetMem;
|
||||||
import com.hp.hpl.jena.util.iterator.ClosableIterator;
|
|
||||||
import com.hp.hpl.jena.vocabulary.OWL;
|
import com.hp.hpl.jena.vocabulary.OWL;
|
||||||
import com.hp.hpl.jena.vocabulary.RDFS;
|
import com.hp.hpl.jena.vocabulary.RDFS;
|
||||||
|
|
||||||
|
@ -151,7 +150,7 @@ public class PropertyDaoJena extends JenaBaseDao implements PropertyDao {
|
||||||
List<String> directSubproperties = getSubPropertyURIs(propertyURI);
|
List<String> directSubproperties = getSubPropertyURIs(propertyURI);
|
||||||
Iterator<String> it=directSubproperties.iterator();
|
Iterator<String> it=directSubproperties.iterator();
|
||||||
while(it.hasNext()){
|
while(it.hasNext()){
|
||||||
String uri = (String)it.next();
|
String uri = it.next();
|
||||||
if (!subtree.contains(uri)) {
|
if (!subtree.contains(uri)) {
|
||||||
subtree.add(uri);
|
subtree.add(uri);
|
||||||
getAllSubPropertyURIs(uri,subtree);
|
getAllSubPropertyURIs(uri,subtree);
|
||||||
|
@ -192,7 +191,7 @@ public class PropertyDaoJena extends JenaBaseDao implements PropertyDao {
|
||||||
List<String> directSuperproperties = getSuperPropertyURIs(propertyURI,true);
|
List<String> directSuperproperties = getSuperPropertyURIs(propertyURI,true);
|
||||||
Iterator<String> it=directSuperproperties.iterator();
|
Iterator<String> it=directSuperproperties.iterator();
|
||||||
while(it.hasNext()){
|
while(it.hasNext()){
|
||||||
String uri = (String)it.next();
|
String uri = it.next();
|
||||||
if (!subtree.contains(uri)) {
|
if (!subtree.contains(uri)) {
|
||||||
subtree.add(uri);
|
subtree.add(uri);
|
||||||
getAllSuperPropertyURIs(uri,subtree);
|
getAllSuperPropertyURIs(uri,subtree);
|
||||||
|
@ -342,13 +341,13 @@ public class PropertyDaoJena extends JenaBaseDao implements PropertyDao {
|
||||||
|
|
||||||
if (targetProp != null) {
|
if (targetProp != null) {
|
||||||
|
|
||||||
StmtIterator stmtIter = ontModel.listStatements((Resource) null, OWL.onProperty, (RDFNode) targetProp);
|
StmtIterator stmtIter = ontModel.listStatements((Resource) null, OWL.onProperty, targetProp);
|
||||||
|
|
||||||
while (stmtIter.hasNext()) {
|
while (stmtIter.hasNext()) {
|
||||||
Statement statement = stmtIter.next();
|
Statement statement = stmtIter.next();
|
||||||
|
|
||||||
if ( statement.getSubject().canAs(OntClass.class) ) {
|
if ( statement.getSubject().canAs(OntClass.class) ) {
|
||||||
classURISet.addAll(getRelatedClasses((OntClass) statement.getSubject().as(OntClass.class)));
|
classURISet.addAll(getRelatedClasses(statement.getSubject().as(OntClass.class)));
|
||||||
} else {
|
} else {
|
||||||
log.warn("getClassesWithRestrictionOnProperty: Unexpected use of onProperty: it is not applied to a class");
|
log.warn("getClassesWithRestrictionOnProperty: Unexpected use of onProperty: it is not applied to a class");
|
||||||
}
|
}
|
||||||
|
@ -661,7 +660,7 @@ public class PropertyDaoJena extends JenaBaseDao implements PropertyDao {
|
||||||
// TODO: check if restriction is something like
|
// TODO: check if restriction is something like
|
||||||
// maxCardinality 0 or allValuesFrom owl:Nothing,
|
// maxCardinality 0 or allValuesFrom owl:Nothing,
|
||||||
// in which case the property is NOT applicable!
|
// in which case the property is NOT applicable!
|
||||||
Restriction rest = (Restriction) relatedClass.as(Restriction.class);
|
Restriction rest = relatedClass.as(Restriction.class);
|
||||||
OntProperty onProperty = rest.getOnProperty();
|
OntProperty onProperty = rest.getOnProperty();
|
||||||
if (onProperty != null) {
|
if (onProperty != null) {
|
||||||
Resource[] ranges = new Resource[2];
|
Resource[] ranges = new Resource[2];
|
||||||
|
@ -726,7 +725,7 @@ public class PropertyDaoJena extends JenaBaseDao implements PropertyDao {
|
||||||
rangeClassURI = PSEUDO_BNODE_NS + rangeRes.getId()
|
rangeClassURI = PSEUDO_BNODE_NS + rangeRes.getId()
|
||||||
.toString();
|
.toString();
|
||||||
} else {
|
} else {
|
||||||
rangeClassURI = (String) rangeRes.getURI();
|
rangeClassURI = rangeRes.getURI();
|
||||||
}
|
}
|
||||||
pi.setRangeClassURI(rangeClassURI);
|
pi.setRangeClassURI(rangeClassURI);
|
||||||
VClass range = getWebappDaoFactory().getVClassDao()
|
VClass range = getWebappDaoFactory().getVClassDao()
|
||||||
|
|
|
@ -4,7 +4,6 @@ package edu.cornell.mannlib.vitro.webapp.dao.jena;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.ListIterator;
|
import java.util.ListIterator;
|
||||||
|
@ -16,7 +15,6 @@ import com.hp.hpl.jena.datatypes.xsd.XSDDatatype;
|
||||||
import com.hp.hpl.jena.ontology.Individual;
|
import com.hp.hpl.jena.ontology.Individual;
|
||||||
import com.hp.hpl.jena.ontology.OntModel;
|
import com.hp.hpl.jena.ontology.OntModel;
|
||||||
import com.hp.hpl.jena.ontology.OntModelSpec;
|
import com.hp.hpl.jena.ontology.OntModelSpec;
|
||||||
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;
|
||||||
import com.hp.hpl.jena.rdf.model.Resource;
|
import com.hp.hpl.jena.rdf.model.Resource;
|
||||||
|
@ -26,7 +24,6 @@ import com.hp.hpl.jena.shared.Lock;
|
||||||
import com.hp.hpl.jena.util.iterator.ClosableIterator;
|
import com.hp.hpl.jena.util.iterator.ClosableIterator;
|
||||||
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.IndividualImpl;
|
import edu.cornell.mannlib.vitro.webapp.beans.IndividualImpl;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.Property;
|
import edu.cornell.mannlib.vitro.webapp.beans.Property;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.PropertyGroup;
|
import edu.cornell.mannlib.vitro.webapp.beans.PropertyGroup;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyDao;
|
import edu.cornell.mannlib.vitro.webapp.dao.DataPropertyDao;
|
||||||
|
@ -228,7 +225,7 @@ public class PropertyGroupDaoJena extends JenaBaseDao implements PropertyGroupDa
|
||||||
try {
|
try {
|
||||||
Individual groupInd = ontModel.getIndividual(group.getURI());
|
Individual groupInd = ontModel.getIndividual(group.getURI());
|
||||||
try {
|
try {
|
||||||
groupInd.setLabel(group.getName(), (String) getDefaultLanguage());
|
groupInd.setLabel(group.getName(), getDefaultLanguage());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("error updating name for "+groupInd.getURI());
|
log.error("error updating name for "+groupInd.getURI());
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,27 +7,18 @@ import java.util.Calendar;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import com.hp.hpl.jena.ontology.ObjectProperty;
|
|
||||||
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.ontology.Restriction;
|
|
||||||
import com.hp.hpl.jena.rdf.model.Property;
|
import com.hp.hpl.jena.rdf.model.Property;
|
||||||
import com.hp.hpl.jena.rdf.model.Resource;
|
import com.hp.hpl.jena.rdf.model.Resource;
|
||||||
import com.hp.hpl.jena.rdf.model.ResourceFactory;
|
import com.hp.hpl.jena.rdf.model.ResourceFactory;
|
||||||
import com.hp.hpl.jena.rdf.model.Statement;
|
import com.hp.hpl.jena.rdf.model.Statement;
|
||||||
import com.hp.hpl.jena.rdf.model.StmtIterator;
|
|
||||||
import com.hp.hpl.jena.shared.Lock;
|
import com.hp.hpl.jena.shared.Lock;
|
||||||
import com.hp.hpl.jena.vocabulary.OWL;
|
import com.hp.hpl.jena.vocabulary.OWL;
|
||||||
import com.hp.hpl.jena.vocabulary.RDF;
|
import com.hp.hpl.jena.vocabulary.RDF;
|
||||||
import com.hp.hpl.jena.vocabulary.RDFS;
|
|
||||||
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatement;
|
import edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatement;
|
||||||
|
@ -35,7 +26,6 @@ import edu.cornell.mannlib.vitro.webapp.beans.PropertyInstance;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.PropertyInstanceIface;
|
import edu.cornell.mannlib.vitro.webapp.beans.PropertyInstanceIface;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.PropertyInstanceDao;
|
import edu.cornell.mannlib.vitro.webapp.dao.PropertyInstanceDao;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.VClassDao;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.event.IndividualDeletionEvent;
|
import edu.cornell.mannlib.vitro.webapp.dao.jena.event.IndividualDeletionEvent;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.event.IndividualUpdateEvent;
|
import edu.cornell.mannlib.vitro.webapp.dao.jena.event.IndividualUpdateEvent;
|
||||||
public class PropertyInstanceDaoJena extends PropertyDaoJena implements
|
public class PropertyInstanceDaoJena extends PropertyDaoJena implements
|
||||||
|
@ -58,7 +48,7 @@ public class PropertyInstanceDaoJena extends PropertyDaoJena implements
|
||||||
Property pred = tboxModel.getProperty(propertyURI);
|
Property pred = tboxModel.getProperty(propertyURI);
|
||||||
OntProperty invPred = null;
|
OntProperty invPred = null;
|
||||||
if (pred.canAs(OntProperty.class)) {
|
if (pred.canAs(OntProperty.class)) {
|
||||||
invPred = ((OntProperty)pred.as(OntProperty.class)).getInverse();
|
invPred = pred.as(OntProperty.class).getInverse();
|
||||||
}
|
}
|
||||||
Resource objRes = ontModel.getResource(objectURI);
|
Resource objRes = ontModel.getResource(objectURI);
|
||||||
if ( (subjRes != null) && (pred != null) && (objRes != null) ) {
|
if ( (subjRes != null) && (pred != null) && (objRes != null) ) {
|
||||||
|
|
|
@ -8,7 +8,6 @@ import java.util.Iterator;
|
||||||
import com.hp.hpl.jena.graph.Node;
|
import com.hp.hpl.jena.graph.Node;
|
||||||
import com.hp.hpl.jena.query.Dataset;
|
import com.hp.hpl.jena.query.Dataset;
|
||||||
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.shared.Lock;
|
import com.hp.hpl.jena.shared.Lock;
|
||||||
import com.hp.hpl.jena.sparql.core.DatasetGraph;
|
import com.hp.hpl.jena.sparql.core.DatasetGraph;
|
||||||
|
|
||||||
|
|
|
@ -10,10 +10,6 @@ import java.util.List;
|
||||||
import com.hp.hpl.jena.graph.Graph;
|
import com.hp.hpl.jena.graph.Graph;
|
||||||
import com.hp.hpl.jena.graph.Node;
|
import com.hp.hpl.jena.graph.Node;
|
||||||
import com.hp.hpl.jena.graph.Triple;
|
import com.hp.hpl.jena.graph.Triple;
|
||||||
import com.hp.hpl.jena.query.Query;
|
|
||||||
import com.hp.hpl.jena.query.QueryExecution;
|
|
||||||
import com.hp.hpl.jena.query.QueryExecutionFactory;
|
|
||||||
import com.hp.hpl.jena.query.QueryFactory;
|
|
||||||
import com.hp.hpl.jena.query.QuerySolution;
|
import com.hp.hpl.jena.query.QuerySolution;
|
||||||
import com.hp.hpl.jena.query.ResultSet;
|
import com.hp.hpl.jena.query.ResultSet;
|
||||||
import com.hp.hpl.jena.shared.Lock;
|
import com.hp.hpl.jena.shared.Lock;
|
||||||
|
@ -21,7 +17,6 @@ import com.hp.hpl.jena.shared.LockMRSW;
|
||||||
import com.hp.hpl.jena.sparql.core.DatasetGraph;
|
import com.hp.hpl.jena.sparql.core.DatasetGraph;
|
||||||
import com.hp.hpl.jena.sparql.core.Quad;
|
import com.hp.hpl.jena.sparql.core.Quad;
|
||||||
import com.hp.hpl.jena.sparql.resultset.JSONInput;
|
import com.hp.hpl.jena.sparql.resultset.JSONInput;
|
||||||
import com.hp.hpl.jena.sparql.resultset.ResultSetMem;
|
|
||||||
import com.hp.hpl.jena.sparql.util.Context;
|
import com.hp.hpl.jena.sparql.util.Context;
|
||||||
import com.hp.hpl.jena.util.iterator.SingletonIterator;
|
import com.hp.hpl.jena.util.iterator.SingletonIterator;
|
||||||
import com.hp.hpl.jena.util.iterator.WrappedIterator;
|
import com.hp.hpl.jena.util.iterator.WrappedIterator;
|
||||||
|
|
|
@ -4,7 +4,6 @@ package edu.cornell.mannlib.vitro.webapp.dao.jena;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.InputStream;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
|
@ -305,7 +305,7 @@ public class RDFServiceModelMaker implements ModelMaker {
|
||||||
List<String> graphNames = rdfService.getGraphURIs();
|
List<String> graphNames = rdfService.getGraphURIs();
|
||||||
Iterator<String> nameIt = graphNames.iterator();
|
Iterator<String> nameIt = graphNames.iterator();
|
||||||
while (nameIt.hasNext()) {
|
while (nameIt.hasNext()) {
|
||||||
String name = (String) nameIt.next();
|
String name = nameIt.next();
|
||||||
metadataModel.add(dbResource,metadataModel.getProperty(
|
metadataModel.add(dbResource,metadataModel.getProperty(
|
||||||
HAS_NAMED_MODEL_URI),name);
|
HAS_NAMED_MODEL_URI),name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,11 +98,11 @@ public class VClassDaoJena extends JenaBaseDao implements VClassDao {
|
||||||
labelStr += "some values from ";
|
labelStr += "some values from ";
|
||||||
}
|
}
|
||||||
if (fillerRes.canAs(OntClass.class)) {
|
if (fillerRes.canAs(OntClass.class)) {
|
||||||
OntClass avf = (OntClass) fillerRes.as(OntClass.class);
|
OntClass avf = fillerRes.as(OntClass.class);
|
||||||
labelStr += getLabelForClass(avf,withPrefix,forPickList);
|
labelStr += getLabelForClass(avf,withPrefix,forPickList);
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
labelStr += getLabelOrId( (OntResource) fillerRes.as(OntResource.class));
|
labelStr += getLabelOrId(fillerRes.as(OntResource.class));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
labelStr += "???";
|
labelStr += "???";
|
||||||
}
|
}
|
||||||
|
@ -113,9 +113,9 @@ public class VClassDaoJena extends JenaBaseDao implements VClassDao {
|
||||||
RDFNode fillerNode = hvRest.getHasValue();
|
RDFNode fillerNode = hvRest.getHasValue();
|
||||||
try {
|
try {
|
||||||
if (fillerNode.isResource()) {
|
if (fillerNode.isResource()) {
|
||||||
labelStr += getLabelOrId((OntResource)fillerNode.as(OntResource.class));
|
labelStr += getLabelOrId(fillerNode.as(OntResource.class));
|
||||||
} else {
|
} else {
|
||||||
labelStr += ((Literal) fillerNode.as(Literal.class)).getLexicalForm();
|
labelStr += fillerNode.as(Literal.class).getLexicalForm();
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
labelStr += "???";
|
labelStr += "???";
|
||||||
|
@ -138,10 +138,10 @@ public class VClassDaoJena extends JenaBaseDao implements VClassDao {
|
||||||
String labelStr = "(";
|
String labelStr = "(";
|
||||||
if (cls.isComplementClass()) {
|
if (cls.isComplementClass()) {
|
||||||
labelStr += "not ";
|
labelStr += "not ";
|
||||||
ComplementClass ccls = (ComplementClass) cls.as(ComplementClass.class);
|
ComplementClass ccls = cls.as(ComplementClass.class);
|
||||||
labelStr += getLabelForClass(ccls.getOperand(),withPrefix,forPickList);
|
labelStr += getLabelForClass(ccls.getOperand(),withPrefix,forPickList);
|
||||||
} else if (cls.isIntersectionClass()) {
|
} else if (cls.isIntersectionClass()) {
|
||||||
IntersectionClass icls = (IntersectionClass) cls.as(IntersectionClass.class);
|
IntersectionClass icls = cls.as(IntersectionClass.class);
|
||||||
for (Iterator operandIt = icls.listOperands(); operandIt.hasNext();) {
|
for (Iterator operandIt = icls.listOperands(); operandIt.hasNext();) {
|
||||||
OntClass operand = (OntClass) operandIt.next();
|
OntClass operand = (OntClass) operandIt.next();
|
||||||
labelStr += getLabelForClass(operand,withPrefix,forPickList);
|
labelStr += getLabelForClass(operand,withPrefix,forPickList);
|
||||||
|
@ -150,7 +150,7 @@ public class VClassDaoJena extends JenaBaseDao implements VClassDao {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (cls.isUnionClass()) {
|
} else if (cls.isUnionClass()) {
|
||||||
UnionClass icls = (UnionClass) cls.as(UnionClass.class);
|
UnionClass icls = cls.as(UnionClass.class);
|
||||||
for (Iterator operandIt = icls.listOperands(); operandIt.hasNext();) {
|
for (Iterator operandIt = icls.listOperands(); operandIt.hasNext();) {
|
||||||
OntClass operand = (OntClass) operandIt.next();
|
OntClass operand = (OntClass) operandIt.next();
|
||||||
labelStr += getLabelForClass(operand,withPrefix,forPickList);
|
labelStr += getLabelForClass(operand,withPrefix,forPickList);
|
||||||
|
@ -169,7 +169,7 @@ public class VClassDaoJena extends JenaBaseDao implements VClassDao {
|
||||||
} else {
|
} else {
|
||||||
if (withPrefix || forPickList) {
|
if (withPrefix || forPickList) {
|
||||||
OntologyDao oDao=getWebappDaoFactory().getOntologyDao();
|
OntologyDao oDao=getWebappDaoFactory().getOntologyDao();
|
||||||
Ontology o = (Ontology)oDao.getOntologyByURI(cls.getNameSpace());
|
Ontology o = oDao.getOntologyByURI(cls.getNameSpace());
|
||||||
if (o!=null) {
|
if (o!=null) {
|
||||||
if (withPrefix) {
|
if (withPrefix) {
|
||||||
return(o.getPrefix()==null?(o.getName()==null?"unspec:"+getLabelOrId(cls):o.getName()+":"+getLabelOrId(cls)):o.getPrefix()+":"+getLabelOrId(cls));
|
return(o.getPrefix()==null?(o.getName()==null?"unspec:"+getLabelOrId(cls):o.getName()+":"+getLabelOrId(cls)):o.getPrefix()+":"+getLabelOrId(cls));
|
||||||
|
@ -208,7 +208,7 @@ public class VClassDaoJena extends JenaBaseDao implements VClassDao {
|
||||||
while(restIt.hasNext()) {
|
while(restIt.hasNext()) {
|
||||||
Resource restRes = restIt.next();
|
Resource restRes = restIt.next();
|
||||||
if (restRes.canAs(OntResource.class)) {
|
if (restRes.canAs(OntResource.class)) {
|
||||||
OntResource restOntRes = (OntResource) restRes.as(OntResource.class);
|
OntResource restOntRes = restRes.as(OntResource.class);
|
||||||
smartRemove(restOntRes, ontModel);
|
smartRemove(restOntRes, ontModel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -216,7 +216,7 @@ public class VClassDaoJena extends JenaBaseDao implements VClassDao {
|
||||||
while(restIt.hasNext()) {
|
while(restIt.hasNext()) {
|
||||||
Resource restRes = restIt.next();
|
Resource restRes = restIt.next();
|
||||||
if (restRes.canAs(OntResource.class)) {
|
if (restRes.canAs(OntResource.class)) {
|
||||||
OntResource restOntRes = (OntResource) restRes.as(OntResource.class);
|
OntResource restOntRes = restRes.as(OntResource.class);
|
||||||
smartRemove(restOntRes, ontModel);
|
smartRemove(restOntRes, ontModel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -400,7 +400,7 @@ public class VClassDaoJena extends JenaBaseDao implements VClassDao {
|
||||||
List<String> directSubclasses = getSubClassURIs(classURI);
|
List<String> directSubclasses = getSubClassURIs(classURI);
|
||||||
Iterator<String> it=directSubclasses.iterator();
|
Iterator<String> it=directSubclasses.iterator();
|
||||||
while(it.hasNext()){
|
while(it.hasNext()){
|
||||||
String uri = (String)it.next();
|
String uri = it.next();
|
||||||
if (!subtree.contains(uri)) {
|
if (!subtree.contains(uri)) {
|
||||||
subtree.add(uri);
|
subtree.add(uri);
|
||||||
getAllSubClassURIs(uri,subtree);
|
getAllSubClassURIs(uri,subtree);
|
||||||
|
@ -423,7 +423,7 @@ public class VClassDaoJena extends JenaBaseDao implements VClassDao {
|
||||||
while (superClassIt.hasNext()) {
|
while (superClassIt.hasNext()) {
|
||||||
Statement stmt = superClassIt.nextStatement();
|
Statement stmt = superClassIt.nextStatement();
|
||||||
if (stmt.getObject().canAs(OntResource.class)) {
|
if (stmt.getObject().canAs(OntResource.class)) {
|
||||||
OntResource superRes = (OntResource) stmt.getObject().as(OntResource.class);
|
OntResource superRes = stmt.getObject().as(OntResource.class);
|
||||||
String test = getClassURIStr(superRes);
|
String test = getClassURIStr(superRes);
|
||||||
superclassURIs.add(test);
|
superclassURIs.add(test);
|
||||||
}
|
}
|
||||||
|
@ -442,7 +442,7 @@ public class VClassDaoJena extends JenaBaseDao implements VClassDao {
|
||||||
List<String> directSuperclasses = getSuperClassURIs(classURI, true);
|
List<String> directSuperclasses = getSuperClassURIs(classURI, true);
|
||||||
Iterator<String> it=directSuperclasses.iterator();
|
Iterator<String> it=directSuperclasses.iterator();
|
||||||
while(it.hasNext()){
|
while(it.hasNext()){
|
||||||
String uri = (String)it.next();
|
String uri = it.next();
|
||||||
if (!subtree.contains(uri)) {
|
if (!subtree.contains(uri)) {
|
||||||
subtree.add(uri);
|
subtree.add(uri);
|
||||||
getAllSuperClassURIs(uri,subtree);
|
getAllSuperClassURIs(uri,subtree);
|
||||||
|
@ -459,7 +459,7 @@ public class VClassDaoJena extends JenaBaseDao implements VClassDao {
|
||||||
while (classIt.hasNext()) {
|
while (classIt.hasNext()) {
|
||||||
try {
|
try {
|
||||||
Individual classInd = classIt.next();
|
Individual classInd = classIt.next();
|
||||||
OntClass cls = (OntClass) classInd.as(OntClass.class);
|
OntClass cls = classInd.as(OntClass.class);
|
||||||
if (!cls.isAnon() && !(NONUSER_NAMESPACES.contains(cls.getNameSpace()))) {
|
if (!cls.isAnon() && !(NONUSER_NAMESPACES.contains(cls.getNameSpace()))) {
|
||||||
classes.add(new VClassJena(cls,getWebappDaoFactory()));
|
classes.add(new VClassJena(cls,getWebappDaoFactory()));
|
||||||
}
|
}
|
||||||
|
@ -724,17 +724,17 @@ public class VClassDaoJena extends JenaBaseDao implements VClassDao {
|
||||||
Statement axStmt = (Statement) axStmtIt.next();
|
Statement axStmt = (Statement) axStmtIt.next();
|
||||||
OntResource subjOntRes = null;
|
OntResource subjOntRes = null;
|
||||||
if (axStmt.getSubject().canAs(OntResource.class)) {
|
if (axStmt.getSubject().canAs(OntResource.class)) {
|
||||||
subjOntRes = (OntResource) axStmt.getSubject().as(OntResource.class);
|
subjOntRes = axStmt.getSubject().as(OntResource.class);
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
(subjOntRes != null) && (subjSuperclasses.contains(getClassURIStr(subjOntRes))) &&
|
(subjOntRes != null) && (subjSuperclasses.contains(getClassURIStr(subjOntRes))) &&
|
||||||
(axStmt.getPredicate().equals(RDFS.subClassOf) || (axStmt.getPredicate().equals(OWL.equivalentClass)))
|
(axStmt.getPredicate().equals(RDFS.subClassOf) || (axStmt.getPredicate().equals(OWL.equivalentClass)))
|
||||||
) {
|
) {
|
||||||
if (restRes.canAs(AllValuesFromRestriction.class)) {
|
if (restRes.canAs(AllValuesFromRestriction.class)) {
|
||||||
AllValuesFromRestriction avfRest = (AllValuesFromRestriction) restRes.as(AllValuesFromRestriction.class);
|
AllValuesFromRestriction avfRest = restRes.as(AllValuesFromRestriction.class);
|
||||||
Resource avf = avfRest.getAllValuesFrom();
|
Resource avf = avfRest.getAllValuesFrom();
|
||||||
if (avf.canAs(OntClass.class)) {
|
if (avf.canAs(OntClass.class)) {
|
||||||
superclass = (OntClass) avfRest.getAllValuesFrom().as(OntClass.class);
|
superclass = avfRest.getAllValuesFrom().as(OntClass.class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -818,8 +818,8 @@ public class VClassDaoJena extends JenaBaseDao implements VClassDao {
|
||||||
while (annotIt.hasNext()) {
|
while (annotIt.hasNext()) {
|
||||||
try {
|
try {
|
||||||
Statement annot = (Statement) annotIt.next();
|
Statement annot = (Statement) annotIt.next();
|
||||||
Resource cls = (Resource) annot.getSubject();
|
Resource cls = annot.getSubject();
|
||||||
VClass vcw = (VClass) getVClassByURI(cls.getURI());
|
VClass vcw = getVClassByURI(cls.getURI());
|
||||||
if (vcw != null) {
|
if (vcw != null) {
|
||||||
boolean classIsInstantiated = false;
|
boolean classIsInstantiated = false;
|
||||||
if (getIndividualCount) {
|
if (getIndividualCount) {
|
||||||
|
@ -926,7 +926,7 @@ public class VClassDaoJena extends JenaBaseDao implements VClassDao {
|
||||||
OntClass ontCls = ontModel.createClass(cls.getURI());
|
OntClass ontCls = ontModel.createClass(cls.getURI());
|
||||||
try {
|
try {
|
||||||
if (cls.getName() != null && cls.getName().length() > 0) {
|
if (cls.getName() != null && cls.getName().length() > 0) {
|
||||||
ontCls.setLabel(cls.getName(), (String) getDefaultLanguage());
|
ontCls.setLabel(cls.getName(), getDefaultLanguage());
|
||||||
} else {
|
} else {
|
||||||
ontCls.removeAll(RDFS.label);
|
ontCls.removeAll(RDFS.label);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
package edu.cornell.mannlib.vitro.webapp.dao.jena;
|
package edu.cornell.mannlib.vitro.webapp.dao.jena;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import com.hp.hpl.jena.ontology.AnnotationProperty;
|
import com.hp.hpl.jena.ontology.AnnotationProperty;
|
||||||
import com.hp.hpl.jena.ontology.OntClass;
|
import com.hp.hpl.jena.ontology.OntClass;
|
||||||
import com.hp.hpl.jena.query.Dataset;
|
import com.hp.hpl.jena.query.Dataset;
|
||||||
|
@ -11,8 +9,6 @@ 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;
|
||||||
import com.hp.hpl.jena.query.QueryFactory;
|
import com.hp.hpl.jena.query.QueryFactory;
|
||||||
import com.hp.hpl.jena.query.QuerySolution;
|
|
||||||
import com.hp.hpl.jena.query.QuerySolutionMap;
|
|
||||||
import com.hp.hpl.jena.query.ResultSet;
|
import com.hp.hpl.jena.query.ResultSet;
|
||||||
import com.hp.hpl.jena.query.Syntax;
|
import com.hp.hpl.jena.query.Syntax;
|
||||||
import com.hp.hpl.jena.rdf.model.Literal;
|
import com.hp.hpl.jena.rdf.model.Literal;
|
||||||
|
@ -64,8 +60,8 @@ public class VClassDaoSDB extends VClassDaoJena {
|
||||||
while (annotIt.hasNext()) {
|
while (annotIt.hasNext()) {
|
||||||
try {
|
try {
|
||||||
Statement annot = (Statement) annotIt.next();
|
Statement annot = (Statement) annotIt.next();
|
||||||
Resource cls = (Resource) annot.getSubject();
|
Resource cls = annot.getSubject();
|
||||||
VClass vcw = (VClass) getVClassByURI(cls.getURI());
|
VClass vcw = getVClassByURI(cls.getURI());
|
||||||
if (vcw != null) {
|
if (vcw != null) {
|
||||||
boolean classIsInstantiated = false;
|
boolean classIsInstantiated = false;
|
||||||
if (getIndividualCount) {
|
if (getIndividualCount) {
|
||||||
|
|
|
@ -4,10 +4,8 @@ package edu.cornell.mannlib.vitro.webapp.dao.jena;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import javax.servlet.ServletContext;
|
import javax.servlet.ServletContext;
|
||||||
import javax.servlet.ServletContextEvent;
|
import javax.servlet.ServletContextEvent;
|
||||||
|
@ -33,7 +31,6 @@ import com.hp.hpl.jena.vocabulary.RDFS;
|
||||||
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.VClassGroup;
|
import edu.cornell.mannlib.vitro.webapp.beans.VClassGroup;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.VClassDao;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.VClassGroupDao;
|
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;
|
||||||
|
|
|
@ -14,11 +14,9 @@ import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
import com.hp.hpl.jena.datatypes.xsd.XSDDatatype;
|
import com.hp.hpl.jena.datatypes.xsd.XSDDatatype;
|
||||||
import com.hp.hpl.jena.ontology.DatatypeProperty;
|
|
||||||
import com.hp.hpl.jena.ontology.Individual;
|
import com.hp.hpl.jena.ontology.Individual;
|
||||||
import com.hp.hpl.jena.ontology.OntModel;
|
import com.hp.hpl.jena.ontology.OntModel;
|
||||||
import com.hp.hpl.jena.ontology.OntModelSpec;
|
import com.hp.hpl.jena.ontology.OntModelSpec;
|
||||||
import com.hp.hpl.jena.rdf.model.Literal;
|
|
||||||
import com.hp.hpl.jena.rdf.model.ModelFactory;
|
import com.hp.hpl.jena.rdf.model.ModelFactory;
|
||||||
import com.hp.hpl.jena.rdf.model.Resource;
|
import com.hp.hpl.jena.rdf.model.Resource;
|
||||||
import com.hp.hpl.jena.rdf.model.ResourceFactory;
|
import com.hp.hpl.jena.rdf.model.ResourceFactory;
|
||||||
|
@ -32,7 +30,6 @@ import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.InsertException;
|
import edu.cornell.mannlib.vitro.webapp.dao.InsertException;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.VClassDao;
|
import edu.cornell.mannlib.vitro.webapp.dao.VClassDao;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.VClassGroupDao;
|
import edu.cornell.mannlib.vitro.webapp.dao.VClassGroupDao;
|
||||||
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.search.beans.ProhibitedFromSearch;
|
import edu.cornell.mannlib.vitro.webapp.search.beans.ProhibitedFromSearch;
|
||||||
|
|
||||||
|
@ -82,7 +79,7 @@ public class VClassGroupDaoJena extends JenaBaseDao implements VClassGroupDao {
|
||||||
ClosableIterator<Individual> groupIt = getOntModel().listIndividuals(CLASSGROUP);
|
ClosableIterator<Individual> groupIt = getOntModel().listIndividuals(CLASSGROUP);
|
||||||
try {
|
try {
|
||||||
while (groupIt.hasNext()) {
|
while (groupIt.hasNext()) {
|
||||||
Individual groupInd = (Individual) groupIt.next();
|
Individual groupInd = groupIt.next();
|
||||||
VClassGroup group = groupFromGroupIndividual(groupInd);
|
VClassGroup group = groupFromGroupIndividual(groupInd);
|
||||||
if (group!=null) {
|
if (group!=null) {
|
||||||
groups.add(group);
|
groups.add(group);
|
||||||
|
@ -94,7 +91,7 @@ public class VClassGroupDaoJena extends JenaBaseDao implements VClassGroupDao {
|
||||||
Collections.sort(groups);
|
Collections.sort(groups);
|
||||||
Iterator<VClassGroup> groupsIt = groups.iterator();
|
Iterator<VClassGroup> groupsIt = groups.iterator();
|
||||||
while (groupsIt.hasNext()) {
|
while (groupsIt.hasNext()) {
|
||||||
VClassGroup group = (VClassGroup) groupsIt.next();
|
VClassGroup group = groupsIt.next();
|
||||||
map.put(group.getPublicName(), group);
|
map.put(group.getPublicName(), group);
|
||||||
}
|
}
|
||||||
return map;
|
return map;
|
||||||
|
@ -140,7 +137,7 @@ public class VClassGroupDaoJena extends JenaBaseDao implements VClassGroupDao {
|
||||||
ClosableIterator<Individual> groupIt = getOntModel().listIndividuals(CLASSGROUP);
|
ClosableIterator<Individual> groupIt = getOntModel().listIndividuals(CLASSGROUP);
|
||||||
try {
|
try {
|
||||||
while (groupIt.hasNext()) {
|
while (groupIt.hasNext()) {
|
||||||
Individual grp = (Individual) groupIt.next();
|
Individual grp = groupIt.next();
|
||||||
VClassGroup vgrp = groupFromGroupIndividual(grp);
|
VClassGroup vgrp = groupFromGroupIndividual(grp);
|
||||||
if (vgrp != null) {
|
if (vgrp != null) {
|
||||||
groups.add(vgrp);
|
groups.add(vgrp);
|
||||||
|
@ -247,7 +244,7 @@ public class VClassGroupDaoJena extends JenaBaseDao implements VClassGroupDao {
|
||||||
int removedGroupsCount = 0;
|
int removedGroupsCount = 0;
|
||||||
ListIterator<VClassGroup> it = groups.listIterator();
|
ListIterator<VClassGroup> it = groups.listIterator();
|
||||||
while(it.hasNext()){
|
while(it.hasNext()){
|
||||||
VClassGroup group = (VClassGroup) it.next();
|
VClassGroup group = it.next();
|
||||||
List<VClass> classes = group.getVitroClassList();
|
List<VClass> classes = group.getVitroClassList();
|
||||||
if( classes == null || classes.size() < 1 ){
|
if( classes == null || classes.size() < 1 ){
|
||||||
removedGroupsCount++;
|
removedGroupsCount++;
|
||||||
|
@ -283,7 +280,7 @@ public class VClassGroupDaoJena extends JenaBaseDao implements VClassGroupDao {
|
||||||
try {
|
try {
|
||||||
Individual groupInd = ontModel.getIndividual(vcg.getURI());
|
Individual groupInd = ontModel.getIndividual(vcg.getURI());
|
||||||
try {
|
try {
|
||||||
groupInd.setLabel(vcg.getPublicName(), (String) getDefaultLanguage());
|
groupInd.setLabel(vcg.getPublicName(), getDefaultLanguage());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("error updating name for "+groupInd.getURI());
|
log.error("error updating name for "+groupInd.getURI());
|
||||||
}
|
}
|
||||||
|
|
|
@ -324,7 +324,7 @@ public class VClassJena extends VClass {
|
||||||
Statement stmt = it.nextStatement();
|
Statement stmt = it.nextStatement();
|
||||||
RDFNode obj;
|
RDFNode obj;
|
||||||
if( stmt != null && (obj = stmt.getObject()) != null && obj.isURIResource() ){
|
if( stmt != null && (obj = stmt.getObject()) != null && obj.isURIResource() ){
|
||||||
Resource res = (Resource)obj.as(Resource.class);
|
Resource res = obj.as(Resource.class);
|
||||||
if( res != null && res.getURI() != null ){
|
if( res != null && res.getURI() != null ){
|
||||||
BaseResourceBean.RoleLevel roleFromModel = BaseResourceBean.RoleLevel.getRoleByUri(res.getURI());
|
BaseResourceBean.RoleLevel roleFromModel = BaseResourceBean.RoleLevel.getRoleByUri(res.getURI());
|
||||||
if( roleFromModel != null &&
|
if( roleFromModel != null &&
|
||||||
|
@ -358,7 +358,7 @@ public class VClassJena extends VClass {
|
||||||
Statement stmt = it.nextStatement();
|
Statement stmt = it.nextStatement();
|
||||||
RDFNode obj;
|
RDFNode obj;
|
||||||
if( stmt != null && (obj = stmt.getObject()) != null && obj.isURIResource() ){
|
if( stmt != null && (obj = stmt.getObject()) != null && obj.isURIResource() ){
|
||||||
Resource res = (Resource)obj.as(Resource.class);
|
Resource res = obj.as(Resource.class);
|
||||||
if( res != null && res.getURI() != null ){
|
if( res != null && res.getURI() != null ){
|
||||||
BaseResourceBean.RoleLevel roleFromModel = BaseResourceBean.RoleLevel.getRoleByUri(res.getURI());
|
BaseResourceBean.RoleLevel roleFromModel = BaseResourceBean.RoleLevel.getRoleByUri(res.getURI());
|
||||||
if( roleFromModel != null &&
|
if( roleFromModel != null &&
|
||||||
|
|
|
@ -2,8 +2,6 @@
|
||||||
|
|
||||||
package edu.cornell.mannlib.vitro.webapp.dao.jena;
|
package edu.cornell.mannlib.vitro.webapp.dao.jena;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
@ -14,7 +12,6 @@ import com.hp.hpl.jena.ontology.OntModel;
|
||||||
import com.hp.hpl.jena.rdf.model.Model;
|
import com.hp.hpl.jena.rdf.model.Model;
|
||||||
import com.hp.hpl.jena.rdf.model.ModelMaker;
|
import com.hp.hpl.jena.rdf.model.ModelMaker;
|
||||||
import com.hp.hpl.jena.rdf.model.ModelReader;
|
import com.hp.hpl.jena.rdf.model.ModelReader;
|
||||||
import com.hp.hpl.jena.rdf.model.Resource;
|
|
||||||
import com.hp.hpl.jena.util.iterator.ExtendedIterator;
|
import com.hp.hpl.jena.util.iterator.ExtendedIterator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -11,7 +11,6 @@ import java.util.Set;
|
||||||
|
|
||||||
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.ontology.OntModel;
|
import com.hp.hpl.jena.ontology.OntModel;
|
||||||
import com.hp.hpl.jena.ontology.OntModelSpec;
|
import com.hp.hpl.jena.ontology.OntModelSpec;
|
||||||
import com.hp.hpl.jena.ontology.OntResource;
|
import com.hp.hpl.jena.ontology.OntResource;
|
||||||
|
@ -184,7 +183,7 @@ public class WebappDaoFactoryJena implements WebappDaoFactory {
|
||||||
IRI iri = factory.create( uriStr );
|
IRI iri = factory.create( uriStr );
|
||||||
if (iri.hasViolation(false) ) {
|
if (iri.hasViolation(false) ) {
|
||||||
validURI = false;
|
validURI = false;
|
||||||
errorMsg += ((Violation)iri.violations(false).next())
|
errorMsg += (iri.violations(false).next())
|
||||||
.getShortMessage() + " ";
|
.getShortMessage() + " ";
|
||||||
} else if (checkUniqueness) {
|
} else if (checkUniqueness) {
|
||||||
OntModel ontModel = ontModelSelector.getFullModel();
|
OntModel ontModel = ontModelSelector.getFullModel();
|
||||||
|
|
|
@ -2,15 +2,9 @@
|
||||||
|
|
||||||
package edu.cornell.mannlib.vitro.webapp.dao.jena.pellet;
|
package edu.cornell.mannlib.vitro.webapp.dao.jena.pellet;
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
import com.hp.hpl.jena.rdf.model.Property;
|
import com.hp.hpl.jena.rdf.model.Property;
|
||||||
import com.hp.hpl.jena.rdf.model.Resource;
|
import com.hp.hpl.jena.rdf.model.Resource;
|
||||||
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.pellet.ObjectPropertyStatementPattern;
|
|
||||||
|
|
||||||
public class ObjectPropertyStatementPatternFactory {
|
public class ObjectPropertyStatementPatternFactory {
|
||||||
|
|
||||||
//private static Set<ObjectPropertyStatementPattern> patternSet = new HashSet<ObjectPropertyStatementPattern>();
|
//private static Set<ObjectPropertyStatementPattern> patternSet = new HashSet<ObjectPropertyStatementPattern>();
|
||||||
|
|
|
@ -320,9 +320,9 @@ public class PelletListener implements ModelChangedListener {
|
||||||
try {
|
try {
|
||||||
if ( ( ((Resource)stmt.getObject()).equals(RDFS.Resource) ) ) {
|
if ( ( ((Resource)stmt.getObject()).equals(RDFS.Resource) ) ) {
|
||||||
reject = true;
|
reject = true;
|
||||||
} else if ( ( ((Resource)stmt.getSubject()).equals(OWL.Nothing) ) ) {
|
} else if ( ( stmt.getSubject().equals(OWL.Nothing) ) ) {
|
||||||
reject = true;
|
reject = true;
|
||||||
} else if ( ( ((Resource)stmt.getObject()).equals(OWL.Nothing) ) ) {
|
} else if ( ( stmt.getObject().equals(OWL.Nothing) ) ) {
|
||||||
reject = true;
|
reject = true;
|
||||||
}
|
}
|
||||||
} catch (Exception e) {}
|
} catch (Exception e) {}
|
||||||
|
|
|
@ -2,27 +2,11 @@
|
||||||
|
|
||||||
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors.utils;
|
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors.utils;
|
||||||
|
|
||||||
import java.lang.reflect.Constructor;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.servlet.ServletContext;
|
|
||||||
|
|
||||||
import net.sf.json.JSONObject;
|
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
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.rdf.model.RDFNode;
|
|
||||||
import com.hp.hpl.jena.rdf.model.ResourceFactory;
|
|
||||||
import com.hp.hpl.jena.rdf.model.StmtIterator;
|
|
||||||
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.ModelContext;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors.utils.ProcessDataGetterN3;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.utils.dataGetter.DataGetter;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This class determines what n3 should be returned for a particular data getter and can be overwritten or extended in VIVO.
|
* This class determines what n3 should be returned for a particular data getter and can be overwritten or extended in VIVO.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -4,25 +4,12 @@ package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocess
|
||||||
|
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import javax.servlet.ServletContext;
|
|
||||||
|
|
||||||
import net.sf.json.JSONObject;
|
import net.sf.json.JSONObject;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
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.rdf.model.RDFNode;
|
|
||||||
import com.hp.hpl.jena.rdf.model.ResourceFactory;
|
|
||||||
import com.hp.hpl.jena.rdf.model.StmtIterator;
|
|
||||||
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.ModelContext;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.preprocessors.utils.ProcessDataGetterN3;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.utils.dataGetter.DataGetter;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This class determines what n3 should be returned for a particular data getter and can be overwritten or extended in VIVO.
|
* This class determines what n3 should be returned for a particular data getter and can be overwritten or extended in VIVO.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -94,17 +94,10 @@ public class WebappDaoSetup extends JenaDataSourceSetupBase
|
||||||
setStartupDataset(dataset, ctx);
|
setStartupDataset(dataset, ctx);
|
||||||
|
|
||||||
// ABox assertions
|
// ABox assertions
|
||||||
Model aboxAssertions = dataset.getNamedModel(
|
baseOms.setABoxModel(ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM, dataset.getNamedModel(JenaDataSourceSetupBase.JENA_DB_MODEL)));
|
||||||
JenaDataSourceSetupBase.JENA_DB_MODEL);
|
|
||||||
baseOms.setABoxModel(
|
|
||||||
ModelFactory.createOntologyModel(
|
|
||||||
OntModelSpec.OWL_MEM, aboxAssertions));
|
|
||||||
|
|
||||||
// ABox inferences
|
// ABox inferences
|
||||||
Model aboxInferences = dataset.getNamedModel(
|
inferenceOms.setABoxModel(ModelFactory.createOntologyModel(OntModelSpec.OWL_MEM, dataset.getNamedModel(JenaDataSourceSetupBase.JENA_INF_MODEL)));
|
||||||
JenaDataSourceSetupBase.JENA_INF_MODEL);
|
|
||||||
inferenceOms.setABoxModel(ModelFactory.createOntologyModel(
|
|
||||||
OntModelSpec.OWL_MEM, aboxInferences));
|
|
||||||
|
|
||||||
// TBox assertions
|
// TBox assertions
|
||||||
try {
|
try {
|
||||||
|
@ -115,16 +108,12 @@ public class WebappDaoSetup extends JenaDataSourceSetupBase
|
||||||
|
|
||||||
if (tboxAssertionsDB != null) {
|
if (tboxAssertionsDB != null) {
|
||||||
long startTime = System.currentTimeMillis();
|
long startTime = System.currentTimeMillis();
|
||||||
System.out.println(
|
log.info("Copying cached tbox assertions into memory");
|
||||||
"Copying cached tbox assertions into memory");
|
|
||||||
tboxAssertions.add(tboxAssertionsDB);
|
tboxAssertions.add(tboxAssertionsDB);
|
||||||
System.out.println((System.currentTimeMillis() - startTime)
|
log.info((System.currentTimeMillis() - startTime)/ 1000 + " seconds to load tbox assertions");
|
||||||
/ 1000 + " seconds to load tbox assertions");
|
tboxAssertions.getBaseModel().register(new ModelSynchronizer(tboxAssertionsDB));
|
||||||
}
|
}
|
||||||
|
|
||||||
tboxAssertions.getBaseModel().register(new ModelSynchronizer(
|
|
||||||
tboxAssertionsDB));
|
|
||||||
|
|
||||||
baseOms.setTBoxModel(tboxAssertions);
|
baseOms.setTBoxModel(tboxAssertions);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
log.error("Unable to load tbox assertion cache from DB", e);
|
log.error("Unable to load tbox assertion cache from DB", e);
|
||||||
|
@ -139,15 +128,15 @@ public class WebappDaoSetup extends JenaDataSourceSetupBase
|
||||||
|
|
||||||
if (tboxInferencesDB != null) {
|
if (tboxInferencesDB != null) {
|
||||||
long startTime = System.currentTimeMillis();
|
long startTime = System.currentTimeMillis();
|
||||||
System.out.println(
|
log.info(
|
||||||
"Copying cached tbox inferences into memory");
|
"Copying cached tbox inferences into memory");
|
||||||
tboxInferences.add(tboxInferencesDB);
|
tboxInferences.add(tboxInferencesDB);
|
||||||
System.out.println((System.currentTimeMillis() - startTime)
|
System.out.println((System.currentTimeMillis() - startTime)
|
||||||
/ 1000 + " seconds to load tbox inferences");
|
/ 1000 + " seconds to load tbox inferences");
|
||||||
}
|
|
||||||
|
|
||||||
tboxInferences.getBaseModel().register(new ModelSynchronizer(
|
tboxInferences.getBaseModel().register(new ModelSynchronizer(
|
||||||
tboxInferencesDB));
|
tboxInferencesDB));
|
||||||
|
}
|
||||||
inferenceOms.setTBoxModel(tboxInferences);
|
inferenceOms.setTBoxModel(tboxInferences);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
log.error("Unable to load tbox inference cache from DB", e);
|
log.error("Unable to load tbox inference cache from DB", e);
|
||||||
|
@ -155,7 +144,6 @@ public class WebappDaoSetup extends JenaDataSourceSetupBase
|
||||||
}
|
}
|
||||||
|
|
||||||
// union ABox
|
// union ABox
|
||||||
|
|
||||||
Model m = ModelFactory.createUnion(
|
Model m = ModelFactory.createUnion(
|
||||||
baseOms.getABoxModel(), inferenceOms.getABoxModel());
|
baseOms.getABoxModel(), inferenceOms.getABoxModel());
|
||||||
m = ModelFactory.createModelForGraph(
|
m = ModelFactory.createModelForGraph(
|
||||||
|
@ -167,8 +155,7 @@ public class WebappDaoSetup extends JenaDataSourceSetupBase
|
||||||
unionOms.setABoxModel(unionABoxModel);
|
unionOms.setABoxModel(unionABoxModel);
|
||||||
|
|
||||||
// union TBox
|
// union TBox
|
||||||
m = ModelFactory.createUnion(
|
m = ModelFactory.createUnion(baseOms.getTBoxModel(), inferenceOms.getTBoxModel());
|
||||||
baseOms.getTBoxModel(), inferenceOms.getTBoxModel());
|
|
||||||
m = ModelFactory.createModelForGraph(
|
m = ModelFactory.createModelForGraph(
|
||||||
new SpecialBulkUpdateHandlerGraph(
|
new SpecialBulkUpdateHandlerGraph(
|
||||||
m.getGraph(),
|
m.getGraph(),
|
||||||
|
|
|
@ -5,7 +5,6 @@ package edu.cornell.mannlib.vitro.webapp.utils.pageDataGetter;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -17,22 +16,11 @@ import org.apache.commons.logging.Log;
|
||||||
import org.apache.commons.logging.LogFactory;
|
import org.apache.commons.logging.LogFactory;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import com.hp.hpl.jena.rdf.model.Model;
|
|
||||||
import com.hp.hpl.jena.rdf.model.RDFNode;
|
|
||||||
import com.hp.hpl.jena.rdf.model.ResourceFactory;
|
|
||||||
import com.hp.hpl.jena.rdf.model.Statement;
|
|
||||||
import com.hp.hpl.jena.rdf.model.StmtIterator;
|
|
||||||
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||||
import edu.cornell.mannlib.vitro.webapp.beans.VClassGroup;
|
import edu.cornell.mannlib.vitro.webapp.beans.VClassGroup;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.IndividualListController;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder;
|
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.PageDao;
|
import edu.cornell.mannlib.vitro.webapp.dao.PageDao;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.ModelContext;
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.VClassGroupCache;
|
import edu.cornell.mannlib.vitro.webapp.dao.jena.VClassGroupCache;
|
||||||
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.VClassGroupTemplateModel;
|
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.VClassGroupTemplateModel;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue