anchor.diff:    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}>
  -     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 { 
  +        PREFIX core: <${vivoCore}>
  +        SELECT ?existingActivityType WHERE {
  +            ?role core:roleIn ?existingActivity . 
  +            ?existingActivity a ?existingActivityType . 
  +        }    
  +</v:jsonset>
  +--%>
  +<% 
  +request.setAttribute("typeQuery", getActivityTypeQuery(vreq));
   %>
  -<v:jsonset var="activityTypeQuery">
  -    PREFIX core: <${vivoCore}>
  -    SELECT ?existingActivityType WHERE { 
  -        ?role core:roleIn ?existingActivity .
  -        ?existingActivity a ?existingActivityType . 
  -    }
  -</v:jsonset>  
  -<% } %>
  +<v:jsonset var="activityTypeQuery">${typeQuery}</v:jsonset>
   
    <v:jsonset var="existingIntervalNodeQuery" >  
       SELECT ?existingIntervalNode WHERE {
  
positive.code: <%@ page import="java.util.List" %>
  <%@ page import="java.util.ArrayList" %>
  <%@ page import="java.util.Arrays" %>
  
  <%@ page import="com.hp.hpl.jena.rdf.model.Model" %>
  <%@ page import="com.hp.hpl.jena.vocabulary.XSD" %>
  
  <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual" %>
  <%@ page import="edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary" %>
  
negative.code: 	</script>
  <% } %>
  
  <jsp:include page="${postForm}"/>
  
  <%!
  // The activity type query results must be limited to the values in the activity type select element. 
  // Sometimes the query returns a superclass such as owl:Thing instead. 
  private String getActivityTypeQuery(VitroRequest vreq) {
  
      String activityTypeQuery = null;
      String vivoCore = "http://vivoweb.org/ontology/core#";
  	String defaultActivityTypeQuery = 
  	    "PREFIX core: <" + vivoCore + ">\n" +
  	    "SELECT ?existingActivityType WHERE { \n" +
  	        "?role core:roleIn ?existingActivity . \n" +
  	        "?existingActivity a ?existingActivityType . \n" +
  	    "}";    
  
  	// Select options are subclasses of a specified class
  	String objectClassUri = vreq.getParameter("roleActivityType_objectClassUri");
  	if (StringUtils.isNotBlank(objectClassUri)) { 
  	    log.debug("objectClassUri = " + objectClassUri);
  	    activityTypeQuery = 
  	    "PREFIX core: <" + vivoCore + ">\n" +
  	    "PREFIX rdfs: <" + VitroVocabulary.RDFS + ">\n" +
  	    "SELECT ?existingActivityType WHERE {\n" +
  	        "?role core:roleIn ?existingActivity . \n" +
  	        "?existingActivity a ?existingActivityType . \n" +
  	        "?existingActivityType rdfs:subClassOf <" + objectClassUri + "> . \n" +
  	    "}";
  	} else {  
  	    String optionsType = vreq.getParameter("roleActivityType_optionsType");
  	    // Select options are hardcoded
  	    if ("HARDCODED_LITERALS".equals(optionsType)) {
  	        String typeLiteralOptions = vreq.getParameter("roleActivityType_literalOptions");
  	        if (StringUtils.isNotBlank(typeLiteralOptions)) {           
  	            try {
  	                JSONObject json = new JSONObject(typeLiteralOptions);
  	                Set<String> selectOptions = new HashSet<String>();
  	            } catch (JSONException e) {
  	                activityTypeQuery = defaultActivityTypeQuery;
  	            }
  	        }
  	        activityTypeQuery = defaultActivityTypeQuery; // temporary
  	    } else { 
  	        activityTypeQuery = defaultActivityTypeQuery;	    
  	    } 
  	}
  	log.debug("Activity type query: " + activityTypeQuery);
      return activityTypeQuery;
  }
  %>