From 637f98661ee24aa9ffc4846f98743e7524fd5719 Mon Sep 17 00:00:00 2001 From: deepakkoni Date: Thu, 16 Jun 2011 12:05:53 +0000 Subject: [PATCH] Committing the following changes 1) Reverting to the original configuration containing 5 queries and firing them against Dataset object. 2) setting for moderate solr logging onto the console. --- webapp/config/default.log4j.properties | 3 + .../webapp/search/solr/ContextNodeFields.java | 70 +++++++++---------- .../vitro/webapp/search/solr/SolrSetup.java | 2 +- 3 files changed, 38 insertions(+), 37 deletions(-) diff --git a/webapp/config/default.log4j.properties b/webapp/config/default.log4j.properties index 48356bd1b..b7ddfdda5 100644 --- a/webapp/config/default.log4j.properties +++ b/webapp/config/default.log4j.properties @@ -36,6 +36,9 @@ log4j.rootLogger=INFO, AllAppender log4j.logger.edu.cornell.mannlib.vitro.webapp.controller.freemarker.BrowseController=WARN log4j.logger.edu.cornell.mannlib.vitro.webapp.dao.jena.pellet.PelletListener=WARN log4j.logger.edu.cornell.mannlib.vitro.webapp.dao.jena.RDBGraphGenerator=WARN +#log4j.logger.edu.cornell.mannlib.vitro.webapp.search.solr.IndividualToSolrDocument=DEBUG +#log4j.logger.edu.cornell.mannlib.vitro.webapp.search.solr.CalculateParameters=DEBUG +#log4j.logger.edu.cornell.mannlib.vitro.webapp.search.solr.ContextNodeFields=DEBUG # suppress odd warnings from libraries log4j.logger.org.openjena.riot=FATAL diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/solr/ContextNodeFields.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/solr/ContextNodeFields.java index c676a75fd..ddd3e9b6c 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/solr/ContextNodeFields.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/solr/ContextNodeFields.java @@ -177,10 +177,10 @@ public class ContextNodeFields implements DocumentModifier{ objectProperties.append(" "); - objectProperties.append(getPropertiesAssociatedWithContextNodes(individual.getURI())); +// objectProperties.append(getPropertiesAssociatedWithContextNodes(individual.getURI())); -// objectProperties.append(getPropertiesAssociatedWithEducationalTraining(individual.getURI())); -// objectProperties.append(" "); + objectProperties.append(getPropertiesAssociatedWithEducationalTraining(individual.getURI())); + objectProperties.append(" "); // properties related to core:EducationalTraining @@ -197,11 +197,11 @@ public class ContextNodeFields implements DocumentModifier{ // objectProperties.append(" "); // // -// objectProperties.append(getPropertiesAssociatedWithRole(individual.getURI())); -// objectProperties.append(" "); + objectProperties.append(getPropertiesAssociatedWithRole(individual.getURI())); + objectProperties.append(" "); -// objectProperties.append(getPropertiesAssociatedWithPosition(individual.getURI())); -// objectProperties.append(" "); + objectProperties.append(getPropertiesAssociatedWithPosition(individual.getURI())); + objectProperties.append(" "); //properties related to core:Position // objectProperties.append(getHRJobTitle(individual.getURI())); @@ -219,8 +219,8 @@ public class ContextNodeFields implements DocumentModifier{ // objectProperties.append(getInvolvedOrganizationName(individual.getURI())); // objectProperties.append(" "); -// objectProperties.append(getPropertiesAssociatedWithRelationship(individual.getURI())); -// objectProperties.append(" "); + objectProperties.append(getPropertiesAssociatedWithRelationship(individual.getURI())); + objectProperties.append(" "); //properties related to core:Relationship // objectProperties.append(getLinkedAuthor(individual.getURI())); @@ -235,8 +235,8 @@ public class ContextNodeFields implements DocumentModifier{ // objectProperties.append(getDegreeCandidacy(individual.getURI())); // objectProperties.append(" "); -// objectProperties.append(getPropertiesAssociatedWithAwardReceipt(individual.getURI())); -// objectProperties.append(" "); + objectProperties.append(getPropertiesAssociatedWithAwardReceipt(individual.getURI())); + objectProperties.append(" "); //properties related to core:AwardReceipt // objectProperties.append(getAwardConferredBy(individual.getURI())); @@ -251,12 +251,12 @@ public class ContextNodeFields implements DocumentModifier{ } if(IndividualToSolrDocument.superClassNames.contains("InformationResource")){ - //targetField.addValue(" " + getPropertiesAssociatedWithInformationResource(individual.getURI()), targetField.getBoost()); + targetField.addValue(" " + getPropertiesAssociatedWithInformationResource(individual.getURI()), targetField.getBoost()); //properties related to core:InformationResource - targetField.addValue(" " + getLinkedAuthorandLinkedInformationResource(individual.getURI()), targetField.getBoost()); - targetField.addValue(" " + getFeatures(individual.getURI()), targetField.getBoost()); - targetField.addValue(" " + getEditor(individual.getURI()), targetField.getBoost()); - targetField.addValue(" " + getSubjectAreaAndResearchAreaOf(individual.getURI()), targetField.getBoost()); +// targetField.addValue(" " + getLinkedAuthorandLinkedInformationResource(individual.getURI()), targetField.getBoost()); +// targetField.addValue(" " + getFeatures(individual.getURI()), targetField.getBoost()); +// targetField.addValue(" " + getEditor(individual.getURI()), targetField.getBoost()); +// targetField.addValue(" " + getSubjectAreaAndResearchAreaOf(individual.getURI()), targetField.getBoost()); } field.addValue(objectProperties, field.getBoost()); @@ -571,10 +571,9 @@ public class ContextNodeFields implements DocumentModifier{ + " } ORDER BY ?PositionLabel "; Query sparqlQuery = QueryFactory.create(thisQuery, Syntax.syntaxARQ); - fullModel.enterCriticalSection(Lock.READ); - + dataset.getLock().enterCriticalSection(Lock.READ); try{ - QueryExecution qExec = QueryExecutionFactory.create(sparqlQuery, fullModel, initialBinding); + QueryExecution qExec = QueryExecutionFactory.create(sparqlQuery, dataset, initialBinding); try{ ResultSet results = qExec.execSelect(); @@ -632,7 +631,7 @@ public class ContextNodeFields implements DocumentModifier{ qExec.close(); } }finally{ - fullModel.leaveCriticalSection(); + dataset.getLock().leaveCriticalSection(); } return propertyValues.toString(); @@ -851,10 +850,10 @@ public class ContextNodeFields implements DocumentModifier{ + " } "; Query sparqlQuery = QueryFactory.create(thisQuery, Syntax.syntaxARQ); - fullModel.enterCriticalSection(Lock.READ); + dataset.getLock().enterCriticalSection(Lock.READ); try{ - QueryExecution qExec = QueryExecutionFactory.create(sparqlQuery, fullModel, initialBinding); + QueryExecution qExec = QueryExecutionFactory.create(sparqlQuery, dataset, initialBinding); try{ ResultSet results = qExec.execSelect(); @@ -898,7 +897,7 @@ public class ContextNodeFields implements DocumentModifier{ qExec.close(); } }finally{ - fullModel.leaveCriticalSection(); + dataset.getLock().leaveCriticalSection(); } return propertyValues.toString(); @@ -1069,10 +1068,10 @@ public class ContextNodeFields implements DocumentModifier{ + " } ORDER BY ?AwardReceiptLabel"; Query sparqlQuery = QueryFactory.create(thisQuery, Syntax.syntaxARQ); - fullModel.enterCriticalSection(Lock.READ); + dataset.getLock().enterCriticalSection(Lock.READ); try{ - QueryExecution qExec = QueryExecutionFactory.create(sparqlQuery, fullModel, initialBinding); + QueryExecution qExec = QueryExecutionFactory.create(sparqlQuery, dataset, initialBinding); try{ ResultSet results = qExec.execSelect(); @@ -1116,7 +1115,7 @@ public class ContextNodeFields implements DocumentModifier{ qExec.close(); } }finally{ - fullModel.leaveCriticalSection(); + dataset.getLock().leaveCriticalSection(); } return propertyValues.toString(); @@ -1140,10 +1139,10 @@ public class ContextNodeFields implements DocumentModifier{ + " } ORDER BY ?OrganizationLabel "; Query sparqlQuery = QueryFactory.create(thisQuery, Syntax.syntaxARQ); - fullModel.enterCriticalSection(Lock.READ); + dataset.getLock().enterCriticalSection(Lock.READ); try{ - QueryExecution qExec = QueryExecutionFactory.create(sparqlQuery, fullModel, initialBinding); + QueryExecution qExec = QueryExecutionFactory.create(sparqlQuery, dataset, initialBinding); try{ ResultSet results = qExec.execSelect(); @@ -1166,7 +1165,7 @@ public class ContextNodeFields implements DocumentModifier{ qExec.close(); } }finally{ - fullModel.leaveCriticalSection(); + dataset.getLock().leaveCriticalSection(); } return propertyValues.toString(); @@ -1404,10 +1403,10 @@ public class ContextNodeFields implements DocumentModifier{ +"}"; Query sparqlQuery = QueryFactory.create(thisQuery, Syntax.syntaxARQ); - fullModel.enterCriticalSection(Lock.READ); + dataset.getLock().enterCriticalSection(Lock.READ); try{ - QueryExecution qExec = QueryExecutionFactory.create(sparqlQuery, fullModel, initialBinding); + QueryExecution qExec = QueryExecutionFactory.create(sparqlQuery, dataset, initialBinding); try{ ResultSet results = qExec.execSelect(); @@ -1458,7 +1457,7 @@ public class ContextNodeFields implements DocumentModifier{ qExec.close(); } }finally{ - fullModel.leaveCriticalSection(); + dataset.getLock().leaveCriticalSection(); } return propertyValues.toString(); @@ -1708,10 +1707,9 @@ public class ContextNodeFields implements DocumentModifier{ +"}"; Query sparqlQuery = QueryFactory.create(thisQuery, Syntax.syntaxARQ); - fullModel.enterCriticalSection(Lock.READ); - + dataset.getLock().enterCriticalSection(Lock.READ); try{ - QueryExecution qExec = QueryExecutionFactory.create(sparqlQuery, fullModel, initialBinding); + QueryExecution qExec = QueryExecutionFactory.create(sparqlQuery, dataset, initialBinding); try{ ResultSet results = qExec.execSelect(); @@ -1769,7 +1767,7 @@ public class ContextNodeFields implements DocumentModifier{ qExec.close(); } }finally{ - fullModel.leaveCriticalSection(); + dataset.getLock().leaveCriticalSection(); } return propertyValues.toString(); diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/solr/SolrSetup.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/solr/SolrSetup.java index 30c3b9cba..a2243d372 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/search/solr/SolrSetup.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/search/solr/SolrSetup.java @@ -75,7 +75,7 @@ public class SolrSetup implements javax.servlet.ServletContextListener{ Dataset dataset = WebappDaoFactoryJena.makeInMemoryDataset(abox, inferences); List modifiers = new ArrayList(); - // modifiers.add(new CalculateParameters(ModelContext.getJenaOntModel(context))); + // modifiers.add(new CalculateParameters(ModelContext.getJenaOntModel(context))); modifiers.add(new ContextNodeFields( dataset )); IndividualToSolrDocument indToSolrDoc = new IndividualToSolrDocument(