Merge from 1.3 maint
This commit is contained in:
parent
1b260b2e67
commit
7abaa39fa3
5 changed files with 86 additions and 26 deletions
|
@ -1,22 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE rdf:RDF [
|
|
||||||
<!ENTITY display "http://vitro.mannlib.cornell.edu/ontologies/display/1.1#">
|
|
||||||
<!ENTITY owl "http://www.w3.org/2002/07/owl#">
|
|
||||||
<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#">
|
|
||||||
<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#">
|
|
||||||
<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">
|
|
||||||
<!ENTITY vitro "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#">
|
|
||||||
]>
|
|
||||||
|
|
||||||
<rdf:RDF xml:base="http://vitro.mannlib.cornell.edu/ontologies/display/1.1/"
|
|
||||||
xmlns:display="&display;"
|
|
||||||
xmlns:owl="&owl;"
|
|
||||||
xmlns:rdf="&rdf;"
|
|
||||||
xmlns:rdfs="&rdfs;"
|
|
||||||
xmlns:vitro="&vitro;">
|
|
||||||
|
|
||||||
<rdf:Description rdf:about="http://vitro.mannlib.cornell.edu/ontologies/display/1.1#hasElement">
|
|
||||||
<display:listViewConfigFile rdf:datatype="http://www.w3.org/2001/XMLSchema#string">listViewConfig-hasElement.xml</display:listViewConfigFile>
|
|
||||||
</rdf:Description>
|
|
||||||
|
|
||||||
</rdf:RDF>
|
|
|
@ -320,13 +320,14 @@ public class IndividualListController extends FreemarkerHttpServlet {
|
||||||
|
|
||||||
SolrQuery query = new SolrQuery(queryText);
|
SolrQuery query = new SolrQuery(queryText);
|
||||||
|
|
||||||
query.setStart( page > 0 ? pageSize * page + 1 : 0 )
|
//page count starts at 1, row count starts at 0
|
||||||
.setRows( pageSize );
|
int startRow = (page-1) * pageSize ;
|
||||||
|
query.setStart( startRow ).setRows( pageSize );
|
||||||
|
|
||||||
// Need a single-valued field for sorting
|
// Need a single-valued field for sorting
|
||||||
query.setSortField(VitroSearchTermNames.NAME_LOWERCASE_SINGLE_VALUED, SolrQuery.ORDER.asc);
|
query.setSortField(VitroSearchTermNames.NAME_LOWERCASE_SINGLE_VALUED, SolrQuery.ORDER.asc);
|
||||||
|
|
||||||
log.debug("Query text is " + queryText);
|
log.debug("Query is " + query.toString());
|
||||||
return query;
|
return query;
|
||||||
|
|
||||||
} catch (Exception ex){
|
} catch (Exception ex){
|
||||||
|
|
|
@ -0,0 +1,29 @@
|
||||||
|
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package edu.cornell.mannlib.vitro.webapp.search.indexing;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.hp.hpl.jena.rdf.model.Statement;
|
||||||
|
import com.hp.hpl.jena.vocabulary.RDF;
|
||||||
|
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.search.beans.StatementToURIsToUpdate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds URIs to index for type statement changes on individuals.
|
||||||
|
*/
|
||||||
|
public class AdditionalURIsForTypeStatements implements StatementToURIsToUpdate {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> findAdditionalURIsToIndex(Statement stmt) {
|
||||||
|
if( stmt != null && RDF.type.getURI().equals( stmt.getPredicate().getURI() )){
|
||||||
|
return Collections.singletonList( stmt.getSubject().getURI() );
|
||||||
|
}else{
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -35,6 +35,7 @@ import edu.cornell.mannlib.vitro.webapp.search.beans.StatementToURIsToUpdate;
|
||||||
import edu.cornell.mannlib.vitro.webapp.search.indexing.AdditionalURIsForContextNodes;
|
import edu.cornell.mannlib.vitro.webapp.search.indexing.AdditionalURIsForContextNodes;
|
||||||
import edu.cornell.mannlib.vitro.webapp.search.indexing.AdditionalURIsForDataProperties;
|
import edu.cornell.mannlib.vitro.webapp.search.indexing.AdditionalURIsForDataProperties;
|
||||||
import edu.cornell.mannlib.vitro.webapp.search.indexing.AdditionalURIsForObjectProperties;
|
import edu.cornell.mannlib.vitro.webapp.search.indexing.AdditionalURIsForObjectProperties;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.search.indexing.AdditionalURIsForTypeStatements;
|
||||||
import edu.cornell.mannlib.vitro.webapp.search.indexing.IndexBuilder;
|
import edu.cornell.mannlib.vitro.webapp.search.indexing.IndexBuilder;
|
||||||
import edu.cornell.mannlib.vitro.webapp.search.indexing.SearchReindexingListener;
|
import edu.cornell.mannlib.vitro.webapp.search.indexing.SearchReindexingListener;
|
||||||
import edu.cornell.mannlib.vitro.webapp.servlet.setup.AbortStartup;
|
import edu.cornell.mannlib.vitro.webapp.servlet.setup.AbortStartup;
|
||||||
|
@ -112,6 +113,7 @@ public class SolrSetup implements javax.servlet.ServletContextListener{
|
||||||
uriFinders.add( new AdditionalURIsForDataProperties() );
|
uriFinders.add( new AdditionalURIsForDataProperties() );
|
||||||
uriFinders.add( new AdditionalURIsForObjectProperties(jenaOntModel) );
|
uriFinders.add( new AdditionalURIsForObjectProperties(jenaOntModel) );
|
||||||
uriFinders.add( new AdditionalURIsForContextNodes(jenaOntModel) );
|
uriFinders.add( new AdditionalURIsForContextNodes(jenaOntModel) );
|
||||||
|
uriFinders.add( new AdditionalURIsForTypeStatements() );
|
||||||
|
|
||||||
IndexBuilder builder = new IndexBuilder( solrIndexer, wadf, uriFinders );
|
IndexBuilder builder = new IndexBuilder( solrIndexer, wadf, uriFinders );
|
||||||
// to the servlet context so we can access it later in the webapp.
|
// to the servlet context so we can access it later in the webapp.
|
||||||
|
|
|
@ -0,0 +1,50 @@
|
||||||
|
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
package edu.cornell.mannlib.vitro.webapp.search.indexing;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.junit.Assert;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
import com.hp.hpl.jena.rdf.model.ResourceFactory;
|
||||||
|
import com.hp.hpl.jena.rdf.model.Statement;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author bdc34
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class AdditionalURIsForTypeStatementsTest {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @throws java.lang.Exception
|
||||||
|
*/
|
||||||
|
@Before
|
||||||
|
public void setUp() throws Exception {
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Test method for {@link edu.cornell.mannlib.vitro.webapp.search.indexing.AdditionalURIsForTypeStatements#findAdditionalURIsToIndex(com.hp.hpl.jena.rdf.model.Statement)}.
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testFindAdditionalURIsToIndex() {
|
||||||
|
AdditionalURIsForTypeStatements aufts = new AdditionalURIsForTypeStatements();
|
||||||
|
|
||||||
|
String subject = "http://caruso-laptop.mannlib.cornell.edu:8090/vivo/individual/n3270";
|
||||||
|
Statement typeChangeStatement = ResourceFactory.createStatement(
|
||||||
|
ResourceFactory.createResource(subject),
|
||||||
|
ResourceFactory.createProperty("http://www.w3.org/1999/02/22-rdf-syntax-ns#type"),
|
||||||
|
ResourceFactory.createResource( "http://caruso-laptop.mannlib.cornell.edu:8090/vivo/ontology/localOnt#LocalInternalClass"));
|
||||||
|
|
||||||
|
|
||||||
|
List<String> uris = aufts.findAdditionalURIsToIndex( typeChangeStatement );
|
||||||
|
|
||||||
|
Assert.assertNotNull(uris);
|
||||||
|
Assert.assertTrue("Did not contain subject of type change statement", uris.contains(subject));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue