updated from trunk

This commit is contained in:
anupsawant 2011-05-24 18:46:29 +00:00
commit c24926e72b
21 changed files with 516 additions and 262 deletions

View file

@ -486,6 +486,8 @@
<field name="nameRaw" type="string" indexed="true" stored="true" multiValued="true"/> <field name="nameRaw" type="string" indexed="true" stored="true" multiValued="true"/>
<!-- RY Not sure if we need to store nameLowercase --> <!-- RY Not sure if we need to store nameLowercase -->
<field name="nameLowercase" type="string" indexed="true" stored="true" multiValued="true"/> <field name="nameLowercase" type="string" indexed="true" stored="true" multiValued="true"/>
<!-- A sortable version of nameLowercase -->
<field name="nameLowercaseSingleValued" type="lowercase" indexed="true" stored="false" multiValued="false" />
<field name="nameUnstemmed" type="text" indexed="true" stored="false" multiValued="true"/> <field name="nameUnstemmed" type="text" indexed="true" stored="false" multiValued="true"/>
<field name="nameStemmed" type="text" indexed="true" stored="false" multiValued="true"/> <field name="nameStemmed" type="text" indexed="true" stored="false" multiValued="true"/>
<field name="acNameUnstemmed" type="textUnstemmed" indexed="true" stored="false" multiValued="true"/> <field name="acNameUnstemmed" type="textUnstemmed" indexed="true" stored="false" multiValued="true"/>
@ -504,6 +506,8 @@
<field name="modType" type="ignored"/> <field name="modType" type="ignored"/>
<field name="JCLASS" type="ignored"/> <field name="JCLASS" type="ignored"/>
<!-- Copy nameLowercase to sortable field. -->
<copyField source="nameLowercase" dest="nameLowercaseSingleValued" />
<!-- **************************** End Vitro Fields *************************** --> <!-- **************************** End Vitro Fields *************************** -->

View file

@ -886,13 +886,19 @@
<url-pattern>/individuallist</url-pattern> <url-pattern>/individuallist</url-pattern>
</servlet-mapping> </servlet-mapping>
<servlet> <servlet>
<servlet-name>EntityURLController</servlet-name> <servlet-name>IndividualListRdf</servlet-name>
<servlet-class>edu.cornell.mannlib.vitro.webapp.controller.EntityURLController</servlet-class> <servlet-class>edu.cornell.mannlib.vitro.webapp.controller.EntityURLController</servlet-class>
</servlet>
<!--
<servlet>
<servlet-name>IndividualListRdf</servlet-name>
<servlet-class>edu.cornell.mannlib.vitro.webapp.controller.IndividualListRdfController</servlet-class>
</servlet> </servlet>
-->
<servlet-mapping> <servlet-mapping>
<servlet-name>EntityURLController</servlet-name> <servlet-name>IndividualListRdf</servlet-name>
<url-pattern>/entityurl/*</url-pattern> <url-pattern>/listrdf/*</url-pattern>
</servlet-mapping> </servlet-mapping>
<!-- <!--
<servlet> <servlet>

View file

@ -44,18 +44,18 @@ public void doGet (HttpServletRequest req, HttpServletResponse res) throws IOExc
String url = req.getRequestURI().substring(req.getContextPath().length()); String url = req.getRequestURI().substring(req.getContextPath().length());
ContentType contentType = checkForRequestType(req.getHeader("accept")); ContentType contentType = checkForRequestType(req.getHeader("accept"));
if(Pattern.compile("^/entityurl/$").matcher(url).matches()){ if(Pattern.compile("^/listrdf/$").matcher(url).matches()){
String redirectURL = null; String redirectURL = null;
if(contentType!=null){ if(contentType!=null){
if ( RDFXML_MIMETYPE.equals(contentType.getMediaType())) if ( RDFXML_MIMETYPE.equals(contentType.getMediaType()))
redirectURL = "/entityurl/entityurl.rdf"; redirectURL = "/listrdf/listrdf.rdf";
else if( N3_MIMETYPE.equals(contentType.getMediaType())) else if( N3_MIMETYPE.equals(contentType.getMediaType()))
redirectURL = "/entityurl/entityurl.n3"; redirectURL = "/listrdf/listrdf.n3";
else if ( TTL_MIMETYPE.equals(contentType.getMediaType())) else if ( TTL_MIMETYPE.equals(contentType.getMediaType()))
redirectURL = "/entityurl/entityurl.ttl"; redirectURL = "/listrdf/listrdf.ttl";
} }
else{ else{
redirectURL = "/entityurl/entityrurl.rdf"; redirectURL = "/listrdf/listrdf.rdf";
} }
String hn = req.getHeader("Host"); String hn = req.getHeader("Host");

View file

@ -0,0 +1,82 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.controller;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.solr.client.solrj.SolrQuery;
import org.apache.solr.client.solrj.SolrServer;
import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.solr.common.SolrDocument;
import org.apache.solr.common.SolrDocumentList;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.rdf.model.RDFNode;
import com.hp.hpl.jena.rdf.model.Resource;
import com.hp.hpl.jena.rdf.model.ResourceFactory;
import com.hp.hpl.jena.vocabulary.RDF;
import edu.cornell.mannlib.vitro.webapp.search.lucene.Entity2LuceneDoc.VitroLuceneTermNames;
import edu.cornell.mannlib.vitro.webapp.search.solr.SolrSetup;
public class IndividualListRdfController extends VitroHttpServlet {
private static final long serialVersionUID = 1L;
private static final Log log = LogFactory.getLog(IndividualListRdfController.class.getName());
public static final int ENTITY_LIST_CONTROLLER_MAX_RESULTS = 30000;
public void doGet (HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException {
// Make the query
String classUri = (String) getServletContext().getAttribute("classuri");
String queryStr = VitroLuceneTermNames.RDFTYPE + ":\"" + classUri + "\"";
SolrQuery query = new SolrQuery(queryStr);
query.setStart(0)
.setRows(ENTITY_LIST_CONTROLLER_MAX_RESULTS)
.setFields(VitroLuceneTermNames.URI);
// For now, we're only displaying the url, so no need to sort.
//.setSortField(VitroLuceneTermNames.NAME_LOWERCASE_SINGLE_VALUED);
// Execute the query
SolrServer solr = SolrSetup.getSolrServer(getServletContext());
QueryResponse response = null;
try {
response = solr.query(query);
} catch (Throwable t) {
log.error(t, t);
}
if ( response == null ) {
throw new ServletException("Could not run search in IndividualListRdfController");
}
SolrDocumentList docs = response.getResults();
if (docs == null) {
throw new ServletException("Could not run search in IndividualListRdfController");
}
Model model = ModelFactory.createDefaultModel();
for (SolrDocument doc : docs) {
String uri = doc.get(VitroLuceneTermNames.URI).toString();
Resource resource = ResourceFactory.createResource(uri);
RDFNode node = (RDFNode) ResourceFactory.createResource(classUri);
model.add(resource, RDF.type, node);
}
res.setContentType(RDFXML_MIMETYPE);
model.write(res.getOutputStream(), "RDF/XML");
}
public void doPost (HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException{
doGet(req,res);
}
}

View file

@ -233,7 +233,7 @@ public class JSONServlet extends VitroHttpServlet {
rObj.put("alpha", map.get("alpha")); rObj.put("alpha", map.get("alpha"));
List<Individual> inds = (List<Individual>)map.get("entities"); List<Individual> inds = (List<Individual>)map.get("entities");
List<IndividualTemplateModel> indsTm = new ArrayList<IndividualTemplateModel>();
JSONArray jInds = new JSONArray(); JSONArray jInds = new JSONArray();
for(Individual ind : inds ){ for(Individual ind : inds ){
JSONObject jo = new JSONObject(); JSONObject jo = new JSONObject();

View file

@ -225,11 +225,14 @@ public class VitroHttpServlet extends HttpServlet {
* A child class may call this if logging is set to debug level. * A child class may call this if logging is set to debug level.
*/ */
protected void dumpRequestParameters(HttpServletRequest req) { protected void dumpRequestParameters(HttpServletRequest req) {
Log subclassLog = LogFactory.getLog(this.getClass());
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
Map<String, String[]> map = req.getParameterMap(); Map<String, String[]> map = req.getParameterMap();
for (String key : map.keySet()) { for (String key : map.keySet()) {
String[] values = map.get(key); String[] values = map.get(key);
log.debug("Parameter '" + key + "' = " subclassLog.debug("Parameter '" + key + "' = "
+ Arrays.deepToString(values)); + Arrays.deepToString(values));
} }
} }

