Fixed getVClassesForProperty to return subclasses NIHVIVO-3814

Added unit test for getVClassesForProperty
Changes to debugging messages for solr indexing
This commit is contained in:
briancaruso 2012-06-26 21:35:17 +00:00
parent d7b3f0e3f1
commit ea3e05fb80
4 changed files with 79 additions and 15 deletions

View file

@ -745,7 +745,10 @@ public class VClassDaoJena extends JenaBaseDao implements VClassDao {
if (superclass == null) {
superclass = (domainSide) ? op.getRange() : op.getDomain();
if (superclass == null) {
superclass = getOntModel().getOntResource(OWL.Thing.getURI());
//this section to prevent all subclasses of owl:Thing
//returned if range is owl:Thing, refer to NIHVIVO-3357 NIHVIVO-3814
//This is unfortunate case of warping the model for the ease of the display.
return Collections.emptyList();
}
}
if (superclass != null) {
@ -755,11 +758,15 @@ public class VClassDaoJena extends JenaBaseDao implements VClassDao {
} else {
superVclass = getVClassByURI(superclass.getURI());
}
if( OWL.Thing.equals( superclass )){
//this section to prevent all subclasses of owl:Thing
//returned if range is owl:Thing, refer to NIHVIVO-3357 NIHVIVO-3814
//This is unfortunate case of warping the model for the ease of the display.
return Collections.emptyList();
}
if (superVclass != null) {
vClasses.add(superVclass);
//Commenting out this section to prevent all subclasses of owl:Thing
//returned if range is owl:Thing, refer to NIHVIVO-3357
/* String isInferencing = getWebappDaoFactory().getProperties().get("infersTypes");
vClasses.add(superVclass);
String isInferencing = getWebappDaoFactory().getProperties().get("infersTypes");
// if this model infers types based on the taxonomy, adding the subclasses will only
// waste time for no benefit
PelletListener pl = getWebappDaoFactory().getPelletListener();
@ -772,7 +779,7 @@ public class VClassDaoJena extends JenaBaseDao implements VClassDao {
if (vClass != null)
vClasses.add(vClass);
}
} */
}
}
}
}

View file

@ -437,7 +437,8 @@ public class IndexBuilder extends VitroBackgroundThread {
work.get( counter % workers ).add( uris.next() );
counter ++;
}
log.info("Number of individuals to be indexed : " + counter);
log.info("Number of individuals to be indexed : " + counter + " by "
+ workers + " worker theads.");
return work;
}

View file

@ -119,14 +119,14 @@ public class IndividualToSolrDocument {
throws SkipIndividualException{
//run the document modifiers
if( documentModifiers != null && !documentModifiers.isEmpty()){
docModCount++;
for(DocumentModifier modifier: documentModifiers){
long start = System.currentTimeMillis();
modifier.modifyDocument(ind, doc, addUri);
if( log.isDebugEnabled()){
docModCount++;
if( log.isDebugEnabled()){
long delta = System.currentTimeMillis() - start;
synchronized(docModClassToTime){
Class clz = modifier.getClass();
@ -137,8 +137,9 @@ public class IndividualToSolrDocument {
docModClassToTime.put(clz.getName(), delta);
}
}
if( docModCount % 100 == 0 ){
for( Entry<String, Long> entry: docModClassToTime.entrySet()){
if( docModCount % 200 == 0 ){
log.debug("DocumentModifier timings");
for( Entry<String, Long> entry: docModClassToTime.entrySet()){
log.debug("average msec to run " + entry.getKey() + ": " + (entry.getValue()/docModCount));
}
}