Fixing ThumbnailImageURLTest and ThumbnailImageURL classes.

This commit is contained in:
deepakkoni 2011-08-12 20:39:30 +00:00
parent 047540f2ff
commit 7e5826317c
2 changed files with 6 additions and 7 deletions

View file

@ -39,10 +39,10 @@ public class ThumbnailImageURL implements DocumentModifier {
private static final String query = prefix + private static final String query = prefix +
" SELECT (str(?thumbnailLocationURL) as ?ThumbnailLocationURL) WHERE { " + " SELECT (str(?downloadLocation) as ?DownloadLocation) WHERE { " +
" ?uri <http://vitro.mannlib.cornell.edu/ns/vitro/public#mainImage> ?a . " + " ?uri <http://vitro.mannlib.cornell.edu/ns/vitro/public#mainImage> ?a . " +
" ?a <http://vitro.mannlib.cornell.edu/ns/vitro/public#downloadLocation> ?b . " + " ?a <http://vitro.mannlib.cornell.edu/ns/vitro/public#downloadLocation> ?downloadLocation . } " ;
" ?b <http://vitro.mannlib.cornell.edu/ns/vitro/public#directDownloadUrl> ?thumbnailLocationURL . } "; //" ?b <http://vitro.mannlib.cornell.edu/ns/vitro/public#directDownloadUrl> ?thumbnailLocationURL . } ";
private Model model; private Model model;
private Log log = LogFactory.getLog(ThumbnailImageURL.class); private Log log = LogFactory.getLog(ThumbnailImageURL.class);
@ -84,7 +84,7 @@ public class ThumbnailImageURL implements DocumentModifier {
String name = iter.next(); String name = iter.next();
RDFNode node = soln.get( name ); RDFNode node = soln.get( name );
if( node != null ){ if( node != null ){
result.append(" " + node.toString()); result.append("" + node.toString());
}else{ }else{
log.info(name + " is null"); log.info(name + " is null");
} }

View file

@ -22,7 +22,6 @@ import com.hp.hpl.jena.rdf.model.impl.RDFDefaultErrorHandler;
import edu.cornell.mannlib.vitro.testing.AbstractTestClass; import edu.cornell.mannlib.vitro.testing.AbstractTestClass;
import edu.cornell.mannlib.vitro.webapp.beans.Individual; import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.beans.IndividualImpl; import edu.cornell.mannlib.vitro.webapp.beans.IndividualImpl;
import edu.cornell.mannlib.vitro.webapp.dao.jena.MenuDaoJenaTest;
import edu.cornell.mannlib.vitro.webapp.search.VitroSearchTermNames; import edu.cornell.mannlib.vitro.webapp.search.VitroSearchTermNames;
/** /**
@ -44,7 +43,7 @@ public class ThumbnailImageURLTest extends AbstractTestClass{
setLoggerLevel(RDFDefaultErrorHandler.class, Level.OFF); setLoggerLevel(RDFDefaultErrorHandler.class, Level.OFF);
Model model = ModelFactory.createDefaultModel(); Model model = ModelFactory.createDefaultModel();
InputStream in = MenuDaoJenaTest.class.getResourceAsStream("resources/menuForTest.n3"); InputStream in = ThumbnailImageURLTest.class.getResourceAsStream("testPerson.n3");
model.read(in,"","N3"); model.read(in,"","N3");
testModel = ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM,model); testModel = ModelFactory.createOntologyModel(OntModelSpec.OWL_DL_MEM,model);
} }
@ -70,7 +69,7 @@ public class ThumbnailImageURLTest extends AbstractTestClass{
Assert.assertNotNull( thumbnailField.getValues() ); Assert.assertNotNull( thumbnailField.getValues() );
Assert.assertEquals(1, thumbnailField.getValueCount()); Assert.assertEquals(1, thumbnailField.getValueCount());
Assert.assertEquals("http://vivo.cornell.edu/individual/n13658", thumbnailField.getFirstValue()); Assert.assertEquals("http://vivo.cornell.edu/individual/n54945", thumbnailField.getFirstValue());
} }
} }