View file

@ -13,7 +13,14 @@ import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.Res
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
/** /**
* TODO * Handle the "Add new account" form display and submission.
*
* TODO Associate a profile from this account
*
* TODO Handle sending of email.
*
* TODO Handle initial password set if email isn't available. Set password
* fields, change-required flag, account is active.
*/ */
public class UserAccountsAddPage extends UserAccountsPage { public class UserAccountsAddPage extends UserAccountsPage {
private static final String PARAMETER_SUBMIT = "submitAdd"; private static final String PARAMETER_SUBMIT = "submitAdd";
@ -145,4 +152,20 @@ public class UserAccountsAddPage extends UserAccountsPage {
return new TemplateResponseValues(TEMPLATE_NAME, body); return new TemplateResponseValues(TEMPLATE_NAME, body);
} }
/**
* @return
*/
public UserAccount getAddedAccount() {
// TODO Auto-generated method stub
throw new RuntimeException("UserAccountsAddPage.getAddedAccount() not implemented.");
}
/**
* @return
*/
public boolean wasPasswordEmailSent() {
// TODO Auto-generated method stub
throw new RuntimeException("UserAccountsAddPage.wasPasswordEmailSent() not implemented.");
}
} }

View file

@ -9,7 +9,6 @@ import org.apache.commons.logging.LogFactory;
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions; import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.ManageUserAccounts; import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.ManageUserAccounts;
import edu.cornell.mannlib.vitro.webapp.beans.UserAccount;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerHttpServlet; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.FreemarkerHttpServlet;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
@ -49,7 +48,13 @@ public class UserAccountsController extends FreemarkerHttpServlet {
} }
} else if (ACTION_EDIT.equals(action)) { } else if (ACTION_EDIT.equals(action)) {
return new UserAccountsEditPage(vreq).showPage(); UserAccountsEditPage page = new UserAccountsEditPage(vreq);
page.parseParametersAndValidate();
if (page.isSubmit() && page.isValid()) {
return editAccountAndShowList(vreq, page);
} else {
return page.showPage();
}
} else if (ACTION_DELETE.equals(action)) { } else if (ACTION_DELETE.equals(action)) {
UserAccountsDeleter deleter = new UserAccountsDeleter(vreq); UserAccountsDeleter deleter = new UserAccountsDeleter(vreq);
@ -66,10 +71,18 @@ public class UserAccountsController extends FreemarkerHttpServlet {
private ResponseValues addAccountAndShowList(VitroRequest vreq, private ResponseValues addAccountAndShowList(VitroRequest vreq,
UserAccountsAddPage addPage) { UserAccountsAddPage addPage) {
UserAccount userAccount = addPage.createNewAccount(); addPage.createNewAccount();
UserAccountsListPage listPage = new UserAccountsListPage(vreq); UserAccountsListPage listPage = new UserAccountsListPage(vreq);
return listPage.showPageWithNewAccount(userAccount); return listPage.showPageWithNewAccount(addPage.getAddedAccount(),
addPage.wasPasswordEmailSent());
} }
private ResponseValues editAccountAndShowList(VitroRequest vreq,
UserAccountsEditPage editPage) {
editPage.updateAccount();
UserAccountsListPage listPage = new UserAccountsListPage(vreq);
return listPage.showPageWithUpdatedAccount(
editPage.getUpdatedAccount(), editPage.wasPasswordEmailSent());
}
} }

View file

@ -7,7 +7,9 @@ import java.util.Collection;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
/** /**
* TODO * TODO delete and kick to Accounts list with message, telling how many were
* deleted. If there was a problem, the user will need to infer it from the
* count??
*/ */
public class UserAccountsDeleter extends UserAccountsPage { public class UserAccountsDeleter extends UserAccountsPage {
@ -16,12 +18,13 @@ public class UserAccountsDeleter extends UserAccountsPage {
} }
/** /**
* @return * @return
* *
*/ */
public Collection<String> delete() { public Collection<String> delete() {
// TODO Auto-generated method stub // TODO Auto-generated method stub
throw new RuntimeException("UserAccountsDeleter.delete() not implemented."); throw new RuntimeException(
"UserAccountsDeleter.delete() not implemented.");
} }
} }

