diff --git a/productMods/config/listViewConfig-webpage.xml b/productMods/config/listViewConfig-webpage.xml index 58ddf13c..9c97cad7 100644 --- a/productMods/config/listViewConfig-webpage.xml +++ b/productMods/config/listViewConfig-webpage.xml @@ -23,8 +23,8 @@ OPTIONAL { ?link vcard:url ?url } OPTIONAL { ?link core:rank ?rank } - FILTER ( bound(?url) ) - + FILTER ( bound(?link) ) + } ORDER BY ?rank ?label diff --git a/productMods/templates/freemarker/edit/forms/addGrantRoleToPerson.ftl b/productMods/templates/freemarker/edit/forms/addGrantRoleToPerson.ftl index 1fe602ef..7d65a5fa 100644 --- a/productMods/templates/freemarker/edit/forms/addGrantRoleToPerson.ftl +++ b/productMods/templates/freemarker/edit/forms/addGrantRoleToPerson.ftl @@ -180,4 +180,4 @@ ${scripts.add('')} ${scripts.add('')} ${scripts.add('')} - \ No newline at end of file + diff --git a/productMods/templates/freemarker/edit/forms/manageWebpagesForIndividual.ftl b/productMods/templates/freemarker/edit/forms/manageWebpagesForIndividual.ftl index c4f0b1d0..81f38396 100644 --- a/productMods/templates/freemarker/edit/forms/manageWebpagesForIndividual.ftl +++ b/productMods/templates/freemarker/edit/forms/manageWebpagesForIndividual.ftl @@ -11,6 +11,7 @@ <#assign deleteWebpageUrl=editConfiguration.pageData.deleteWebpageUrl!"deleteWebpageUrl is undefined"> <#assign showAddFormUrl=editConfiguration.pageData.showAddFormUrl!"showAddFormUrl is undefined"> <#assign predicateUri=editConfiguration.predicateUri!"undefined"> +<#assign domainUri = editConfiguration.predicateProperty.domainVClassURI!""> <#if (editConfiguration.pageData.subjectName??) >

${editConfiguration.pageData.subjectName}

@@ -56,7 +57,7 @@ <#-- There is no editConfig at this stage, so we don't need to go through postEditCleanup.jsp on cancel. These can just be ordinary links, rather than a v:input element, as in addAuthorsToInformationResource.jsp. --> - ${i18n().add_new_web_page} + ${i18n().add_new_web_page} ${i18n().return_to_profile} diff --git a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddEditWebpageFormGenerator.java b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddEditWebpageFormGenerator.java index 0ac4d3a7..4a742623 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddEditWebpageFormGenerator.java +++ b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddEditWebpageFormGenerator.java @@ -12,6 +12,9 @@ import org.apache.commons.logging.LogFactory; import com.hp.hpl.jena.query.QuerySolution; import com.hp.hpl.jena.query.ResultSet; +import com.hp.hpl.jena.rdf.model.Literal; +import com.hp.hpl.jena.rdf.model.Model; +import com.hp.hpl.jena.rdf.model.ModelFactory; import com.hp.hpl.jena.rdf.model.RDFNode; import com.hp.hpl.jena.vocabulary.XSD; @@ -44,7 +47,7 @@ public class AddEditWebpageFormGenerator extends BaseEditConfigurationGenerator prepare(vreq, config); return config; } - + //Have broken this method down into two portions to allow for overriding of edit configuration //without having to copy the entire method and before prepare is called @@ -58,6 +61,9 @@ public class AddEditWebpageFormGenerator extends BaseEditConfigurationGenerator initPropertyParameters(vreq, session, config); initObjectPropForm(config, vreq); String linkUri = getLinkUri(vreq); + String domainUri = vreq.getParameter("domainUri"); + String vcardIndividualType = "http://www.w3.org/2006/vcard/ns#Kind"; + config.setVarNameForSubject("subject"); config.setVarNameForObject("vcard"); @@ -73,11 +79,22 @@ public class AddEditWebpageFormGenerator extends BaseEditConfigurationGenerator config.addUrisInScope("linkUrlPredicate", list( "http://www.w3.org/2006/vcard/ns#url" )); config.addUrisInScope("linkLabelPredicate", list( "http://www.w3.org/2000/01/rdf-schema#label" )); config.addUrisInScope("rankPredicate", list( core + "rank")); - config.addSparqlForAdditionalUrisInScope("vcard", individualVcardQuery); + config.addUrisInScope("vcardType", list( vcardIndividualType )); + if ( config.isUpdate() ) { config.addUrisInScope("link", list( linkUri )); } + else { + if ( domainUri.equals("http://xmlns.com/foaf/0.1/Person") ) { + vcardIndividualType = "http://www.w3.org/2006/vcard/ns#Individual"; + } + else if ( domainUri.equals("http://xmlns.com/foaf/0.1/Organization") ) { + vcardIndividualType = "http://www.w3.org/2006/vcard/ns#Organization"; + } + } + config.addSparqlForAdditionalUrisInScope("vcard", individualVcardQuery); + config.setUrisOnForm("urlType"); config.setLiteralsOnForm(list("url","label","rank")); @@ -129,6 +146,7 @@ public class AddEditWebpageFormGenerator extends BaseEditConfigurationGenerator static String N3_FOR_WEBPAGE = "?subject ?webpageProperty ?vcard . \n"+ "?vcard ?inverseProperty ?subject . \n"+ + "?vcard a ?vcardType . \n" + "?vcard ?link ."+ "?link a . \n" + "?link ?linkUrlPredicate ?url .";