VIVO-429 and VIVO-486

This commit is contained in:
tworrall 2013-11-05 09:57:09 -05:00
parent b435a487bf
commit 6ef8cb6b80
4 changed files with 25 additions and 6 deletions

View file

@ -23,8 +23,8 @@
OPTIONAL { ?link vcard:url ?url } OPTIONAL { ?link vcard:url ?url }
OPTIONAL { ?link core:rank ?rank } OPTIONAL { ?link core:rank ?rank }
<critical-data-required> <critical-data-required>
FILTER ( bound(?url) ) FILTER ( bound(?link) )
</critical-data-required> </critical-data-required>
} ORDER BY ?rank ?label } ORDER BY ?rank ?label
</query-select> </query-select>

View file

@ -180,4 +180,4 @@ ${scripts.add('<script type="text/javascript" src="${urls.base}/js/jquery-ui/js/
${scripts.add('<script type="text/javascript" src="${urls.base}/js/customFormUtils.js"></script>')} ${scripts.add('<script type="text/javascript" src="${urls.base}/js/customFormUtils.js"></script>')}
${scripts.add('<script type="text/javascript" src="${urls.base}/js/browserUtils.js"></script>')} ${scripts.add('<script type="text/javascript" src="${urls.base}/js/browserUtils.js"></script>')}
${scripts.add('<script type="text/javascript" src="${urls.base}/templates/freemarker/edit/forms/js/customFormWithAutocomplete.js"></script>')} ${scripts.add('<script type="text/javascript" src="${urls.base}/templates/freemarker/edit/forms/js/customFormWithAutocomplete.js"></script>')}
</#if> </#if>

View file

@ -11,6 +11,7 @@
<#assign deleteWebpageUrl=editConfiguration.pageData.deleteWebpageUrl!"deleteWebpageUrl is undefined"> <#assign deleteWebpageUrl=editConfiguration.pageData.deleteWebpageUrl!"deleteWebpageUrl is undefined">
<#assign showAddFormUrl=editConfiguration.pageData.showAddFormUrl!"showAddFormUrl is undefined"> <#assign showAddFormUrl=editConfiguration.pageData.showAddFormUrl!"showAddFormUrl is undefined">
<#assign predicateUri=editConfiguration.predicateUri!"undefined"> <#assign predicateUri=editConfiguration.predicateUri!"undefined">
<#assign domainUri = editConfiguration.predicateProperty.domainVClassURI!"">
<#if (editConfiguration.pageData.subjectName??) > <#if (editConfiguration.pageData.subjectName??) >
<h2><em>${editConfiguration.pageData.subjectName}</em></h2> <h2><em>${editConfiguration.pageData.subjectName}</em></h2>
@ -56,7 +57,7 @@
<#-- There is no editConfig at this stage, so we don't need to go through postEditCleanup.jsp on cancel. <#-- 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 These can just be ordinary links, rather than a v:input element, as in
addAuthorsToInformationResource.jsp. --> addAuthorsToInformationResource.jsp. -->
<a href="${showAddFormUrl}" id="showAddForm" class="button green" title="${i18n().add_new_web_page}">${i18n().add_new_web_page}</a> <a href="${showAddFormUrl}<#if (domainUri?length > 0)>&domainUri=${domainUri}</#if>" id="showAddForm" class="button green" title="${i18n().add_new_web_page}">${i18n().add_new_web_page}</a>
<a href="${cancelUrl}" id="returnToIndividual" class="return" title="${i18n().return_to_profile}">${i18n().return_to_profile}</a> <a href="${cancelUrl}" id="returnToIndividual" class="return" title="${i18n().return_to_profile}">${i18n().return_to_profile}</a>
<img id="indicator" class="indicator hidden" src="${urls.base}/images/indicatorWhite.gif" alt="${i18n().processing_indicator}"/> <img id="indicator" class="indicator hidden" src="${urls.base}/images/indicatorWhite.gif" alt="${i18n().processing_indicator}"/>

View file

@ -12,6 +12,9 @@ import org.apache.commons.logging.LogFactory;
import com.hp.hpl.jena.query.QuerySolution; import com.hp.hpl.jena.query.QuerySolution;
import com.hp.hpl.jena.query.ResultSet; 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.rdf.model.RDFNode;
import com.hp.hpl.jena.vocabulary.XSD; import com.hp.hpl.jena.vocabulary.XSD;
@ -44,7 +47,7 @@ public class AddEditWebpageFormGenerator extends BaseEditConfigurationGenerator
prepare(vreq, config); prepare(vreq, config);
return config; return config;
} }
//Have broken this method down into two portions to allow for overriding of edit configuration //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 //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); initPropertyParameters(vreq, session, config);
initObjectPropForm(config, vreq); initObjectPropForm(config, vreq);
String linkUri = getLinkUri(vreq); String linkUri = getLinkUri(vreq);
String domainUri = vreq.getParameter("domainUri");
String vcardIndividualType = "http://www.w3.org/2006/vcard/ns#Kind";
config.setVarNameForSubject("subject"); config.setVarNameForSubject("subject");
config.setVarNameForObject("vcard"); 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("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("linkLabelPredicate", list( "http://www.w3.org/2000/01/rdf-schema#label" ));
config.addUrisInScope("rankPredicate", list( core + "rank")); config.addUrisInScope("rankPredicate", list( core + "rank"));
config.addSparqlForAdditionalUrisInScope("vcard", individualVcardQuery); config.addUrisInScope("vcardType", list( vcardIndividualType ));
if ( config.isUpdate() ) { if ( config.isUpdate() ) {
config.addUrisInScope("link", list( linkUri )); 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.setUrisOnForm("urlType");
config.setLiteralsOnForm(list("url","label","rank")); config.setLiteralsOnForm(list("url","label","rank"));
@ -129,6 +146,7 @@ public class AddEditWebpageFormGenerator extends BaseEditConfigurationGenerator
static String N3_FOR_WEBPAGE = static String N3_FOR_WEBPAGE =
"?subject ?webpageProperty ?vcard . \n"+ "?subject ?webpageProperty ?vcard . \n"+
"?vcard ?inverseProperty ?subject . \n"+ "?vcard ?inverseProperty ?subject . \n"+
"?vcard a ?vcardType . \n" +
"?vcard <http://www.w3.org/2006/vcard/ns#hasURL> ?link ."+ "?vcard <http://www.w3.org/2006/vcard/ns#hasURL> ?link ."+
"?link a <http://www.w3.org/2006/vcard/ns#URL> . \n" + "?link a <http://www.w3.org/2006/vcard/ns#URL> . \n" +
"?link ?linkUrlPredicate ?url ."; "?link ?linkUrlPredicate ?url .";