diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/VitroVocabulary.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/VitroVocabulary.java index facea7277..506a3b773 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/VitroVocabulary.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/dao/VitroVocabulary.java @@ -21,7 +21,8 @@ public class VitroVocabulary { public static final String RDF = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"; public static final String RDFS = "http://www.w3.org/2000/01/rdf-schema#"; public static final String RDF_TYPE = RDF+"type"; - + public static final String LABEL = RDFS + "label"; + public static final String SUBCLASS_OF = RDFS+"subClassOf"; public static final String OWL = "http://www.w3.org/2002/07/owl#"; diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/jsptags/PropertyEditLinks.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/jsptags/PropertyEditLinks.java index ce68befde..199fd6753 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/web/jsptags/PropertyEditLinks.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/web/jsptags/PropertyEditLinks.java @@ -45,7 +45,7 @@ import edu.cornell.mannlib.vitro.webapp.beans.Individual; import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty; import edu.cornell.mannlib.vitro.webapp.beans.ObjectPropertyStatement; import edu.cornell.mannlib.vitro.webapp.edit.n3editing.RdfLiteralHash; -import edu.cornell.mannlib.vitro.webapp.utils.StringUtils; +import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary; /** * JSP tag to generate the HTML of links for edit, delete or @@ -146,12 +146,15 @@ public class PropertyEditLinks extends TagSupport{ } else { try{ JspWriter out = pageContext.getOut(); - if( links != null ){ + if( links != null && links.length > 0){ + // Include the wrapping span here, rather than in the JSP, so if there are no links we don't get the span. + out.print(""); for( LinkStruct ln : links ){ if( ln != null ){ out.print( makeElement( ln ) + '\n' ); } } + out.print(""); } } catch(IOException ioe){ log.error( ioe ); @@ -327,7 +330,7 @@ public class PropertyEditLinks extends TagSupport{ int index = 0; boolean deleteAllowed = ( contains( allowedAccessTypeArray, EditLinkAccess.DELETE ) && - !( predicateUri.endsWith("#label") || predicateUri.endsWith("#type") ) ); + !( predicateUri.equals(VitroVocabulary.LABEL)) || predicateUri.equals(VitroVocabulary.RDF_TYPE) ); if( contains( allowedAccessTypeArray, EditLinkAccess.MODIFY ) ){ log.debug("permission found to UPDATE vitro namepsace property statement "+ predicateUri); @@ -495,25 +498,6 @@ public class PropertyEditLinks extends TagSupport{ return access; } -// protected EditLinkAccess[] policyToAccess( IdentifierBundle ids, PolicyIface policy, String subjectUri, String propertyUri) { -// -// ArrayList list = new ArrayList(2); -// -// RequestedAction action = new EditDataPropStmt(subjectUri, propertyUri, (String) null); -// PolicyDecision dec = policy.isAuthorized(ids, action); -// if ( dec != null && dec.getAuthorized() == Authorization.AUTHORIZED ){ -// list.add( EditLinkAccess.MODIFY); -// } -// -// action = new DropDataPropStmt(subjectUri, propertyUri, (String) null); -// dec = policy.isAuthorized(ids, action); -// if( dec != null && dec.getAuthorized() == Authorization.AUTHORIZED ){ -// list.add( EditLinkAccess.DELETE ); -// } -// -// return list.toArray(ACCESS_TEMPLATE); -// } - public enum EditLinkAccess{ MODIFY, DELETE, ADDNEW, INFO, ADMIN }; public class LinkStruct { diff --git a/webapp/test/edu/cornell/mannlib/vitro/webapp/edit/n3editing/RdfLiteralHashTest.java b/webapp/test/edu/cornell/mannlib/vitro/webapp/edit/n3editing/RdfLiteralHashTest.java index 1cdae48e2..547ba8f2c 100644 --- a/webapp/test/edu/cornell/mannlib/vitro/webapp/edit/n3editing/RdfLiteralHashTest.java +++ b/webapp/test/edu/cornell/mannlib/vitro/webapp/edit/n3editing/RdfLiteralHashTest.java @@ -204,10 +204,16 @@ public class RdfLiteralHashTest { int hash = RdfLiteralHash.makeVitroNsLiteralHash(bob,VitroVocabulary.MONIKER, "great", model); DataPropertyStatement stmt = RdfLiteralHash.getVitroNsPropertyStmtByHash(bob, model, hash); - - Assert.assertEquals("great", stmt.getData()); - Assert.assertEquals(XSD.xstring.getURI(), stmt.getDatatypeURI()); - Assert.assertEquals(VitroVocabulary.MONIKER, stmt.getDatapropURI()); - Assert.assertEquals("http://example.com/bob", stmt.getIndividualURI()); + + String data = stmt.getData(); + String datatypeUri = stmt.getDatatypeURI(); + String predicateUri = stmt.getDatapropURI(); + String subjectUri = stmt.getIndividualURI(); + + Assert.assertEquals("great", data); + Assert.assertEquals(XSD.xstring.getURI(), datatypeUri); + Assert.assertEquals(VitroVocabulary.MONIKER, predicateUri); + Assert.assertEquals("http://example.com/bob", subjectUri); + } } diff --git a/webapp/web/edit/forms/defaultDatapropForm.jsp b/webapp/web/edit/forms/defaultDatapropForm.jsp index aa7d81453..e0cc7fd9c 100644 --- a/webapp/web/edit/forms/defaultDatapropForm.jsp +++ b/webapp/web/edit/forms/defaultDatapropForm.jsp @@ -117,7 +117,7 @@ "literalOptions" : [ ${rangeDefaultJson} ], "predicateUri" : "", "objectClassUri" : "", - "rangeDatatypeUri" : "${rangeDatatypeUriJson}" , + "rangeDatatypeUri" : "${rangeDatatypeUriJson}", "rangeLang" : "${rangeLangJson}", "assertions" : ["${n3ForEdit}"] } diff --git a/webapp/web/edit/forms/defaultVitroNsPropForm.jsp b/webapp/web/edit/forms/defaultVitroNsPropForm.jsp index 941d9c446..60b405647 100644 --- a/webapp/web/edit/forms/defaultVitroNsPropForm.jsp +++ b/webapp/web/edit/forms/defaultVitroNsPropForm.jsp @@ -6,6 +6,7 @@ <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.EditConfiguration"%> +<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.RdfLiteralHash"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.beans.DataPropertyStatement" %> @@ -34,6 +35,14 @@ if( subject == null ) { throw new Error("In vitroNsEditLabelForm.jsp, could not find subject " + subjectUri); } + + Model model = (Model)application.getAttribute("jenaOntModel"); + + // RY ***** Get the rangeDatatypeUri - need to get it from the + //String rangeDatatypeUri = vreq.getWebappDaoFactory().getDataPropertyDao().getRequiredDatatypeURI(subject, prop); + //String rangeDatatypeUri = prop.getRangeDatatypeURI(); + String rangeDatatypeUri = "http://www.w3.org/2001/XMLSchema#string"; + vreq.setAttribute("rangeDatatypeUriJson", MiscWebUtils.escape(rangeDatatypeUri)); %> @@ -97,7 +106,7 @@ "literalOptions" : [ ], "predicateUri" : "", "objectClassUri" : "", - "rangeDatatypeUri" : "", + "rangeDatatypeUri" : "${rangeDatatypeUriJson}", "rangeLang" : "", "assertions" : [ "${dataAssertion}" ] } @@ -117,7 +126,6 @@ } if ( datapropKeyStr != null && datapropKeyStr.trim().length() > 0 ) { - Model model = (Model)application.getAttribute("jenaOntModel"); editConfig.prepareForDataPropUpdate(model,dps); } diff --git a/webapp/web/templates/entity/entityBasic.jsp b/webapp/web/templates/entity/entityBasic.jsp index ae7a0ab87..1f42cb822 100644 --- a/webapp/web/templates/entity/entityBasic.jsp +++ b/webapp/web/templates/entity/entityBasic.jsp @@ -7,8 +7,11 @@ <%@ page import="edu.cornell.mannlib.vedit.beans.LoginFormBean" %> <%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest"%> <%@ page import="edu.cornell.mannlib.vitro.webapp.filters.VitroRequestPrep" %> +<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary" %> + <%@ page import="org.apache.commons.logging.Log" %> <%@ page import="org.apache.commons.logging.LogFactory" %> + <%@ page import="java.util.List" %> <%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %> @@ -24,6 +27,10 @@ log.debug("Starting entityBasic.jsp"); Individual entity = (Individual)request.getAttribute("entity"); %> + + + + <% @@ -78,9 +85,12 @@ if (VitroRequestPrep.isSelfEditing(request) || LoginFormBean.loggedIn(request, L +<%-- Using VitroVocabulary constants instead. +RY Description not working - FIX - + +--%> @@ -104,7 +114,8 @@ if (VitroRequestPrep.isSelfEditing(request) || LoginFormBean.loggedIn(request, L

${entity.name}

- + <%-- --%> +
@@ -114,7 +125,7 @@ if (VitroRequestPrep.isSelfEditing(request) || LoginFormBean.loggedIn(request, L
${entity.moniker} - +
@@ -140,9 +151,11 @@ if (VitroRequestPrep.isSelfEditing(request) || LoginFormBean.loggedIn(request, L
  • ${entity.anchor}
  • + <%-- - - + +
    + --%> @@ -173,7 +186,7 @@ if (VitroRequestPrep.isSelfEditing(request) || LoginFormBean.loggedIn(request, L
    ${entity.citation}
    - +
    @@ -185,7 +198,7 @@ if (VitroRequestPrep.isSelfEditing(request) || LoginFormBean.loggedIn(request, L
    ${entity.blurb}
    - +
    @@ -195,7 +208,7 @@ if (VitroRequestPrep.isSelfEditing(request) || LoginFormBean.loggedIn(request, L
    ${entity.description}
    - +
    @@ -224,7 +237,7 @@ if (VitroRequestPrep.isSelfEditing(request) || LoginFormBean.loggedIn(request, L
    ${entity.citation}
    - +