From 02598d2707ae0cbd5f7c2ee8fb6e4a6b1a75a732 Mon Sep 17 00:00:00 2001 From: hjkhjk54 Date: Fri, 18 Nov 2011 21:38:26 +0000 Subject: [PATCH] Additional debugging lines in SparqlEvaluateVTwo --- .../n3editing/VTwo/SparqlEvaluateVTwo.java | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/VTwo/SparqlEvaluateVTwo.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/VTwo/SparqlEvaluateVTwo.java index 734f10c5c..0f4dfa7e1 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/VTwo/SparqlEvaluateVTwo.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/VTwo/SparqlEvaluateVTwo.java @@ -27,21 +27,25 @@ public class SparqlEvaluateVTwo { } public void evaluateForAdditionalUris( EditConfigurationVTwo editConfig ){ + log.debug("Evaluating for Additional URIS"); Map> varsToUris = sparqlEvaluateForUris(editConfig, editConfig.getSparqlForAdditionalUrisInScope()); editConfig.getUrisInScope().putAll(varsToUris); } public void evalulateForAdditionalLiterals( EditConfigurationVTwo editConfig ){ + log.debug("Evaluating for Additional Literals"); Map> varsToLiterals = sparqlEvaluateForLiterals(editConfig, editConfig.getSparqlForAdditionalLiteralsInScope()); editConfig.getLiteralsInScope().putAll(varsToLiterals); } public void evaluateForExistingUris( EditConfigurationVTwo editConfig){ + log.debug("Evaluating for existing URIS"); Map> varsToUris = sparqlEvaluateForUris(editConfig, editConfig.getSparqlForExistingUris()); editConfig.getUrisInScope().putAll(varsToUris); } public void evaluateForExistingLiterals( EditConfigurationVTwo editConfig){ + log.debug("Evaluating for existing literals"); Map> varsToLiterals = sparqlEvaluateForLiterals(editConfig, editConfig.getSparqlForExistingLiterals()); editConfig.getLiteralsInScope().putAll(varsToLiterals); } @@ -88,15 +92,18 @@ public class SparqlEvaluateVTwo { Map> varToLiterals = new HashMap>(); for(String var : varToSparql.keySet()){ String query = varToSparql.get(var); - + log.debug("Var name " + var + " and query = " + query); /* skip if var set to use a system generated value */ - if( query == null || EditConfigurationVTwo.USE_SYSTEM_VALUE.equals( query )) + if( query == null || EditConfigurationVTwo.USE_SYSTEM_VALUE.equals( query )) { + log.debug("Query is null or using system value so will not continue with rest of method"); continue; - + } List queryStrings = new ArrayList (); queryStrings.add( query ); editConfig.getN3Generator().subInMultiUris(uriScope, queryStrings); + log.debug("Query after substituting uris in scope: " + queryStrings.toString()); editConfig.getN3Generator().subInMultiLiterals(literalScope,queryStrings); + log.debug("Query after substituting literals in scope: " + queryStrings.toString()); varToLiterals.put(var, queryToLiteral( queryStrings.get(0) )); //might result in (key -> null) } @@ -111,13 +118,18 @@ public class SparqlEvaluateVTwo { for(String var : varToSparql.keySet()){ String query = varToSparql.get(var); + log.debug("Var name " + var + " and query = " + query); /* skip if var set to use a system generated value */ - if( query == null || EditConfigurationVTwo.USE_SYSTEM_VALUE.equals( query )) + if( query == null || EditConfigurationVTwo.USE_SYSTEM_VALUE.equals( query )) { + log.debug("Query is null or using system value so will not continue with rest of method"); continue; + } List queryStrings = new ArrayList (); queryStrings.add(query); editConfig.getN3Generator().subInMultiUris(uriScope, queryStrings); + log.debug("Query after substituting uris in scope: " + queryStrings.toString()); editConfig.getN3Generator().subInMultiLiterals(literalScope,queryStrings); + log.debug("Query after substituting literals in scope: " + queryStrings.toString()); List uriFromQuery = queryToUri( queryStrings.get(0) ); if( uriFromQuery != null ) { @@ -181,6 +193,7 @@ public class SparqlEvaluateVTwo { }else{ + log.debug("Query had no results"); return null; } } else { @@ -198,6 +211,7 @@ public class SparqlEvaluateVTwo { public List queryToLiteral(String querystr){ + log.debug("Executing query " + querystr); Literal value = null; List values = new ArrayList(); QueryExecution qe = null; @@ -217,6 +231,7 @@ public class SparqlEvaluateVTwo { values.add(value); } }else{ + log.debug("Query had no results"); return null; } } else {