View file

@ -2,12 +2,23 @@
package edu.cornell.mannlib.vitro.webapp.controller.accounts; package edu.cornell.mannlib.vitro.webapp.controller.accounts;
import edu.cornell.mannlib.vitro.webapp.beans.UserAccount;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
/** /**
* TODO * TODO present the form. Get the submission.
*
* TODO If email is available, present the reset flag with message templage, and send email
*
* TODO if email is not available, allow password change with checks for validity
*
* TODO If successful, go to AccountsList with message and optional password message.
*
* TODO if unsuccessful, go back to the page, with errors.
*
* TODO How much of this can be shared with AddPage? Email templates?
*/ */
public class UserAccountsEditPage extends UserAccountsPage { public class UserAccountsEditPage extends UserAccountsPage {
private static final String TEMPLATE_NAME = "userAccounts-edit.ftl"; private static final String TEMPLATE_NAME = "userAccounts-edit.ftl";
@ -20,5 +31,53 @@ public class UserAccountsEditPage extends UserAccountsPage {
return new TemplateResponseValues(TEMPLATE_NAME); return new TemplateResponseValues(TEMPLATE_NAME);
} }
/**
* @return
*/
public UserAccount updateAccount() {
// TODO Auto-generated method stub
throw new RuntimeException("UserAccountsEditPage.updateAccount() not implemented.");
}
/**
* @return
*/
public boolean wasPasswordEmailSent() {
// TODO Auto-generated method stub
throw new RuntimeException("UserAccountsEditPage.wasPasswordEmailSent() not implemented.");
}
/**
* @return
*/
public UserAccount getUpdatedAccount() {
// TODO Auto-generated method stub
throw new RuntimeException("UserAccountsEditPage.getUpdatedAccount() not implemented.");
}
/**
*
*/
public void parseParametersAndValidate() {
// TODO Auto-generated method stub
throw new RuntimeException("UserAccountsEditPage.parseParametersAndValidate() not implemented.");
}
/**
* @return
*/
public boolean isValid() {
// TODO Auto-generated method stub
throw new RuntimeException("UserAccountsEditPage.isValid() not implemented.");
}
/**
* @return
*/
public boolean isSubmit() {
// TODO Auto-generated method stub
throw new RuntimeException("UserAccountsEditPage.isSubmit() not implemented.");
}
} }

View file

