VIVO-396 Obtain preferred title from VCard
This commit is contained in:
parent
2026a40943
commit
02525c7d6b
2 changed files with 7 additions and 12 deletions
|
@ -8,11 +8,9 @@ import java.util.Map;
|
||||||
import org.json.JSONException;
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
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.beans.Individual;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.freemarker.UrlBuilder;
|
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.ObjectPropertyStatementDao;
|
||||||
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
|
||||||
|
|
||||||
|
@ -27,11 +25,6 @@ public class IndividualJsonWrapper {
|
||||||
// need an unfiltered dao to get firstnames and lastnames
|
// need an unfiltered dao to get firstnames and lastnames
|
||||||
WebappDaoFactory fullWdf = vreq.getUnfilteredWebappDaoFactory();
|
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();
|
JSONObject jo = new JSONObject();
|
||||||
jo.put("URI", ind.getURI());
|
jo.put("URI", ind.getURI());
|
||||||
jo.put("label", ind.getRdfsLabel());
|
jo.put("label", ind.getRdfsLabel());
|
||||||
|
@ -40,8 +33,6 @@ public class IndividualJsonWrapper {
|
||||||
jo.put("imageUrl", ind.getImageUrl());
|
jo.put("imageUrl", ind.getImageUrl());
|
||||||
jo.put("profileUrl", UrlBuilder.getIndividualProfileUrl(ind, vreq));
|
jo.put("profileUrl", UrlBuilder.getIndividualProfileUrl(ind, vreq));
|
||||||
jo.put("mostSpecificTypes", getMostSpecificTypes(ind, fullWdf));
|
jo.put("mostSpecificTypes", getMostSpecificTypes(ind, fullWdf));
|
||||||
jo.put("preferredTitle", JsonServlet.getDataPropertyValue(ind,
|
|
||||||
preferredTitleDp, fullWdf));
|
|
||||||
return jo;
|
return jo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -439,9 +439,13 @@ public class FakeApplicationOntologyService {
|
||||||
* "display model". The query finds a preferred title for the individual.
|
* "display model". The query finds a preferred title for the individual.
|
||||||
*/
|
*/
|
||||||
private static class FakeVivoPeopleDataGetter extends SparqlQueryDataGetter {
|
private static class FakeVivoPeopleDataGetter extends SparqlQueryDataGetter {
|
||||||
private static final String QUERY_STRING = "SELECT ?uri ?pt WHERE {\n"
|
private static String QUERY_STRING = ""
|
||||||
+ " ?uri <http://vivoweb.org/ontology/core#preferredTitle> ?pt\n"
|
+ "PREFIX obo: <http://purl.obolibrary.org/obo/> \n"
|
||||||
+ "} LIMIT 1";
|
+ "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";
|
private static final String FAKE_VIVO_PEOPLE_DATA_GETTER_URI = "http://FakeVivoPeopleDataGetter";
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue