NIHVIVO-1923 Modify activity type query so it only returns subclasses of objectClassUri, if that is defined. Need to deal with hard-coded literals case separately.

This commit is contained in:
rjy7 2011-01-27 22:39:02 +00:00
parent cfe93b5142
commit b5d1344158
3 changed files with 35 additions and 8 deletions

View file

@ -33,9 +33,9 @@
[ "http://vivoweb.org/ontology/core#Project", "Project" ],
[ "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#Service","Service"],
[ "http://vivoweb.org/ontology/core#Team", "Team" ],
[ "http://vivoweb.org/ontology/core#Student Organization", "Student Organization" ],
[ "http://vivoweb.org/ontology/core#University", "University" ]' />
</jsp:include>

View file

@ -2,8 +2,7 @@
<jsp:include page="addRoleToPersonTwoStage.jsp">
<jsp:param name="roleActivityTypeLabel" value="membership" />
<jsp:param name="roleType" value="http://vivoweb.org/ontology/core#MemberRole" />
<jsp:param name="roleType" value="http://vivoweb.org/ontology/core#MemberRole" />
<jsp:param name="roleActivityType_optionsType" value="CHILD_VCLASSES" />
<jsp:param name="roleActivityType_objectClassUri" value="http://xmlns.com/foaf/0.1/Organization" />
<jsp:param name="roleActivityType_literalOptions" value="[ 'Select one' ]" />

View file

@ -43,6 +43,7 @@
<%@ page import="edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils"%>
<%@ page import="edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils.EditMode"%>
<%@ page import="org.apache.commons.lang.StringUtils" %>
<%@ page import="org.apache.commons.logging.Log" %>
<%@ page import="org.apache.commons.logging.LogFactory" %>
@ -217,13 +218,40 @@ public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.
SELECT ?existingRoleLabel WHERE { ?role <${label}> ?existingRoleLabel . }
</v:jsonset>
<%
String objectClassUri = vreq.getParameter("roleActivityType_objectClassUri");
if (StringUtils.isNotBlank(objectClassUri)) { %>
<c:set var="objectClassUri" value="<%= objectClassUri %>" />
<v:jsonset var="activityTypeQuery">
PREFIX core: <${vivoCore}>
SELECT ?existingActivityType WHERE {
?role core:roleIn ?existingActivity .
?existingActivity a ?existingActivityType .
}
PREFIX core: <${vivoCore}>
PREFIX rdfs: <${rdfs}>
SELECT ?existingActivityType WHERE {
?role core:roleIn ?existingActivity .
?existingActivity a ?existingActivityType .
?existingActivityType rdfs:subClassOf <${objectClassUri}> .
}
</v:jsonset>
<%
/*
} else {
// Need to get the hardcoded literals and filter for them
String optionsType = vreq.getParameter("roleActivityType_optionsType");
if ("HARCODED_LITERALS".equals(optionsType)) {
String typeLiteralOptions = vreq.getParameter("roleActivityType_literalOptions");
if (StringUtils.isNotBlank(typeLiteralOptions)) {
List<String> types = new ArrayList<String>();
}
*/
} else {
%>
<v:jsonset var="activityTypeQuery">
PREFIX core: <${vivoCore}>
SELECT ?existingActivityType WHERE {
?role core:roleIn ?existingActivity .
?existingActivity a ?existingActivityType .
}
</v:jsonset>
<% } %>
<v:jsonset var="existingIntervalNodeQuery" >
SELECT ?existingIntervalNode WHERE {