@ -27,6 +27,11 @@ import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.Tem
/** /**
* Handle the List page. * Handle the List page.
*
* TODO: agree with Manolo how to do the column heads as links that change the
* sort order
*
* TODO: auto-complete
*/ */
public class UserAccountsListPage extends UserAccountsPage { public class UserAccountsListPage extends UserAccountsPage {
private static final Log log = LogFactory private static final Log log = LogFactory
@ -87,7 +92,8 @@ public class UserAccountsListPage extends UserAccountsPage {
/** /**
* We just came from adding a new account. Show the list with a message. * We just came from adding a new account. Show the list with a message.
*/ */
public ResponseValues showPageWithNewAccount(UserAccount userAccount) { public ResponseValues showPageWithNewAccount(UserAccount userAccount,
boolean emailWasSent) {
UserAccountsSelection selection = UserAccountsSelector.select( UserAccountsSelection selection = UserAccountsSelector.select(
userAccountsModel, criteria); userAccountsModel, criteria);
Map<String, Object> body = buildTemplateBodyMap(selection); Map<String, Object> body = buildTemplateBodyMap(selection);
@ -98,6 +104,15 @@ public class UserAccountsListPage extends UserAccountsPage {
return new TemplateResponseValues(TEMPLATE_NAME, body); return new TemplateResponseValues(TEMPLATE_NAME, body);
} }
/**
* We just came from editing an account. Show the list with a message.
*/
public ResponseValues showPageWithUpdatedAccount(UserAccount userAccount,
boolean emailWasSent) {
throw new RuntimeException(
"UserAccountsListPage.showPageWithUpdatedAccount not implemented.");
}
/** /**
* We just came from deleting accounts. Show the list with a message. * We just came from deleting accounts. Show the list with a message.
*/ */

View file

@ -0,0 +1,21 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.controller.accounts;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
/**
* TODO If hash is not valid display bogus message.
*
* TODO Set the password fields, reset the expire time, set account active, kick
* to home page with message. Send confirmation email.
*
* TODO How do we know "createPassword" from "setPassword"? a parameter? or just by account status?
*/
public class UserAccountsSetPasswordPage extends UserAccountsPage {
protected UserAccountsSetPasswordPage(VitroRequest vreq) {
super(vreq);
}
}

View file

@ -21,6 +21,11 @@ import com.hp.hpl.jena.ontology.DatatypeProperty;
import com.hp.hpl.jena.ontology.OntModel; import com.hp.hpl.jena.ontology.OntModel;
import com.hp.hpl.jena.ontology.OntProperty; import com.hp.hpl.jena.ontology.OntProperty;
import com.hp.hpl.jena.ontology.OntResource; import com.hp.hpl.jena.ontology.OntResource;
import com.hp.hpl.jena.query.Dataset;
import com.hp.hpl.jena.query.QueryExecutionFactory;
import com.hp.hpl.jena.query.QueryFactory;
import com.hp.hpl.jena.query.QuerySolution;
import com.hp.hpl.jena.query.ResultSet;
import com.hp.hpl.jena.rdf.model.Literal; import com.hp.hpl.jena.rdf.model.Literal;
import com.hp.hpl.jena.rdf.model.Model; import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory; import com.hp.hpl.jena.rdf.model.ModelFactory;
@ -45,7 +50,10 @@ import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.Actions;
import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.EditOntology; import edu.cornell.mannlib.vitro.webapp.auth.requestedAction.usepages.EditOntology;
import edu.cornell.mannlib.vitro.webapp.controller.Controllers; import edu.cornell.mannlib.vitro.webapp.controller.Controllers;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.dao.jena.ModelContext;
import edu.cornell.mannlib.vitro.webapp.dao.jena.event.EditEvent; import edu.cornell.mannlib.vitro.webapp.dao.jena.event.EditEvent;
import edu.cornell.mannlib.vitro.webapp.servlet.setup.FileGraphSetup;
import edu.cornell.mannlib.vitro.webapp.servlet.setup.JenaDataSourceSetupBase;
public class RefactorOperationController extends BaseEditController { public class RefactorOperationController extends BaseEditController {
@ -68,17 +76,7 @@ public class RefactorOperationController extends BaseEditController {
OntModel ontModel = (OntModel) getServletContext().getAttribute("baseOntModel"); OntModel ontModel = (OntModel) getServletContext().getAttribute("baseOntModel");
ontModel.enterCriticalSection(Lock.WRITE); ontModel.enterCriticalSection(Lock.WRITE);
ArrayList<String> results = new ArrayList<String>(); ArrayList<String> results = new ArrayList<String>();
/* Debugging code thats inserts invalid triples into model
Property hasTitle = ontModel.getProperty("http://www.owl-ontologies.com/Ontology1209425965.owl#hasTitleee");
Resource product = ontModel.createResource("http://www.owl-ontologies.com/Ontology1209425965.owl#someBook14");
Resource product2 = ontModel.createResource("http://www.owl-ontologies.com/Ontology1209425965.owl#someBook15");
Literal illegalLiteral = ontModel.createTypedLiteral(134);
Literal illegalLiteral2 = ontModel.createTypedLiteral(234);
ontModel.add(product, hasTitle, illegalLiteral);
ontModel.add(product2, hasTitle, illegalLiteral2);
*/
try try
{ {
ExtendedIterator dataProperties = ontModel.listDatatypeProperties(); ExtendedIterator dataProperties = ontModel.listDatatypeProperties();
@ -180,12 +178,10 @@ public class RefactorOperationController extends BaseEditController {
return ""; return "";
} }
private String doRenameResource(VitroRequest request, HttpServletResponse response, EditProcessObject epo) { private String doRenameResource(VitroRequest request, HttpServletResponse response, EditProcessObject epo) {
String userURI = LoginStatusBean.getBean(request).getUserURI(); String userURI = LoginStatusBean.getBean(request).getUserURI();
OntModel ontModel = (OntModel) getServletContext().getAttribute("baseOntModel");
String oldURIStr = (String) epo.getAttribute("oldURI"); String oldURIStr = (String) epo.getAttribute("oldURI");
String newURIStr = request.getParameter("newURI"); String newURIStr = request.getParameter("newURI");
@ -213,40 +209,44 @@ public class RefactorOperationController extends BaseEditController {
} }
return "STOP"; return "STOP";
} }
ontModel.enterCriticalSection(Lock.WRITE); // find the models that the resource is referred to in and change
ontModel.getBaseModel().notifyEvent(new EditEvent(userURI,true)); // the name in each of those models.
try { String queryStr = "SELECT distinct ?graph WHERE {{ GRAPH ?graph { ?subj <" + oldURIStr + "> ?obj }} ";
Property prop = ontModel.getProperty(oldURIStr); queryStr += " union { GRAPH ?graph { <" + oldURIStr + "> ?prop ?obj }} ";
if(prop != null) queryStr += " union { GRAPH ?graph { ?subj ?prop <" + oldURIStr + ">}}}";
{ Dataset dataset = request.getDataset();
try {
Property newProp = ontModel.createProperty(newURIStr); dataset.getLock().enterCriticalSection(Lock.READ);
StmtIterator statements = ontModel.listStatements(null, prop, (RDFNode)null); try {
try { ResultSet resultSet = QueryExecutionFactory.create(QueryFactory.create(queryStr), dataset).execSelect();
while(statements.hasNext()) {
Statement statement = (Statement)statements.next(); while (resultSet.hasNext()) {
Resource subj = statement.getSubject(); QuerySolution qs = resultSet.next();
RDFNode obj = statement.getObject(); String graphURI = qs.get("graph").asNode().toString();
Statement newStatement = ontModel.createStatement(subj, newProp, obj);
ontModel.add(newStatement); if (graphURI.startsWith(FileGraphSetup.FILEGRAPH_URI_ROOT)) {
} continue;
} finally { }
if (statements != null) {
statements.close(); boolean doNotify = false;
} Model model = null;
}
ontModel.remove(ontModel.listStatements(null, prop, (RDFNode)null)); if (JenaDataSourceSetupBase.JENA_TBOX_ASSERTIONS_MODEL.equals(graphURI)) {
} catch (InvalidPropertyURIException ipue) { model = ModelContext.getBaseOntModelSelector(getServletContext()).getTBoxModel();
/* if it can't be a property, don't bother with predicates */ doNotify = true;
} } else if (JenaDataSourceSetupBase.JENA_DB_MODEL.equals(graphURI)) {
Resource res = ontModel.getResource(oldURIStr); model = ModelContext.getBaseOntModelSelector(getServletContext()).getABoxModel();
ResourceUtils.renameResource(res,newURIStr); doNotify = true;
} } else {
} finally { model = dataset.getNamedModel(graphURI);
ontModel.getBaseModel().notifyEvent(new EditEvent(userURI,false)); }
ontModel.leaveCriticalSection();
} renameResourceInModel(model, userURI, oldURIStr, newURIStr, doNotify);
}
} finally {
dataset.getLock().leaveCriticalSection();
}
// there are no statements to delete, but we want indexes updated appropriately // there are no statements to delete, but we want indexes updated appropriately
request.getFullWebappDaoFactory().getIndividualDao().deleteIndividual(oldURIStr); request.getFullWebappDaoFactory().getIndividualDao().deleteIndividual(oldURIStr);
@ -275,6 +275,50 @@ public class RefactorOperationController extends BaseEditController {
} }
private void renameResourceInModel(Model model, String userURI, String oldURIStr, String newURIStr, boolean doNotify) {
model.enterCriticalSection(Lock.WRITE);
if (doNotify) {
model.notifyEvent(new EditEvent(userURI,true));
}
try {
Property prop = model.getProperty(oldURIStr); // this will create a resource if there isn't
// one by this URI (we don't expect this to happen
// and will also return a resource if the given
// URI is the URI of a class.
try {
Property newProp = model.createProperty(newURIStr);
StmtIterator statements = model.listStatements(null, prop, (RDFNode)null);
try {
while(statements.hasNext()) {
Statement statement = (Statement)statements.next();
Resource subj = statement.getSubject();
RDFNode obj = statement.getObject();
Statement newStatement = model.createStatement(subj, newProp, obj);
model.add(newStatement);
}
} finally {
if (statements != null) {
statements.close();
}
}
model.remove(model.listStatements(null, prop, (RDFNode)null));
} catch (InvalidPropertyURIException ipue) {
/* if it can't be a property, don't bother with predicates */
}
Resource res = model.getResource(oldURIStr);
ResourceUtils.renameResource(res,newURIStr);
} finally {
if (doNotify) {
model.notifyEvent(new EditEvent(userURI,false));
}
model.leaveCriticalSection();
}
}
private void doMovePropertyStatements(VitroRequest request, HttpServletResponse response, EditProcessObject epo) { private void doMovePropertyStatements(VitroRequest request, HttpServletResponse response, EditProcessObject epo) {
String userURI = LoginStatusBean.getBean(request).getUserURI(); String userURI = LoginStatusBean.getBean(request).getUserURI();

View file

@ -125,7 +125,7 @@ public class IndividualListController extends FreemarkerHttpServlet {
body.put("subtitle", vclass.getName()); body.put("subtitle", vclass.getName());
} }
body.put("title", title); body.put("title", title);
body.put("redirecturl", vreq.getContextPath()+"/entityurl/"); body.put("rdfUrl", vreq.getContextPath()+"/listrdf/");
getServletContext().setAttribute("classuri", vclass.getURI()); getServletContext().setAttribute("classuri", vclass.getURI());
} }

View file

@ -15,18 +15,12 @@ import javax.servlet.ServletException;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.apache.lucene.document.Document;
import org.apache.lucene.index.CorruptIndexException; import org.apache.lucene.index.CorruptIndexException;
import org.apache.lucene.index.Term; import org.apache.solr.client.solrj.SolrQuery;
import org.apache.lucene.search.BooleanClause; import org.apache.solr.client.solrj.SolrServer;
import org.apache.lucene.search.BooleanQuery; import org.apache.solr.client.solrj.response.QueryResponse;
import org.apache.lucene.search.IndexSearcher; import org.apache.solr.common.SolrDocument;
import org.apache.lucene.search.PrefixQuery; import org.apache.solr.common.SolrDocumentList;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.ScoreDoc;
import org.apache.lucene.search.Sort;
import org.apache.lucene.search.TermQuery;
import org.apache.lucene.search.TopDocs;
import edu.cornell.mannlib.vitro.webapp.beans.Individual; import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.beans.VClass; import edu.cornell.mannlib.vitro.webapp.beans.VClass;
@ -36,8 +30,8 @@ import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.Exc
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.ResponseValues;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues; import edu.cornell.mannlib.vitro.webapp.controller.freemarker.responsevalues.TemplateResponseValues;
import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao; import edu.cornell.mannlib.vitro.webapp.dao.IndividualDao;
import edu.cornell.mannlib.vitro.webapp.search.lucene.Entity2LuceneDoc; import edu.cornell.mannlib.vitro.webapp.search.lucene.Entity2LuceneDoc.VitroLuceneTermNames;
import edu.cornell.mannlib.vitro.webapp.search.lucene.LuceneIndexFactory; import edu.cornell.mannlib.vitro.webapp.search.solr.SolrSetup;
import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.ListedIndividualTemplateModel; import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individual.ListedIndividualTemplateModel;
import freemarker.ext.beans.BeansWrapper; import freemarker.ext.beans.BeansWrapper;
import freemarker.template.TemplateModel; import freemarker.template.TemplateModel;
@ -62,7 +56,6 @@ public class SolrIndividualListController extends FreemarkerHttpServlet {
String templateName = TEMPLATE_DEFAULT; String templateName = TEMPLATE_DEFAULT;
Map<String, Object> body = new HashMap<String, Object>(); Map<String, Object> body = new HashMap<String, Object>();
String errorMessage = null; String errorMessage = null;
String message = null;
try { try {
Object obj = vreq.getAttribute("vclass"); Object obj = vreq.getAttribute("vclass");
@ -78,7 +71,7 @@ public class SolrIndividualListController extends FreemarkerHttpServlet {
errorMessage = "Class " + vitroClassIdStr + " not found"; errorMessage = "Class " + vitroClassIdStr + " not found";
} }
} catch (Exception ex) { } catch (Exception ex) {
throw new HelpException("IndividualListController: request parameter 'vclassId' must be a URI string."); throw new HelpException("IndividualListController: url parameter 'vclassId' must be a URI string.");
} }
} }
} else if (obj instanceof VClass) { } else if (obj instanceof VClass) {
@ -101,14 +94,16 @@ public class SolrIndividualListController extends FreemarkerHttpServlet {
getServletContext()); getServletContext());
body.putAll(map); body.putAll(map);
@SuppressWarnings("unchecked")
List<Individual> inds = (List<Individual>)map.get("entities"); List<Individual> inds = (List<Individual>)map.get("entities");
List<ListedIndividualTemplateModel> indsTm = new ArrayList<ListedIndividualTemplateModel>(); List<ListedIndividualTemplateModel> indsTm = new ArrayList<ListedIndividualTemplateModel>();
for(Individual ind : inds ){ for ( Individual ind : inds ) {
indsTm.add(new ListedIndividualTemplateModel(ind,vreq)); indsTm.add(new ListedIndividualTemplateModel(ind,vreq));
} }
body.put("individuals", indsTm); body.put("individuals", indsTm);
List<TemplateModel> wpages = new ArrayList<TemplateModel>(); List<TemplateModel> wpages = new ArrayList<TemplateModel>();
@SuppressWarnings("unchecked")
List<PageRecord> pages = (List<PageRecord>)body.get("pages"); List<PageRecord> pages = (List<PageRecord>)body.get("pages");
BeansWrapper wrapper = new BeansWrapper(); BeansWrapper wrapper = new BeansWrapper();
for( PageRecord pr: pages ){ for( PageRecord pr: pages ){
@ -125,10 +120,10 @@ public class SolrIndividualListController extends FreemarkerHttpServlet {
body.put("subtitle", vclass.getName()); body.put("subtitle", vclass.getName());
} }
body.put("title", title); body.put("title", title);
body.put("redirecturl", vreq.getContextPath()+"/entityurl/"); body.put("rdfUrl", vreq.getContextPath() + "/listrdf/" + vclass.getLocalName() + ".rdf");
getServletContext().setAttribute("classuri", vclass.getURI()); getServletContext().setAttribute("classuri", vclass.getURI());
} }
} catch (HelpException help){ } catch (HelpException help){
errorMessage = "Request attribute 'vclass' or request parameter 'vclassId' must be set before calling. Its value must be a class uri."; errorMessage = "Request attribute 'vclass' or request parameter 'vclassId' must be set before calling. Its value must be a class uri.";
} catch (Throwable e) { } catch (Throwable e) {
@ -138,10 +133,8 @@ public class SolrIndividualListController extends FreemarkerHttpServlet {
if (errorMessage != null) { if (errorMessage != null) {
templateName = Template.ERROR_MESSAGE.toString(); templateName = Template.ERROR_MESSAGE.toString();
body.put("errorMessage", errorMessage); body.put("errorMessage", errorMessage);
} else if (message != null) {
body.put("message", message);
} }
return new TemplateResponseValues(templateName, body); return new TemplateResponseValues(templateName, body);
} }
@ -175,163 +168,148 @@ public class SolrIndividualListController extends FreemarkerHttpServlet {
* This method is now called in a couple of places. It should be refactored * This method is now called in a couple of places. It should be refactored
* into a DAO or similar object. * into a DAO or similar object.
*/ */
public static Map<String,Object> getResultsForVClass(String vclassURI, int page, String alpha, IndividualDao indDao, ServletContext context) public static Map<String,Object> getResultsForVClass(String vclassURI, int page, String alpha, IndividualDao indDao, ServletContext context)
throws CorruptIndexException, IOException, ServletException{ throws CorruptIndexException, IOException, ServletException {
Map<String,Object> rvMap = new HashMap<String,Object>(); Map<String,Object> rvMap = new HashMap<String,Object>();
//make lucene query for this rdf:type
Query query = getQuery(vclassURI, alpha);
//execute lucene query for individuals of the specified type
IndexSearcher index = LuceneIndexFactory.getIndexSearcher(context);
TopDocs docs = null;
try{
docs = index.search(query, null,
ENTITY_LIST_CONTROLLER_MAX_RESULTS,
new Sort(Entity2LuceneDoc.term.NAME_LOWERCASE));
}catch(Throwable th){
log.error("Could not run search. " + th.getMessage());
docs = null;
}
if( docs == null )
throw new ServletException("Could not run search in IndividualListController");
//get list of individuals for the search results
int size = docs.totalHits;
log.debug("Number of search results: " + size);
// don't get all the results, only get results for the requestedSize
List<Individual> individuals = new ArrayList<Individual>(INDIVIDUALS_PER_PAGE);
int individualsAdded = 0;
int ii = (page-1)*INDIVIDUALS_PER_PAGE;
while( individualsAdded < INDIVIDUALS_PER_PAGE && ii < size ){
ScoreDoc hit = docs.scoreDocs[ii];
if (hit != null) {
Document doc = index.doc(hit.doc);
if (doc != null) {
String uri = doc.getField(Entity2LuceneDoc.term.URI).stringValue();
Individual ind = indDao.getIndividualByURI( uri );
if( ind != null ){
individuals.add( ind );
individualsAdded++;
}
} else {
log.warn("no document found for lucene doc id " + hit.doc);
}
} else {
log.debug("hit was null");
}
ii++;
}
rvMap.put("count", size);
if( size > INDIVIDUALS_PER_PAGE ){
rvMap.put("showPages", Boolean.TRUE);
List<PageRecord> pageRecords = makePagesList(size, INDIVIDUALS_PER_PAGE, page);
rvMap.put("pages", pageRecords);
}else{
rvMap.put("showPages", Boolean.FALSE);
rvMap.put("pages", Collections.emptyList());
}
rvMap.put("alpha",alpha);
rvMap.put("totalCount", size);
rvMap.put("entities",individuals);
if (individuals == null)
log.debug("entities list is null for vclass " + vclassURI );
return rvMap;
}
private static BooleanQuery getQuery(String vclassUri, String alpha){
BooleanQuery query = new BooleanQuery();
try{
//query term for rdf:type
query.add(
new TermQuery( new Term(Entity2LuceneDoc.term.RDFTYPE, vclassUri)),
BooleanClause.Occur.MUST );
//Add alpha filter if it is needed
Query alphaQuery = null;
if( alpha != null && !"".equals(alpha) && alpha.length() == 1){
alphaQuery =
new PrefixQuery(new Term(Entity2LuceneDoc.term.NAME_LOWERCASE, alpha.toLowerCase()));
query.add(alphaQuery,BooleanClause.Occur.MUST);
}
log.debug("Query: " + query);
return query;
} catch (Exception ex){
log.error(ex,ex);
return new BooleanQuery();
}
}
public static List<PageRecord> makePagesList( int count, int pageSize, int selectedPage){ // Make solr query for this rdf:type
SolrQuery query = getQuery(vclassURI, alpha, page);
SolrServer solr = SolrSetup.getSolrServer(context);
QueryResponse response = null;
// Execute query for individuals of the specified type
try {
response = solr.query(query);
} catch (Throwable t) {
log.error(t, t);
}
if ( response == null ) {
throw new ServletException("Could not run search in IndividualListController");
}
SolrDocumentList docs = response.getResults();
if (docs == null) {
throw new ServletException("Could not run search in IndividualListController");
}
// get list of individuals for the search results
long size = docs.getNumFound();
log.debug("Number of search results: " + size);
List<Individual> individuals = new ArrayList<Individual>();
for (SolrDocument doc : docs) {
String uri = doc.get(VitroLuceneTermNames.URI).toString();
Individual individual = indDao.getIndividualByURI( uri );
if (individual != null) {
individuals.add(individual);
}
}
rvMap.put("count", size);
List<PageRecord> records = new ArrayList<PageRecord>( MAX_PAGES + 1 ); if( size > INDIVIDUALS_PER_PAGE ){
int requiredPages = count/pageSize ; rvMap.put("showPages", Boolean.TRUE);
int remainder = count % pageSize ; List<PageRecord> pageRecords = makePagesList(size, INDIVIDUALS_PER_PAGE, page);
if( remainder > 0 ) rvMap.put("pages", pageRecords);
requiredPages++; }else{
rvMap.put("showPages", Boolean.FALSE);
rvMap.put("pages", Collections.emptyList());
}
rvMap.put("alpha",alpha);
rvMap.put("totalCount", size);
rvMap.put("entities",individuals);
if (individuals.isEmpty())
log.debug("entities list is empty for vclass " + vclassURI );
if( selectedPage < MAX_PAGES && requiredPages > MAX_PAGES ){ return rvMap;
//the selected pages is within the first maxPages, just show the normal pages up to maxPages. }
for(int page = 1; page < requiredPages && page <= MAX_PAGES ; page++ ){
records.add( new PageRecord( "page=" + page, Integer.toString(page), Integer.toString(page), selectedPage == page ) ); private static SolrQuery getQuery(String vclassUri, String alpha, int page){
}
records.add( new PageRecord( "page="+ (MAX_PAGES+1), Integer.toString(MAX_PAGES+1), "more...", false)); String queryStr = VitroLuceneTermNames.RDFTYPE + ":\"" + vclassUri + "\"";
}else if( requiredPages > MAX_PAGES && selectedPage+1 > MAX_PAGES && selectedPage < requiredPages - MAX_PAGES){
//the selected pages is in the middle of the list of page // Add alpha filter if it is needed
int startPage = selectedPage - MAX_PAGES / 2; if ( alpha != null && !"".equals(alpha) && alpha.length() == 1) {
int endPage = selectedPage + MAX_PAGES / 2; queryStr += VitroLuceneTermNames.NAME_LOWERCASE + ":" + alpha.toLowerCase() + "*";
for(int page = startPage; page <= endPage ; page++ ){ }
records.add( new PageRecord( "page=" + page, Integer.toString(page), Integer.toString(page), selectedPage == page ) );
} SolrQuery query = new SolrQuery(queryStr);
records.add( new PageRecord( "page="+ endPage+1, Integer.toString(endPage+1), "more...", false));
}else if ( requiredPages > MAX_PAGES && selectedPage > requiredPages - MAX_PAGES ){ int start = (page-1)*INDIVIDUALS_PER_PAGE;
//the selected page is in the end of the list query.setStart(start)
int startPage = requiredPages - MAX_PAGES; .setRows(INDIVIDUALS_PER_PAGE)
double max = Math.ceil(count/pageSize); .setSortField(VitroLuceneTermNames.NAME_LOWERCASE_SINGLE_VALUED, SolrQuery.ORDER.asc);
for(int page = startPage; page <= max; page++ ){
records.add( new PageRecord( "page=" + page, Integer.toString(page), Integer.toString(page), selectedPage == page ) ); log.debug("Query: " + query);
} return query;
}else{ }
//there are fewer than maxPages pages.
for(int i = 1; i <= requiredPages; i++ ){ public static List<PageRecord> makePagesList( long size, int pageSize, int selectedPage ) {
records.add( new PageRecord( "page=" + i, Integer.toString(i), Integer.toString(i), selectedPage == i ) );
List<PageRecord> records = new ArrayList<PageRecord>( MAX_PAGES + 1 );
int requiredPages = (int) (size/pageSize) ;
int remainder = (int) (size % pageSize) ;
if( remainder > 0 )
requiredPages++;
if( selectedPage < MAX_PAGES && requiredPages > MAX_PAGES ){
//the selected pages is within the first maxPages, just show the normal pages up to maxPages.
for(int page = 1; page < requiredPages && page <= MAX_PAGES ; page++ ){
records.add( new PageRecord( "page=" + page, Integer.toString(page), Integer.toString(page), selectedPage == page ) );
}
records.add( new PageRecord( "page="+ (MAX_PAGES+1), Integer.toString(MAX_PAGES+1), "more...", false));
}else if( requiredPages > MAX_PAGES && selectedPage+1 > MAX_PAGES && selectedPage < requiredPages - MAX_PAGES){
//the selected pages is in the middle of the list of page
int startPage = selectedPage - MAX_PAGES / 2;
int endPage = selectedPage + MAX_PAGES / 2;
for(int page = startPage; page <= endPage ; page++ ){
records.add( new PageRecord( "page=" + page, Integer.toString(page), Integer.toString(page), selectedPage == page ) );
}
records.add( new PageRecord( "page="+ endPage+1, Integer.toString(endPage+1), "more...", false));
}else if ( requiredPages > MAX_PAGES && selectedPage > requiredPages - MAX_PAGES ){
//the selected page is in the end of the list
int startPage = requiredPages - MAX_PAGES;
double max = Math.ceil(size/pageSize);
for(int page = startPage; page <= max; page++ ){
records.add( new PageRecord( "page=" + page, Integer.toString(page), Integer.toString(page), selectedPage == page ) );
}
}else{
//there are fewer than maxPages pages.
for(int i = 1; i <= requiredPages; i++ ){
records.add( new PageRecord( "page=" + i, Integer.toString(i), Integer.toString(i), selectedPage == i ) );
} }
} }
return records; return records;
} }
public static class PageRecord { public static class PageRecord {
public PageRecord(String param, String index, String text, boolean selected) { public PageRecord(String param, String index, String text, boolean selected) {
this.param = param; this.param = param;
this.index = index; this.index = index;
this.text = text; this.text = text;
this.selected = selected; this.selected = selected;
} }
public String param; public String param;
public String index; public String index;
public String text; public String text;
public boolean selected=false; public boolean selected=false;
public String getParam() { public String getParam() {
return param; return param;
} }
public String getIndex() { public String getIndex() {
return index; return index;
} }
public String getText() { public String getText() {
return text; return text;
} }
public boolean getSelected(){ public boolean getSelected(){
return selected; return selected;
} }
} }
} }

