diff --git a/src/edu/cornell/mannlib/vitro/webapp/controller/individuallist/IndividualJsonWrapper.java b/src/edu/cornell/mannlib/vitro/webapp/controller/individuallist/IndividualJsonWrapper.java
new file mode 100644
index 00000000..3c5a629c
--- /dev/null
+++ b/src/edu/cornell/mannlib/vitro/webapp/controller/individuallist/IndividualJsonWrapper.java
@@ -0,0 +1,87 @@
+/* $This file is distributed under the terms of the license in /doc/license.txt$ */
+
+package edu.cornell.mannlib.vitro.webapp.controller.individuallist;
+
+import java.util.Collection;
+import java.util.Map;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+import com.hp.hpl.jena.query.QuerySolution;
+import com.hp.hpl.jena.query.ResultSet;
+
+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.dao.ObjectPropertyStatementDao;
+import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory;
+import edu.cornell.mannlib.vitro.webapp.dao.jena.QueryUtils;
+
+/**
+ * Wrap an Individual in a JSON object for display by the script.
+ *
+ * This overrides the Vitro version so we can have more info in the display.
+ */
+public class IndividualJsonWrapper {
+ private static final Log log = LogFactory
+ .getLog(IndividualJsonWrapper.class);
+
+ private static String VCARD_DATA_QUERY = ""
+ + "PREFIX obo: \n"
+ + "PREFIX vcard: \n"
+ + "SELECT DISTINCT ?title \n" + "WHERE { \n"
+ + " ?subject obo:ARG_2000028 ?vIndividual . \n"
+ + " ?vIndividual vcard:hasTitle ?vTitle . \n"
+ + " ?vTitle vcard:title ?title . \n" + "} ";
+
+ static JSONObject packageIndividualAsJson(VitroRequest vreq, Individual ind)
+ throws JSONException {
+ // need an unfiltered dao to get firstnames and lastnames
+ WebappDaoFactory fullWdf = vreq.getUnfilteredWebappDaoFactory();
+
+ JSONObject jo = new JSONObject();
+ jo.put("URI", ind.getURI());
+ jo.put("label", ind.getRdfsLabel());
+ jo.put("name", ind.getName());
+ jo.put("thumbUrl", ind.getThumbUrl());
+ jo.put("imageUrl", ind.getImageUrl());
+ jo.put("profileUrl", UrlBuilder.getIndividualProfileUrl(ind, vreq));
+ jo.put("mostSpecificTypes", getMostSpecificTypes(ind, fullWdf));
+ jo.put("preferredTitle", findPreferredTitle(vreq, ind));
+ return jo;
+ }
+
+ private static String findPreferredTitle(VitroRequest vreq, Individual ind) {
+ String queryStr = QueryUtils.subUriForQueryVar(VCARD_DATA_QUERY,
+ "subject", ind.getURI());
+ log.debug("queryStr = " + queryStr);
+ String value = "";
+ try {
+ ResultSet results = QueryUtils.getQueryResults(queryStr, vreq);
+ while (results.hasNext()) {
+ QuerySolution soln = results.nextSolution();
+ String t = QueryUtils.nodeToString(soln.get("title"));
+ if (StringUtils.isNotBlank(t)) {
+ value = t;
+ }
+ }
+ } catch (Exception e) {
+ log.error(e, e);
+ }
+ return value;
+ }
+
+ public static Collection getMostSpecificTypes(
+ Individual individual, WebappDaoFactory wdf) {
+ ObjectPropertyStatementDao opsDao = wdf.getObjectPropertyStatementDao();
+ Map mostSpecificTypes = opsDao
+ .getMostSpecificTypesInClassgroupsForIndividual(individual
+ .getURI());
+ return mostSpecificTypes.values();
+ }
+
+}
diff --git a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddOutreachProviderRoleToPersonGenerator.java b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddOutreachProviderRoleToPersonGenerator.java
index 60fdad4a..ba109983 100644
--- a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddOutreachProviderRoleToPersonGenerator.java
+++ b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddOutreachProviderRoleToPersonGenerator.java
@@ -1,52 +1,80 @@
-/* $This file is distributed under the terms of the license in /doc/license.txt$ */
-
-package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators;
-
-import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
-import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.ChildVClassesOptions;
-import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldOptions;
-
-public class AddOutreachProviderRoleToPersonGenerator extends AddRoleToPersonTwoStageGenerator {
-
- private static String template = "addOutreachProviderRoleToPerson.ftl";
- private static String OPTION_CLASS_URI = "http://xmlns.com/foaf/0.1/Organization";
-
- @Override
- String getTemplate() {
- return template;
- }
-
- @Override
- String getRoleType() {
- return "http://vivoweb.org/ontology/core#OutreachProviderRole";
- }
-
- //Outreach Provider role involves hard-coded options for the "right side" of the role or activity
- @Override
- FieldOptions getRoleActivityFieldOptions(VitroRequest vreq) throws Exception {
- return new
- ChildVClassesOptions(OPTION_CLASS_URI)
- .setDefaultOptionLabel("Select type");
- }
-
- @Override
- boolean isShowRoleLabelField(){return true;}
-
- /*
- * Use the methods below to change the date/time precision in the
- * custom form associated with this generator. When not used, the
- * precision will be YEAR. The other precisons are MONTH, DAY, HOUR,
- * MINUTE, TIME and NONE.
- */
-/*
- public String getStartDatePrecision() {
- String precision = VitroVocabulary.Precision.MONTH.uri();
- return precision;
- }
-
- public String getEndDatePrecision() {
- String precision = VitroVocabulary.Precision.DAY.uri();
- return precision;
- }
-*/
-}
+/* $This file is distributed under the terms of the license in /doc/license.txt$ */
+
+package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators;
+
+import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
+import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.ConstantFieldOptions;
+import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldOptions;
+
+public class AddOutreachProviderRoleToPersonGenerator extends AddRoleToPersonTwoStageGenerator {
+
+ private static String template = "addOutreachProviderRoleToPerson.ftl";
+ private static String OPTION_CLASS_URI = "http://xmlns.com/foaf/0.1/Organization";
+
+ @Override
+ String getTemplate() {
+ return template;
+ }
+
+ @Override
+ String getRoleType() {
+ return "http://vivoweb.org/ontology/core#OutreachProviderRole";
+ }
+
+ //Outreach Provider role involves hard-coded options for the "right side" of the role or activity
+ @Override
+ FieldOptions getRoleActivityFieldOptions(VitroRequest vreq) throws Exception {
+ return new ConstantFieldOptions(
+ "","Select type",
+ "http://vivoweb.org/ontology/core#Association","Association",
+ "http://vivoweb.org/ontology/core#Center","Center",
+ "http://vivoweb.org/ontology/core#ClinicalOrganization","Clinical Organization",
+ "http://vivoweb.org/ontology/core#College","College",
+ "http://vivoweb.org/ontology/core#Committee","Committee",
+ "http://vivoweb.org/ontology/core#Consortium","Consortium",
+ "http://vivoweb.org/ontology/core#CoreLaboratory","Core Laboratory",
+ "http://vivoweb.org/ontology/core#Department","Department",
+ "http://vivoweb.org/ontology/core#Division","Division",
+ "http://vivoweb.org/ontology/core#ExtensionUnit","Extension Unit",
+ "http://vivoweb.org/ontology/core#Foundation","Foundation",
+ "http://vivoweb.org/ontology/core#FundingOrganization","Funding Organization",
+ "http://vivoweb.org/ontology/core#GovernmentAgency","Government Agency",
+ "http://vivoweb.org/ontology/core#Hospital","Hospital",
+ "http://vivoweb.org/ontology/core#Institute","Institute",
+ "http://vivoweb.org/ontology/core#Laboratory","Laboratory",
+ "http://vivoweb.org/ontology/core#Library","Library",
+ "http://vivoweb.org/ontology/core#Museum","Museum",
+ "http://xmlns.com/foaf/0.1/Organization","Organization",
+ "http://vivoweb.org/ontology/core#PrivateCompany","Private Company",
+ "http://vivoweb.org/ontology/core#Program","Program",
+ "http://vivoweb.org/ontology/core#Publisher","Publisher",
+ "http://vivoweb.org/ontology/core#ResearchOrganization","Research Organization",
+ "http://vivoweb.org/ontology/core#Team","Team",
+ "http://vivoweb.org/ontology/core#School","School",
+ "http://vivoweb.org/ontology/core#ServiceProvidingLaboratory","Service Providing Lab",
+ "http://vivoweb.org/ontology/core#StudentOrganization","Student Organization",
+ "http://purl.obolibrary.org/obo/ERO_0000565","Technology Transfer Office",
+ "http://vivoweb.org/ontology/core#University","University");
+ }
+
+ @Override
+ boolean isShowRoleLabelField(){return true;}
+
+ /*
+ * Use the methods below to change the date/time precision in the
+ * custom form associated with this generator. When not used, the
+ * precision will be YEAR. The other precisons are MONTH, DAY, HOUR,
+ * MINUTE, TIME and NONE.
+ */
+/*
+ public String getStartDatePrecision() {
+ String precision = VitroVocabulary.Precision.MONTH.uri();
+ return precision;
+ }
+
+ public String getEndDatePrecision() {
+ String precision = VitroVocabulary.Precision.DAY.uri();
+ return precision;
+ }
+*/
+}
diff --git a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/ManageLabelsForPersonGenerator.java b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/ManageLabelsForPersonGenerator.java
index 001a426b..bb8a72d4 100644
--- a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/ManageLabelsForPersonGenerator.java
+++ b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/ManageLabelsForPersonGenerator.java
@@ -1,6 +1,8 @@
/* $This file is distributed under the terms of the license in /doc/license.txt$ */
package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators;
+import static edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestActionConstants.SOME_LITERAL;
+
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Arrays;
@@ -335,7 +337,7 @@ public class ManageLabelsForPersonGenerator extends BaseEditConfigurationGenerat
Individual individual = EditConfigurationUtils.getIndividual(vreq, config.getSubjectUri());
AddDataPropertyStatement adps = new AddDataPropertyStatement(
vreq.getJenaOntModel(), individual.getURI(),
- RequestActionConstants.SOME_URI);
+ RequestActionConstants.SOME_URI, SOME_LITERAL);
AddObjectPropertyStatement aops = new AddObjectPropertyStatement(
vreq.getJenaOntModel(), individual.getURI(),
diff --git a/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individuallist/ListedIndividual.java b/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individuallist/ListedIndividual.java
index ce9e7899..24615507 100644
--- a/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individuallist/ListedIndividual.java
+++ b/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/individuallist/ListedIndividual.java
@@ -2,28 +2,60 @@
package edu.cornell.mannlib.vitro.webapp.web.templatemodels.individuallist;
+import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import com.hp.hpl.jena.query.QuerySolution;
+import com.hp.hpl.jena.query.ResultSet;
+
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
-import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individuallist.BaseListedIndividual;
-import edu.cornell.mannlib.vitro.webapp.web.templatemodels.individuallist.ListedIndividual;
+import edu.cornell.mannlib.vitro.webapp.dao.jena.QueryUtils;
public class ListedIndividual extends BaseListedIndividual {
-
private static final Log log = LogFactory.getLog(ListedIndividual.class);
- private static final String CORE = "http://vivoweb.org/ontology/core#";
+ private static String VCARD_DATA_QUERY = ""
+ + "PREFIX obo: \n"
+ + "PREFIX vcard: \n"
+ + "SELECT DISTINCT ?title \n"
+ + "WHERE { \n"
+ + " ?subject obo:ARG_2000028 ?vIndividual . \n"
+ + " ?vIndividual vcard:hasTitle ?vTitle . \n"
+ + " ?vTitle vcard:title ?title . \n"
+ + "} " ;
+
+ private final String title;
public ListedIndividual(Individual individual, VitroRequest vreq) {
super(individual, vreq);
+ title = findPreferredTitle();
}
-
+
+ private String findPreferredTitle() {
+ String queryStr = QueryUtils.subUriForQueryVar(VCARD_DATA_QUERY, "subject", individual.getURI());
+ log.debug("queryStr = " + queryStr);
+ String value = "";
+ try {
+ ResultSet results = QueryUtils.getQueryResults(queryStr, vreq);
+ while (results.hasNext()) {
+ QuerySolution soln = results.nextSolution();
+ String t = QueryUtils.nodeToString( soln.get("title"));
+ if (StringUtils.isNotBlank(t)) {
+ value = t;
+ }
+ }
+ } catch (Exception e) {
+ log.error(e, e);
+ }
+ return value;
+ }
+
/* Template properties */
public String getPreferredTitle() {
- return cleanTextForDisplay( individual.getDataValue(CORE + "preferredTitle") );
+ return title;
}
}
diff --git a/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/searchresult/IndividualSearchResult.java b/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/searchresult/IndividualSearchResult.java
index 782c2316..efaaccae 100644
--- a/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/searchresult/IndividualSearchResult.java
+++ b/src/edu/cornell/mannlib/vitro/webapp/web/templatemodels/searchresult/IndividualSearchResult.java
@@ -2,33 +2,73 @@
package edu.cornell.mannlib.vitro.webapp.web.templatemodels.searchresult;
+import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import com.hp.hpl.jena.query.QuerySolution;
+import com.hp.hpl.jena.query.ResultSet;
+
import edu.cornell.mannlib.vitro.webapp.beans.Individual;
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
+import edu.cornell.mannlib.vitro.webapp.dao.jena.QueryUtils;
public class IndividualSearchResult extends BaseIndividualSearchResult {
-
private static final Log log = LogFactory.getLog(IndividualSearchResult.class);
- private static final String CORE = "http://vivoweb.org/ontology/core#";
+ private static String VCARD_DATA_QUERY = ""
+ + "PREFIX obo: \n"
+ + "PREFIX vcard: \n"
+ + "SELECT DISTINCT ?email ?title \n"
+ + "WHERE { \n"
+ + " ?subject obo:ARG_2000028 ?vIndividual . \n"
+ + " OPTIONAL { ?vIndividual vcard:hasEmail ?vEmail . \n"
+ + " ?vEmail vcard:email ?email . \n"
+ + " } \n"
+ + " OPTIONAL { ?vIndividual vcard:hasTitle ?vTitle . \n"
+ + " ?vTitle vcard:title ?title . \n"
+ + " } \n"
+ + "} " ;
+
+ private String email = "";
+ private String title = "";
public IndividualSearchResult(Individual individual, VitroRequest vreq) {
super(individual, vreq);
log.debug("Called Individual Search Result");
+ findVcardInfo();
}
+ private void findVcardInfo() {
+ String queryStr = QueryUtils.subUriForQueryVar(VCARD_DATA_QUERY, "subject", individual.getURI());
+ log.debug("queryStr = " + queryStr);
+ try {
+ ResultSet results = QueryUtils.getQueryResults(queryStr, vreq);
+ while (results.hasNext()) {
+ QuerySolution soln = results.nextSolution();
+ String t = QueryUtils.nodeToString( soln.get("title"));
+ if (StringUtils.isNotBlank(t)) {
+ title = t;
+ }
+ String em = QueryUtils.nodeToString( soln.get("email"));
+ if (StringUtils.isNotBlank(em)) {
+ email = em;
+ }
+ }
+ } catch (Exception e) {
+ log.error(e, e);
+ }
+ }
+
+
/* Access methods for templates */
public String getPreferredTitle() {
- log.debug("Called get Title");
- return individual.getDataValue(CORE + "preferredTitle");
+ return title;
}
public String getEmail() {
- log.debug("Called get Email");
- return individual.getDataValue(CORE + "email");
+ return email;
}
}
\ No newline at end of file
diff --git a/test/edu/cornell/mannlib/vivo/auth/policy/SelfEditorRelationshipPolicyTest.java b/test/edu/cornell/mannlib/vivo/auth/policy/SelfEditorRelationshipPolicyTest.java
index d3f9863d..50219042 100644
--- a/test/edu/cornell/mannlib/vivo/auth/policy/SelfEditorRelationshipPolicyTest.java
+++ b/test/edu/cornell/mannlib/vivo/auth/policy/SelfEditorRelationshipPolicyTest.java
@@ -4,6 +4,7 @@ package edu.cornell.mannlib.vivo.auth.policy;
import static edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.Authorization.AUTHORIZED;
import static edu.cornell.mannlib.vitro.webapp.auth.policy.ifaces.Authorization.INCONCLUSIVE;
+import static edu.cornell.mannlib.vitro.webapp.auth.requestedAction.ifaces.RequestActionConstants.SOME_LITERAL;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -44,10 +45,9 @@ import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary;
/**
* Check the relationships in the SelfEditorRelationshipPolicy.
*
- * This only checks the relationships that deal with InfoContentEntitys.
- * Testing the others seems too redundant. If we generalize this to use
- * configurable relationships, then we'll be able to make more general tests as
- * well.
+ * This only checks the relationships that deal with InfoContentEntitys. Testing
+ * the others seems too redundant. If we generalize this to use configurable
+ * relationships, then we'll be able to make more general tests as well.
*/
public class SelfEditorRelationshipPolicyTest extends AbstractTestClass {
private static final Log log = LogFactory
@@ -69,12 +69,12 @@ public class SelfEditorRelationshipPolicyTest extends AbstractTestClass {
private static final String URI_PERMITTED_PREDICATE = NS_PERMITTED
+ "permittedPredicate";
- private static final Property PERMITTED_PREDICATE = new Property(
- URI_PERMITTED_PREDICATE);
+ private static final Property PERMITTED_PREDICATE = new Property(
+ URI_PERMITTED_PREDICATE);
private static final String URI_RESTRICTED_PREDICATE = NS_RESTRICTED
+ "restrictedPredicate";
- private static final Property RESTRICTED_PREDICATE = new Property(
- URI_RESTRICTED_PREDICATE);
+ private static final Property RESTRICTED_PREDICATE = new Property(
+ URI_RESTRICTED_PREDICATE);
/**
* Where the model statements are stored for this test.
@@ -185,30 +185,28 @@ public class SelfEditorRelationshipPolicyTest extends AbstractTestClass {
@Test
public void dataPropSubjectIsRestricted() {
action = new AddDataPropertyStatement(ontModel,
- URI_RESTRICTED_RESOURCE, URI_PERMITTED_PREDICATE);
+ URI_RESTRICTED_RESOURCE, URI_PERMITTED_PREDICATE, SOME_LITERAL);
assertDecision(INCONCLUSIVE, policy.isAuthorized(idJoe, action));
}
@Test
public void dataPropPredicateIsRestricted() {
action = new AddDataPropertyStatement(ontModel, URI_JOE_EDITED_IT,
- URI_RESTRICTED_PREDICATE);
+ URI_RESTRICTED_PREDICATE, SOME_LITERAL);
assertDecision(INCONCLUSIVE, policy.isAuthorized(idJoe, action));
}
@Test
public void objectPropSubjectIsRestricted() {
action = new AddObjectPropertyStatement(ontModel,
- URI_RESTRICTED_RESOURCE, PERMITTED_PREDICATE,
- URI_JOE_EDITED_IT);
+ URI_RESTRICTED_RESOURCE, PERMITTED_PREDICATE, URI_JOE_EDITED_IT);
assertDecision(INCONCLUSIVE, policy.isAuthorized(idJoe, action));
}
@Test
public void objectPropPredicateIsRestricted() {
action = new AddObjectPropertyStatement(ontModel,
- URI_PERMITTED_RESOURCE, RESTRICTED_PREDICATE,
- URI_JOE_EDITED_IT);
+ URI_PERMITTED_RESOURCE, RESTRICTED_PREDICATE, URI_JOE_EDITED_IT);
assertDecision(INCONCLUSIVE, policy.isAuthorized(idJoe, action));
}
@@ -226,14 +224,14 @@ public class SelfEditorRelationshipPolicyTest extends AbstractTestClass {
@Test
public void dataPropSubjectIsIceButNobodyIsSelfEditing() {
action = new AddDataPropertyStatement(ontModel, URI_JOE_WROTE_IT,
- URI_PERMITTED_PREDICATE);
+ URI_PERMITTED_PREDICATE, SOME_LITERAL);
assertDecision(INCONCLUSIVE, policy.isAuthorized(idNobody, action));
}
@Test
public void dataPropSubjectIsIceButNoAuthorsOrEditorsOrFeatured() {
action = new AddDataPropertyStatement(ontModel, URI_NOBODY_WROTE_IT,
- URI_PERMITTED_PREDICATE);
+ URI_PERMITTED_PREDICATE, SOME_LITERAL);
assertDecision(INCONCLUSIVE, policy.isAuthorized(idJoe, action));
assertDecision(INCONCLUSIVE, policy.isAuthorized(idBozoAndJoe, action));
}
@@ -241,28 +239,28 @@ public class SelfEditorRelationshipPolicyTest extends AbstractTestClass {
@Test
public void dataPropSubjectIsIceButWrongAuthor() {
action = new AddDataPropertyStatement(ontModel, URI_BOZO_WROTE_IT,
- URI_PERMITTED_PREDICATE);
+ URI_PERMITTED_PREDICATE, SOME_LITERAL);
assertDecision(INCONCLUSIVE, policy.isAuthorized(idJoe, action));
}
@Test
public void dataPropSubjectIsIceButWrongEditor() {
action = new AddDataPropertyStatement(ontModel, URI_BOZO_EDITED_IT,
- URI_PERMITTED_PREDICATE);
+ URI_PERMITTED_PREDICATE, SOME_LITERAL);
assertDecision(INCONCLUSIVE, policy.isAuthorized(idJoe, action));
}
@Test
public void dataPropSubjectIsIceButWrongFeatured() {
action = new AddDataPropertyStatement(ontModel,
- URI_BOZO_FEATURED_IN_IT, URI_PERMITTED_PREDICATE);
+ URI_BOZO_FEATURED_IN_IT, URI_PERMITTED_PREDICATE, SOME_LITERAL);
assertDecision(INCONCLUSIVE, policy.isAuthorized(idJoe, action));
}
@Test
public void dataPropSubjectIsIceWithSelfEditingAuthor() {
action = new AddDataPropertyStatement(ontModel, URI_JOE_WROTE_IT,
- URI_PERMITTED_PREDICATE);
+ URI_PERMITTED_PREDICATE, SOME_LITERAL);
assertDecision(AUTHORIZED, policy.isAuthorized(idJoe, action));
assertDecision(AUTHORIZED, policy.isAuthorized(idBozoAndJoe, action));
}
@@ -270,7 +268,7 @@ public class SelfEditorRelationshipPolicyTest extends AbstractTestClass {
@Test
public void dataPropSubjectIsIceWithSelfEditingEditor() {
action = new AddDataPropertyStatement(ontModel, URI_JOE_EDITED_IT,
- URI_PERMITTED_PREDICATE);
+ URI_PERMITTED_PREDICATE, SOME_LITERAL);
assertDecision(AUTHORIZED, policy.isAuthorized(idJoe, action));
assertDecision(AUTHORIZED, policy.isAuthorized(idBozoAndJoe, action));
}
@@ -278,7 +276,7 @@ public class SelfEditorRelationshipPolicyTest extends AbstractTestClass {
@Test
public void dataPropSubjectIsIceWithSelfEditingFeatured() {
action = new AddDataPropertyStatement(ontModel, URI_JOE_FEATURED_IN_IT,
- URI_PERMITTED_PREDICATE);
+ URI_PERMITTED_PREDICATE, SOME_LITERAL);
assertDecision(AUTHORIZED, policy.isAuthorized(idJoe, action));
assertDecision(AUTHORIZED, policy.isAuthorized(idBozoAndJoe, action));
}
@@ -348,8 +346,7 @@ public class SelfEditorRelationshipPolicyTest extends AbstractTestClass {
@Test
public void objectPropObjectIsIcebutNobodyIsSelfEditing() {
action = new AddObjectPropertyStatement(ontModel,
- URI_PERMITTED_RESOURCE, PERMITTED_PREDICATE,
- URI_JOE_EDITED_IT);
+ URI_PERMITTED_RESOURCE, PERMITTED_PREDICATE, URI_JOE_EDITED_IT);
assertDecision(INCONCLUSIVE, policy.isAuthorized(idNobody, action));
}
@@ -365,16 +362,14 @@ public class SelfEditorRelationshipPolicyTest extends AbstractTestClass {
@Test
public void objectPropObjectIsIceButWrongAuthor() {
action = new AddObjectPropertyStatement(ontModel,
- URI_PERMITTED_RESOURCE, PERMITTED_PREDICATE,
- URI_BOZO_WROTE_IT);
+ URI_PERMITTED_RESOURCE, PERMITTED_PREDICATE, URI_BOZO_WROTE_IT);
assertDecision(INCONCLUSIVE, policy.isAuthorized(idJoe, action));
}
@Test
public void objectPropObjectIsIceButWrongEditor() {
action = new AddObjectPropertyStatement(ontModel,
- URI_PERMITTED_RESOURCE, PERMITTED_PREDICATE,
- URI_BOZO_EDITED_IT);
+ URI_PERMITTED_RESOURCE, PERMITTED_PREDICATE, URI_BOZO_EDITED_IT);
assertDecision(INCONCLUSIVE, policy.isAuthorized(idJoe, action));
}
@@ -389,8 +384,7 @@ public class SelfEditorRelationshipPolicyTest extends AbstractTestClass {
@Test
public void objectPropObjectIsIceWithSelfEditingAuthor() {
action = new AddObjectPropertyStatement(ontModel,
- URI_PERMITTED_RESOURCE, PERMITTED_PREDICATE,
- URI_JOE_WROTE_IT);
+ URI_PERMITTED_RESOURCE, PERMITTED_PREDICATE, URI_JOE_WROTE_IT);
assertDecision(AUTHORIZED, policy.isAuthorized(idJoe, action));
assertDecision(AUTHORIZED, policy.isAuthorized(idBozoAndJoe, action));
}
@@ -398,8 +392,7 @@ public class SelfEditorRelationshipPolicyTest extends AbstractTestClass {
@Test
public void objectPropObjectIsIceWithSelfEditingEditor() {
action = new AddObjectPropertyStatement(ontModel,
- URI_PERMITTED_RESOURCE, PERMITTED_PREDICATE,
- URI_JOE_EDITED_IT);
+ URI_PERMITTED_RESOURCE, PERMITTED_PREDICATE, URI_JOE_EDITED_IT);
assertDecision(AUTHORIZED, policy.isAuthorized(idJoe, action));
assertDecision(AUTHORIZED, policy.isAuthorized(idBozoAndJoe, action));
}
@@ -420,7 +413,7 @@ public class SelfEditorRelationshipPolicyTest extends AbstractTestClass {
@Test
public void dataPropSubjectIsNotIce() {
action = new AddDataPropertyStatement(ontModel, URI_PERMITTED_RESOURCE,
- URI_PERMITTED_PREDICATE);
+ URI_PERMITTED_PREDICATE, SOME_LITERAL);
assertDecision(INCONCLUSIVE, policy.isAuthorized(idJoe, action));
}
diff --git a/utilities/ISF-transition/obsoleteUris/directory_walker.rb b/utilities/ISF-transition/obsoleteUris/directory_walker.rb
index c7c87ea8..5ccaa89c 100644
--- a/utilities/ISF-transition/obsoleteUris/directory_walker.rb
+++ b/utilities/ISF-transition/obsoleteUris/directory_walker.rb
@@ -34,13 +34,13 @@ class DirectoryWalker
def scan_line(path, line_number, line)
@obsolete_uris.uris.each do |uri|
next if @known_exceptions.skip?(path, line_number, uri)
- @report.add_event(Event.new(path, line_number, line, uri)) if line =~ Regexp.new(Regexp.quote(uri))
+ @report.add_event(Event.new(path, line_number, line, uri)) if line =~ Regexp.new("\\b#{Regexp.quote(uri)}\\b")
end
if @complete
@obsolete_uris.localnames.each do |localname|
term = ":#{localname}"
next if @known_exceptions.skip?(path, line_number, term)
- @report.add_event(Event.new(path, line_number, line, term)) if line =~ Regexp.new(Regexp.quote(term))
+ @report.add_event(Event.new(path, line_number, line, term)) if line =~ Regexp.new("#{Regexp.quote(term)}\\b")
end
end
end
diff --git a/utilities/ISF-transition/obsoleteUris/report.rb b/utilities/ISF-transition/obsoleteUris/report.rb
index aa9dce78..0bdef5eb 100644
--- a/utilities/ISF-transition/obsoleteUris/report.rb
+++ b/utilities/ISF-transition/obsoleteUris/report.rb
@@ -33,7 +33,13 @@ class Report
hash.sort.each do |path, events|
puts "#{path}"
events.sort{|a, b| a.line_number <=> b.line_number }.each do |e|
- puts " #{e.line_number} #{e.line}"
+ trimmed =
+ if e.line.size <= 100
+ e.line
+ else
+ e.line[0..97] << "..."
+ end
+ puts " #{e.line_number} #{trimmed}"
puts " #{e.is_localname ? "Localname" : "URI"} #{e.string}"
end
puts "--------------------"
diff --git a/utilities/acceptance-tests/suites/ShortViews/shortview_config.n3 b/utilities/acceptance-tests/suites/ShortViews/shortview_config.n3
index 13700e49..37e20113 100644
--- a/utilities/acceptance-tests/suites/ShortViews/shortview_config.n3
+++ b/utilities/acceptance-tests/suites/ShortViews/shortview_config.n3
@@ -67,12 +67,14 @@ mydomain:facultyPreferredTitleDG
a datagetters:SparqlQueryDataGetter ;
display:saveToVar "extra" ;
display:query """
-PREFIX rdfs:
-PREFIX vivo:
-SELECT ?pt
+PREFIX obo:
+PREFIX vcard:
+SELECT DISTINCT ?pt
WHERE {
-?individualUri ?pt
-}
+?individualUri obo:ARG_2000028 ?vIndividual .
+?vIndividual vcard:hasTitle ?vTitle .
+?vTitle vcard:title ?pt .
+}
LIMIT 1
""" .