NIHVIVO-2049 fix so classes, classgroups, etc. don't get indexed
This commit is contained in:
parent
b28fa05ffd
commit
3ad00d0ace
3 changed files with 30 additions and 7 deletions
|
@ -47,6 +47,7 @@ import edu.cornell.mannlib.vitro.webapp.beans.VClass;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.IndividualSDB.IndividualNotFoundException;
|
import edu.cornell.mannlib.vitro.webapp.dao.jena.IndividualSDB.IndividualNotFoundException;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.jena.WebappDaoFactorySDB.SDBDatasetMode;
|
import edu.cornell.mannlib.vitro.webapp.dao.jena.WebappDaoFactorySDB.SDBDatasetMode;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.servlet.setup.JenaDataSourceSetupBase;
|
||||||
|
|
||||||
public class IndividualDaoSDB extends IndividualDaoJena {
|
public class IndividualDaoSDB extends IndividualDaoJena {
|
||||||
|
|
||||||
|
@ -333,8 +334,11 @@ public class IndividualDaoSDB extends IndividualDaoJena {
|
||||||
final List<String> list =
|
final List<String> list =
|
||||||
new LinkedList<String>();
|
new LinkedList<String>();
|
||||||
|
|
||||||
|
// get all labeled resources from any non-tbox and non-metadata graphs.
|
||||||
String query = "SELECT DISTINCT ?ind WHERE { \n" +
|
String query = "SELECT DISTINCT ?ind WHERE { \n" +
|
||||||
" GRAPH ?g { ?ind <" + RDFS.label.getURI() + "> ?label } \n" +
|
" GRAPH ?g { ?ind <" + RDFS.label.getURI() + "> ?label } \n" +
|
||||||
|
" FILTER (?g != <" + JenaDataSourceSetupBase.JENA_APPLICATION_METADATA_MODEL + "> " +
|
||||||
|
" && !regex(str(?g),\"tbox\")) \n " +
|
||||||
"}";
|
"}";
|
||||||
|
|
||||||
Query q = QueryFactory.create(query);
|
Query q = QueryFactory.create(query);
|
||||||
|
|
|
@ -110,7 +110,7 @@ public class JenaDataSourceSetupBase extends JenaBaseDaoCon {
|
||||||
|
|
||||||
// This model doesn't exist yet. It's a placeholder for the application
|
// This model doesn't exist yet. It's a placeholder for the application
|
||||||
// ontology.
|
// ontology.
|
||||||
static final String JENA_APPLICATION_METADATA_MODEL =
|
public static final String JENA_APPLICATION_METADATA_MODEL =
|
||||||
"http://vitro.mannlib.cornell.edu/default/vitro-kb-applicationMetadata";
|
"http://vitro.mannlib.cornell.edu/default/vitro-kb-applicationMetadata";
|
||||||
|
|
||||||
// This is Brian C's application.owl file. We may not have to be concerned
|
// This is Brian C's application.owl file. We may not have to be concerned
|
||||||
|
|
|
@ -36,6 +36,7 @@ import com.hp.hpl.jena.sdb.StoreDesc;
|
||||||
import com.hp.hpl.jena.sdb.sql.SDBConnection;
|
import com.hp.hpl.jena.sdb.sql.SDBConnection;
|
||||||
import com.hp.hpl.jena.sdb.store.DatabaseType;
|
import com.hp.hpl.jena.sdb.store.DatabaseType;
|
||||||
import com.hp.hpl.jena.sdb.store.LayoutType;
|
import com.hp.hpl.jena.sdb.store.LayoutType;
|
||||||
|
import com.hp.hpl.jena.sdb.util.StoreUtils;
|
||||||
import com.hp.hpl.jena.shared.Lock;
|
import com.hp.hpl.jena.shared.Lock;
|
||||||
import com.hp.hpl.jena.util.iterator.ClosableIterator;
|
import com.hp.hpl.jena.util.iterator.ClosableIterator;
|
||||||
import com.hp.hpl.jena.vocabulary.RDF;
|
import com.hp.hpl.jena.vocabulary.RDF;
|
||||||
|
@ -317,6 +318,19 @@ public class JenaDataSourceSetupSDB extends JenaDataSourceSetupBase implements j
|
||||||
|
|
||||||
} catch (MigrationRequiredError mre) {
|
} catch (MigrationRequiredError mre) {
|
||||||
throw new MigrationRequiredError(mre.getMessage());
|
throw new MigrationRequiredError(mre.getMessage());
|
||||||
|
} catch (SQLException sqle) {
|
||||||
|
|
||||||
|
// SQL exceptions are fatal and should halt startup
|
||||||
|
AbortStartup.abortStartup(sce.getServletContext());
|
||||||
|
|
||||||
|
log.error("Error using SQL database; startup aborted.", sqle);
|
||||||
|
|
||||||
|
// print to catalina.out for good measure
|
||||||
|
System.out.println("Error using SQL database; startup aborted.");
|
||||||
|
sqle.printStackTrace();
|
||||||
|
|
||||||
|
throw new Error(this.getClass().getName() + "failed");
|
||||||
|
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
log.error("Throwable in " + this.getClass().getName(), t);
|
log.error("Throwable in " + this.getClass().getName(), t);
|
||||||
// printing the error because Tomcat doesn't print context listener
|
// printing the error because Tomcat doesn't print context listener
|
||||||
|
@ -616,6 +630,10 @@ public class JenaDataSourceSetupSDB extends JenaDataSourceSetupBase implements j
|
||||||
log.info("During initial SDB setup, created an application metadata model of size "
|
log.info("During initial SDB setup, created an application metadata model of size "
|
||||||
+ applicationMetadataModel.size());
|
+ applicationMetadataModel.size());
|
||||||
|
|
||||||
|
// remove application metadata from ABox model
|
||||||
|
aboxAssertions.remove(applicationMetadataModel);
|
||||||
|
aboxInferences.remove(applicationMetadataModel);
|
||||||
|
|
||||||
// Make sure the reasoner takes into account the newly-set-up data.
|
// Make sure the reasoner takes into account the newly-set-up data.
|
||||||
SimpleReasonerSetup.setRecomputeRequired(ctx);
|
SimpleReasonerSetup.setRecomputeRequired(ctx);
|
||||||
|
|
||||||
|
@ -631,12 +649,13 @@ public class JenaDataSourceSetupSDB extends JenaDataSourceSetupBase implements j
|
||||||
* @param store
|
* @param store
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
private boolean isSetUp(Store store) {
|
private boolean isSetUp(Store store) throws SQLException {
|
||||||
try {
|
return StoreUtils.isFormatted(store);
|
||||||
return (SDBFactory.connectNamedModel(store, JenaDataSourceSetupBase.JENA_TBOX_ASSERTIONS_MODEL)).size() > 0;
|
// try {
|
||||||
} catch (Exception e) {
|
// return (SDBFactory.connectNamedModel(store, JenaDataSourceSetupBase.JENA_TBOX_ASSERTIONS_MODEL)).size() > 0;
|
||||||
return false;
|
// } catch (Exception e) {
|
||||||
}
|
// return false;
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final String STOREDESC_ATTR = "storeDesc";
|
private static final String STOREDESC_ATTR = "storeDesc";
|
||||||
|
|
Loading…
Add table
Reference in a new issue