View file

@ -114,7 +114,6 @@ public class SolrAutocompleteController extends VitroAjaxController {
} }
} }
// Since SolrQuery.setSortField() is buggy, sort the results here
Collections.sort(results); Collections.sort(results);
// map.put("results", results); // map.put("results", results);
@ -157,8 +156,9 @@ public class SolrAutocompleteController extends VitroAjaxController {
} }
query.setFields(VitroLuceneTermNames.NAME_RAW, VitroLuceneTermNames.URI); // fields to retrieve query.setFields(VitroLuceneTermNames.NAME_RAW, VitroLuceneTermNames.URI); // fields to retrieve
// Solr bug: generates sort=nameLowercase asc instead of sort=nameLowercase+asc
//.setSortField(VitroLuceneTermNames.NAME_LOWERCASE, SolrQuery.ORDER.asc); // Can't sort on multivalued field, so sort results in Java when we get them
// query.setSortField(VitroLuceneTermNames.NAME_LOWERCASE, SolrQuery.ORDER.asc);
return query; return query;
} }
@ -187,6 +187,7 @@ public class SolrAutocompleteController extends VitroAjaxController {
// RY 5/18/2011 For now, just doing untokenized query, due to the interactions of wildcard // RY 5/18/2011 For now, just doing untokenized query, due to the interactions of wildcard
// query and stemming described below. Need to find a way to do this in Solr. // query and stemming described below. Need to find a way to do this in Solr.
// Should take the same approach if we can figure out how to do a disjunction. // Should take the same approach if we can figure out how to do a disjunction.
// Probably just add an explicit "OR" between the terms.
// String stemParam = (String) request.getParameter("stem"); // String stemParam = (String) request.getParameter("stem");
// boolean stem = "true".equals(stemParam); // boolean stem = "true".equals(stemParam);

View file

@ -174,11 +174,7 @@ public class SolrPagedSearchController extends FreemarkerHttpServlet {
log.debug("Query text is \""+ qtxt + "\""); log.debug("Query text is \""+ qtxt + "\"");
SolrQuery query = getQuery(qtxt, maxHitCount, vreq); SolrQuery query = getQuery(qtxt, maxHitCount, vreq);
// ** For xml requested, add version=2.2 for xml version
// is that enough, or do we also have to add wt param?
SolrServer solr = SolrSetup.getSolrServer(getServletContext()); SolrServer solr = SolrSetup.getSolrServer(getServletContext());
QueryResponse response = null; QueryResponse response = null;

View file

@ -86,6 +86,10 @@ public class Entity2LuceneDoc implements Obj2DocIface{
/** rdfs:label lowercased, no tokenizing, no stop words, no stemming **/ /** rdfs:label lowercased, no tokenizing, no stop words, no stemming **/
public static String NAME_LOWERCASE = "nameLowercase"; // was NAMELOWERCASE public static String NAME_LOWERCASE = "nameLowercase"; // was NAMELOWERCASE
/** Same as NAME_LOWERCASE, but single-valued so it's sortable. **/
// RY Need to control how indexing selects which of multiple values to copy.
public static String NAME_LOWERCASE_SINGLE_VALUED = "nameLowercaseSingleValued";
/** rdfs:label lowercased, tokenized, stop words, no stemming. /** rdfs:label lowercased, tokenized, stop words, no stemming.
* Used for autocomplete matching on proper names. **/ * Used for autocomplete matching on proper names. **/
public static String AC_NAME_UNSTEMMED = "acNameUnstemmed"; // was NAMEUNSTEMMED public static String AC_NAME_UNSTEMMED = "acNameUnstemmed"; // was NAMEUNSTEMMED

View file

@ -32,10 +32,10 @@ import edu.cornell.mannlib.vitro.webapp.dao.jena.OntModelSelectorImpl;
public class FileGraphSetup implements ServletContextListener { public class FileGraphSetup implements ServletContextListener {
private static String ABOX = "abox"; private static final String ABOX = "abox";
private static String TBOX = "tbox"; private static final String TBOX = "tbox";
private static String PATH_ROOT = "/WEB-INF/filegraph/"; private static final String PATH_ROOT = "/WEB-INF/filegraph/";
private static String URI_ROOT = "http://vitro.mannlib.cornell.edu/filegraph/"; public static final String FILEGRAPH_URI_ROOT = "http://vitro.mannlib.cornell.edu/filegraph/";
private static final Log log = LogFactory.getLog(FileGraphSetup.class); private static final Log log = LogFactory.getLog(FileGraphSetup.class);
@ -189,7 +189,7 @@ public class FileGraphSetup implements ServletContextListener {
*/ */
public void cleanupDB(Store kbStore, Set<String> uriSet, String type) { public void cleanupDB(Store kbStore, Set<String> uriSet, String type) {
Pattern graphURIPat = Pattern.compile("^" + URI_ROOT + type); Pattern graphURIPat = Pattern.compile("^" + FILEGRAPH_URI_ROOT + type);
Iterator<Node> iter = StoreUtils.storeGraphNames(kbStore); Iterator<Node> iter = StoreUtils.storeGraphNames(kbStore);
@ -237,7 +237,7 @@ public class FileGraphSetup implements ServletContextListener {
if (path != null) { if (path != null) {
File file = new File(path); File file = new File(path);
uri = URI_ROOT + type + "/" + file.getName(); uri = FILEGRAPH_URI_ROOT + type + "/" + file.getName();
} }
return uri; return uri;

View file

@ -80,6 +80,7 @@ public class JenaDataSourceSetupSDB extends JenaDataSourceSetupBase implements j
//memModel.writeAll(System.out,"N3",null); //memModel.writeAll(System.out,"N3",null);
/* commenting out during development of 1.3 - this will be redone.
if ( updateRequired(ctx, memModel)) { if ( updateRequired(ctx, memModel)) {
log.error(getMigrationErrString()); log.error(getMigrationErrString());
System.out.println(getMigrationErrString()); System.out.println(getMigrationErrString());
@ -88,6 +89,7 @@ public class JenaDataSourceSetupSDB extends JenaDataSourceSetupBase implements j
AbortStartup.abortStartup(ctx); AbortStartup.abortStartup(ctx);
throw new MigrationRequiredError(getMigrationErrString()); throw new MigrationRequiredError(getMigrationErrString());
} }
*/
if (memModel == null) { if (memModel == null) {
memModel = ModelFactory.createOntologyModel(MEM_ONT_MODEL_SPEC); memModel = ModelFactory.createOntologyModel(MEM_ONT_MODEL_SPEC);

View file

@ -7,7 +7,7 @@
${stylesheets.add('<link rel="stylesheet" href="${urls.base}/css/browseIndex.css" />')} ${stylesheets.add('<link rel="stylesheet" href="${urls.base}/css/browseIndex.css" />')}
<section class="individualList"> <section class="individualList">
<h2>${title} <span class="rdfLink"><a class="icon-rdf" href="${redirecturl}" title="View the ${title} list in RDF format">RDF</a></span></h2> <h2>${title} <span class="rdfLink"><a class="icon-rdf" href="${rdfUrl}" title="View the ${title} list in RDF format">RDF</a></span></h2>
<#if subtitle??> <#if subtitle??>
<h4>${subtitle}</h4> <h4>${subtitle}</h4>
</#if> </#if>