VIVO-396 Obtain preferred title from VCard

This commit is contained in:
j2blake 2013-10-28 11:58:45 -04:00
parent 2026a40943
commit 02525c7d6b
2 changed files with 7 additions and 12 deletions

View file

@ -8,11 +8,9 @@ import java.util.Map;
import org.json.JSONException;
import org.json.JSONObject;
import edu.cornell.mannlib.vitro.webapp.beans.DataProperty;
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder;
import edu.cornell.mannlib.vitro.webapp.controller.json.JsonServlet;
import edu.cornell.mannlib.vitro.webapp.dao.ObjectPropertyStatementDao;
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
@ -27,11 +25,6 @@ public class IndividualJsonWrapper {
// need an unfiltered dao to get firstnames and lastnames
WebappDaoFactory fullWdf = vreq.getUnfilteredWebappDaoFactory();
// TODO -- get this VIVO property out of Vitro code!
DataProperty preferredTitleDp = (new DataProperty());
preferredTitleDp
.setURI("http://vivoweb.org/ontology/core#preferredTitle");
JSONObject jo = new JSONObject();
jo.put("URI", ind.getURI());
jo.put("label", ind.getRdfsLabel());
@ -40,8 +33,6 @@ public class IndividualJsonWrapper {
jo.put("imageUrl", ind.getImageUrl());
jo.put("profileUrl", UrlBuilder.getIndividualProfileUrl(ind, vreq));
jo.put("mostSpecificTypes", getMostSpecificTypes(ind, fullWdf));
jo.put("preferredTitle", JsonServlet.getDataPropertyValue(ind,
preferredTitleDp, fullWdf));
return jo;
}

View file

@ -439,9 +439,13 @@ public class FakeApplicationOntologyService {
* "display model". The query finds a preferred title for the individual.
*/
private static class FakeVivoPeopleDataGetter extends SparqlQueryDataGetter {
private static final String QUERY_STRING = "SELECT ?uri ?pt WHERE {\n"
+ " ?uri <http://vivoweb.org/ontology/core#preferredTitle> ?pt\n"
+ "} LIMIT 1";
private static String QUERY_STRING = ""
+ "PREFIX obo: <http://purl.obolibrary.org/obo/> \n"
+ "PREFIX vcard: <http://www.w3.org/2006/vcard/ns#> \n"
+ "SELECT ?uri ?pt \n" + "WHERE { \n"
+ " ?uri obo:ARG_2000028 ?vIndividual . \n"
+ " ?vIndividual vcard:hasTitle ?vTitle . \n"
+ " ?vTitle vcard:title ?pt . \n" + "} LIMIT 1";
private static final String FAKE_VIVO_PEOPLE_DATA_GETTER_URI = "http://FakeVivoPeopleDataGetter";