NIHVIVO-707 Set hidden rank field value based on existing webpage ranks
This commit is contained in:
parent
84758e4c3a
commit
bebc08fb8b
7 changed files with 24 additions and 306 deletions
|
@ -27,6 +27,7 @@ import com.hp.hpl.jena.ontology.SomeValuesFromRestriction;
|
||||||
import com.hp.hpl.jena.query.Query;
|
import com.hp.hpl.jena.query.Query;
|
||||||
import com.hp.hpl.jena.query.QueryFactory;
|
import com.hp.hpl.jena.query.QueryFactory;
|
||||||
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.rdf.model.Property;
|
import com.hp.hpl.jena.rdf.model.Property;
|
||||||
import com.hp.hpl.jena.rdf.model.RDFNode;
|
import com.hp.hpl.jena.rdf.model.RDFNode;
|
||||||
import com.hp.hpl.jena.rdf.model.Resource;
|
import com.hp.hpl.jena.rdf.model.Resource;
|
||||||
|
@ -783,7 +784,7 @@ public class DataPropertyDaoJena extends PropertyDaoJena implements
|
||||||
}
|
}
|
||||||
log.debug("Data property query string:\n" + query);
|
log.debug("Data property query string:\n" + query);
|
||||||
|
|
||||||
Iterator<QuerySolution> results = getPropertyQueryResults(query);
|
ResultSet results = getPropertyQueryResults(query);
|
||||||
List<DataProperty> properties = new ArrayList<DataProperty>();
|
List<DataProperty> properties = new ArrayList<DataProperty>();
|
||||||
while (results.hasNext()) {
|
while (results.hasNext()) {
|
||||||
QuerySolution sol = results.next();
|
QuerySolution sol = results.next();
|
||||||
|
|
|
@ -338,8 +338,9 @@ public class DataPropertyStatementDaoJena extends JenaBaseDao implements DataPro
|
||||||
DatasetWrapper w = dwf.getDatasetWrapper();
|
DatasetWrapper w = dwf.getDatasetWrapper();
|
||||||
Dataset dataset = w.getDataset();
|
Dataset dataset = w.getDataset();
|
||||||
dataset.getLock().enterCriticalSection(Lock.READ);
|
dataset.getLock().enterCriticalSection(Lock.READ);
|
||||||
|
QueryExecution qexec = null;
|
||||||
try {
|
try {
|
||||||
QueryExecution qexec = QueryExecutionFactory.create(
|
qexec = QueryExecutionFactory.create(
|
||||||
queryString, dataset);
|
queryString, dataset);
|
||||||
ResultSet results = qexec.execSelect();
|
ResultSet results = qexec.execSelect();
|
||||||
|
|
||||||
|
@ -351,6 +352,9 @@ public class DataPropertyStatementDaoJena extends JenaBaseDao implements DataPro
|
||||||
} finally {
|
} finally {
|
||||||
dataset.getLock().leaveCriticalSection();
|
dataset.getLock().leaveCriticalSection();
|
||||||
w.close();
|
w.close();
|
||||||
|
if (qexec != null) {
|
||||||
|
qexec.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return values;
|
return values;
|
||||||
}
|
}
|
||||||
|
|
|
@ -871,7 +871,7 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
|
||||||
}
|
}
|
||||||
log.debug("Object property query:\n" + query);
|
log.debug("Object property query:\n" + query);
|
||||||
|
|
||||||
Iterator<QuerySolution> results = getPropertyQueryResults(query);
|
ResultSet results = getPropertyQueryResults(query);
|
||||||
List<ObjectProperty> properties = new ArrayList<ObjectProperty>();
|
List<ObjectProperty> properties = new ArrayList<ObjectProperty>();
|
||||||
while (results.hasNext()) {
|
while (results.hasNext()) {
|
||||||
QuerySolution soln = results.next();
|
QuerySolution soln = results.next();
|
||||||
|
@ -917,6 +917,7 @@ public class ObjectPropertyDaoJena extends PropertyDaoJena implements ObjectProp
|
||||||
String filename = soln.getLiteral("filename").getLexicalForm();
|
String filename = soln.getLiteral("filename").getLexicalForm();
|
||||||
customListViewConfigFileMap.put(prop, filename);
|
customListViewConfigFileMap.put(prop, filename);
|
||||||
}
|
}
|
||||||
|
qexec.close();
|
||||||
}
|
}
|
||||||
return customListViewConfigFileMap.get(op);
|
return customListViewConfigFileMap.get(op);
|
||||||
}
|
}
|
||||||
|
|
|
@ -302,9 +302,10 @@ public class ObjectPropertyStatementDaoJena extends JenaBaseDao implements Objec
|
||||||
DatasetWrapper w = dwf.getDatasetWrapper();
|
DatasetWrapper w = dwf.getDatasetWrapper();
|
||||||
Dataset dataset = w.getDataset();
|
Dataset dataset = w.getDataset();
|
||||||
dataset.getLock().enterCriticalSection(Lock.READ);
|
dataset.getLock().enterCriticalSection(Lock.READ);
|
||||||
|
QueryExecution qexec = null;
|
||||||
try {
|
try {
|
||||||
|
|
||||||
QueryExecution qexec = (constructedModel == null)
|
qexec = (constructedModel == null)
|
||||||
? QueryExecutionFactory.create(
|
? QueryExecutionFactory.create(
|
||||||
query, dataset, initialBindings)
|
query, dataset, initialBindings)
|
||||||
: QueryExecutionFactory.create(
|
: QueryExecutionFactory.create(
|
||||||
|
@ -323,6 +324,9 @@ public class ObjectPropertyStatementDaoJena extends JenaBaseDao implements Objec
|
||||||
} finally {
|
} finally {
|
||||||
dataset.getLock().leaveCriticalSection();
|
dataset.getLock().leaveCriticalSection();
|
||||||
w.close();
|
w.close();
|
||||||
|
if (qexec != null) {
|
||||||
|
qexec.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,15 +20,13 @@ import com.hp.hpl.jena.query.Dataset;
|
||||||
import com.hp.hpl.jena.query.Query;
|
import com.hp.hpl.jena.query.Query;
|
||||||
import com.hp.hpl.jena.query.QueryExecution;
|
import com.hp.hpl.jena.query.QueryExecution;
|
||||||
import com.hp.hpl.jena.query.QueryExecutionFactory;
|
import com.hp.hpl.jena.query.QueryExecutionFactory;
|
||||||
import com.hp.hpl.jena.query.QuerySolution;
|
|
||||||
import com.hp.hpl.jena.query.QuerySolutionMap;
|
|
||||||
import com.hp.hpl.jena.query.ResultSet;
|
import com.hp.hpl.jena.query.ResultSet;
|
||||||
import com.hp.hpl.jena.rdf.model.RDFNode;
|
import com.hp.hpl.jena.rdf.model.RDFNode;
|
||||||
import com.hp.hpl.jena.rdf.model.Resource;
|
import com.hp.hpl.jena.rdf.model.Resource;
|
||||||
import com.hp.hpl.jena.rdf.model.ResourceFactory;
|
|
||||||
import com.hp.hpl.jena.rdf.model.Statement;
|
import com.hp.hpl.jena.rdf.model.Statement;
|
||||||
import com.hp.hpl.jena.rdf.model.StmtIterator;
|
import com.hp.hpl.jena.rdf.model.StmtIterator;
|
||||||
import com.hp.hpl.jena.shared.Lock;
|
import com.hp.hpl.jena.shared.Lock;
|
||||||
|
import com.hp.hpl.jena.sparql.resultset.ResultSetMem;
|
||||||
import com.hp.hpl.jena.vocabulary.OWL;
|
import com.hp.hpl.jena.vocabulary.OWL;
|
||||||
import com.hp.hpl.jena.vocabulary.RDFS;
|
import com.hp.hpl.jena.vocabulary.RDFS;
|
||||||
|
|
||||||
|
@ -404,7 +402,7 @@ public class PropertyDaoJena extends JenaBaseDao implements PropertyDao {
|
||||||
return classSet;
|
return classSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Iterator<QuerySolution> getPropertyQueryResults(Query query) {
|
protected ResultSet getPropertyQueryResults(Query query) {
|
||||||
log.debug("SPARQL query:\n" + query.toString());
|
log.debug("SPARQL query:\n" + query.toString());
|
||||||
|
|
||||||
// RY Removing prebinding due to Jena bug: when isLiteral(?object) or
|
// RY Removing prebinding due to Jena bug: when isLiteral(?object) or
|
||||||
|
@ -417,17 +415,12 @@ public class PropertyDaoJena extends JenaBaseDao implements PropertyDao {
|
||||||
DatasetWrapper w = dwf.getDatasetWrapper();
|
DatasetWrapper w = dwf.getDatasetWrapper();
|
||||||
Dataset dataset = w.getDataset();
|
Dataset dataset = w.getDataset();
|
||||||
dataset.getLock().enterCriticalSection(Lock.READ);
|
dataset.getLock().enterCriticalSection(Lock.READ);
|
||||||
|
ResultSet rs = null;
|
||||||
try {
|
try {
|
||||||
QueryExecution qexec = QueryExecutionFactory.create(
|
QueryExecution qexec = QueryExecutionFactory.create(
|
||||||
query, dataset); //, subjectBinding);
|
query, dataset); //, subjectBinding);
|
||||||
try {
|
try {
|
||||||
ResultSet rs = qexec.execSelect();
|
rs = new ResultSetMem(qexec.execSelect());
|
||||||
// consume iterator before wrapper w is closed in finally block
|
|
||||||
List<QuerySolution> results = new ArrayList<QuerySolution>();
|
|
||||||
while (rs.hasNext()) {
|
|
||||||
results.add(rs.next());
|
|
||||||
}
|
|
||||||
return results.iterator();
|
|
||||||
} finally {
|
} finally {
|
||||||
qexec.close();
|
qexec.close();
|
||||||
}
|
}
|
||||||
|
@ -435,6 +428,7 @@ public class PropertyDaoJena extends JenaBaseDao implements PropertyDao {
|
||||||
dataset.getLock().leaveCriticalSection();
|
dataset.getLock().leaveCriticalSection();
|
||||||
w.close();
|
w.close();
|
||||||
}
|
}
|
||||||
|
return rs;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@ import com.hp.hpl.jena.rdf.model.Literal;
|
||||||
import com.hp.hpl.jena.rdf.model.RDFNode;
|
import com.hp.hpl.jena.rdf.model.RDFNode;
|
||||||
import com.hp.hpl.jena.rdf.model.Resource;
|
import com.hp.hpl.jena.rdf.model.Resource;
|
||||||
import com.hp.hpl.jena.shared.Lock;
|
import com.hp.hpl.jena.shared.Lock;
|
||||||
|
import com.hp.hpl.jena.sparql.resultset.ResultSetMem;
|
||||||
|
|
||||||
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest;
|
||||||
|
|
||||||
|
@ -30,6 +31,8 @@ public class QueryUtils {
|
||||||
|
|
||||||
private static final Log log = LogFactory.getLog(QueryUtils.class);
|
private static final Log log = LogFactory.getLog(QueryUtils.class);
|
||||||
|
|
||||||
|
private QueryUtils() { }
|
||||||
|
|
||||||
protected static Map<String,Object> querySolutionToObjectValueMap( QuerySolution soln){
|
protected static Map<String,Object> querySolutionToObjectValueMap( QuerySolution soln){
|
||||||
Map<String,Object> map = new HashMap<String,Object>();
|
Map<String,Object> map = new HashMap<String,Object>();
|
||||||
Iterator<String> varNames = soln.varNames();
|
Iterator<String> varNames = soln.varNames();
|
||||||
|
@ -110,12 +113,11 @@ public class QueryUtils {
|
||||||
|
|
||||||
Dataset dataset = vreq.getDataset();
|
Dataset dataset = vreq.getDataset();
|
||||||
dataset.getLock().enterCriticalSection(Lock.READ);
|
dataset.getLock().enterCriticalSection(Lock.READ);
|
||||||
queryStr = " SELECT ?x WHERE { ?x ?p ?y } LIMIT 10";
|
|
||||||
QueryExecution qexec = null;
|
QueryExecution qexec = null;
|
||||||
ResultSet results = null;
|
ResultSet results = null;
|
||||||
try {
|
try {
|
||||||
qexec = QueryExecutionFactory.create(queryStr, dataset);
|
qexec = QueryExecutionFactory.create(queryStr, dataset);
|
||||||
results = qexec.execSelect();
|
results = new ResultSetMem(qexec.execSelect());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e, e);
|
log.error(e, e);
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -124,32 +126,8 @@ queryStr = " SELECT ?x WHERE { ?x ?p ?y } LIMIT 10";
|
||||||
qexec.close();
|
qexec.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
|
||||||
/* DEBUGGING */
|
|
||||||
int maxRank = 0;
|
|
||||||
if (results.hasNext()) { // there is at most one result
|
|
||||||
log.debug("found a rank");
|
|
||||||
QuerySolution soln = results.next();
|
|
||||||
RDFNode node = soln.get("rank");
|
|
||||||
if (node != null && node.isLiteral()) {
|
|
||||||
log.debug("node value =" + node.asLiteral().getLexicalForm());
|
|
||||||
try {
|
|
||||||
int rank = node.asLiteral().getInt();
|
|
||||||
if (rank > maxRank) {
|
|
||||||
log.debug("setting maxRank to " + rank);
|
|
||||||
maxRank = rank;
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error("Error getting int value for rank: " + e.getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
|
||||||
log.error(e, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,264 +0,0 @@
|
||||||
<%-- $This file is distributed under the terms of the license in /doc/license.txt$ --%>
|
|
||||||
|
|
||||||
<%@ page import="edu.cornell.mannlib.vitro.webapp.controller.VitroRequest" %>
|
|
||||||
<%@ page import="edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory" %>
|
|
||||||
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty" %>
|
|
||||||
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.VClass" %>
|
|
||||||
<%@ page import="com.hp.hpl.jena.rdf.model.Literal" %>
|
|
||||||
<%@ page import="com.hp.hpl.jena.rdf.model.Model" %>
|
|
||||||
<%@ page import="edu.cornell.mannlib.vitro.webapp.beans.Individual" %>
|
|
||||||
<%@ page import="edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.EditConfiguration" %>
|
|
||||||
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
|
|
||||||
<%@ taglib prefix="v" uri="http://vitro.mannlib.cornell.edu/vitro/tags" %>
|
|
||||||
<%
|
|
||||||
Individual subject = (Individual)request.getAttribute("subject");
|
|
||||||
ObjectProperty prop = (ObjectProperty)request.getAttribute("predicate");
|
|
||||||
if (prop == null) throw new Error("no object property specified via incoming predicate attribute in defaultAddMissingIndividualForm.jsp");
|
|
||||||
String propDomainPublic = (prop.getDomainPublic() == null) ? "affiliation" : prop.getDomainPublic();
|
|
||||||
|
|
||||||
VitroRequest vreq = new VitroRequest(request);
|
|
||||||
//String contextPath = vreq.getContextPath();
|
|
||||||
WebappDaoFactory wdf = vreq.getWebappDaoFactory();
|
|
||||||
if( prop.getRangeVClassURI() == null )throw new Error("Property has null for its range class URI");
|
|
||||||
|
|
||||||
VClass rangeClass = wdf.getVClassDao().getVClassByURI(prop.getRangeVClassURI());
|
|
||||||
if( rangeClass == null ) throw new Error ("Cannot find class for range for property. Looking for " + prop.getRangeVClassURI() );
|
|
||||||
//vreq.setAttribute("rangeClassLocalName",rangeClass.getLocalName());
|
|
||||||
//vreq.setAttribute("rangeClassNamespace",rangeClass.getNamespace());
|
|
||||||
vreq.setAttribute("rangeClassUri",prop.getRangeVClassURI());
|
|
||||||
vreq.setAttribute("curatorReviewUri","http://vivo.library.cornell.edu/ns/0.1#CuratorReview");
|
|
||||||
|
|
||||||
%>
|
|
||||||
|
|
||||||
<v:jsonset var="queryForInverse" >
|
|
||||||
PREFIX owl: <http://www.w3.org/2002/07/owl#>
|
|
||||||
SELECT ?inverse_property
|
|
||||||
WHERE { ?inverse_property owl:inverseOf ?predicate }
|
|
||||||
</v:jsonset>
|
|
||||||
|
|
||||||
<%-- Enter here the class names to be used for constructing MONIKERS_VIA_VCLASS pick lists
|
|
||||||
These are then referenced in the field's ObjectClassUri but not elsewhere.
|
|
||||||
Note that you can't reference a jsonset variable inside another jsonset expression
|
|
||||||
or you get double escaping problems --%>
|
|
||||||
<v:jsonset var="newIndividualVClassUri">${rangeClassUri}</v:jsonset>
|
|
||||||
|
|
||||||
<%-- Then enter a SPARQL query for each field, by convention concatenating the field id with "Existing"
|
|
||||||
to convey that the expression is used to retrieve any existing value for the field in an existing individual.
|
|
||||||
Each of these must then be referenced in the sparqlForExistingLiterals section of the JSON block below
|
|
||||||
and in the literalsOnForm --%>
|
|
||||||
<v:jsonset var="nameExisting" >
|
|
||||||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
|
|
||||||
SELECT ?existingName
|
|
||||||
WHERE { ?newIndividual rdfs:label ?existingName }
|
|
||||||
</v:jsonset>
|
|
||||||
<%-- Pair the "existing" query with the skeleton of what will be asserted for a new statement involving this field.
|
|
||||||
the actual assertion inserted in the model will be created via string substitution into the ? variables.
|
|
||||||
NOTE the pattern of punctuation (a period after the prefix URI and after the ?field) --%>
|
|
||||||
<v:jsonset var="nameAssertion" >
|
|
||||||
@prefix vivo: <http://vivo.library.cornell.edu/ns/0.1#> .
|
|
||||||
?newIndividual rdfs:label ?name .
|
|
||||||
</v:jsonset>
|
|
||||||
|
|
||||||
<v:jsonset var="monikerExisting" >
|
|
||||||
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
|
|
||||||
SELECT ?existingMoniker
|
|
||||||
WHERE { ?newIndividual vitro:moniker ?existingMoniker }
|
|
||||||
</v:jsonset>
|
|
||||||
<v:jsonset var="monikerAssertion" >
|
|
||||||
@prefix vivo: <http://vivo.library.cornell.edu/ns/0.1#> .
|
|
||||||
?newIndividual vitro:moniker ?moniker .
|
|
||||||
</v:jsonset>
|
|
||||||
|
|
||||||
<v:jsonset var="linkUrlExisting" >
|
|
||||||
PREFIX vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#>
|
|
||||||
SELECT ?existingLinkUrl
|
|
||||||
WHERE { ?newIndividual vitro:primaryLink ?newLink ;
|
|
||||||
?newLink vitro:linkURL ?existingLinkUrl .
|
|
||||||
}
|
|
||||||
</v:jsonset>
|
|
||||||
<v:jsonset var="linkUrlAssertion" >
|
|
||||||
@prefix vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> .
|
|
||||||
?newLink vitro:linkURL ?linkUrl .
|
|
||||||
</v:jsonset>
|
|
||||||
|
|
||||||
<v:jsonset var="n3ForEdit" >
|
|
||||||
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|
|
||||||
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
|
||||||
@prefix vivo: <http://vivo.library.cornell.edu/ns/0.1#> .
|
|
||||||
@prefix vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> .
|
|
||||||
|
|
||||||
?newIndividual rdf:type <${curatorReviewUri}> .
|
|
||||||
?newIndividual rdf:type <${rangeClassUri}> .
|
|
||||||
?subject ?predicate ?newIndividual .
|
|
||||||
|
|
||||||
?newIndividual rdfs:label ?name .
|
|
||||||
</v:jsonset>
|
|
||||||
|
|
||||||
<v:jsonset var="n3Inverse" >
|
|
||||||
?newIndividual ?inverseProp ?subject .
|
|
||||||
</v:jsonset>
|
|
||||||
|
|
||||||
<%-- make sure you have all the @prefix entries to cover the statements in each block --%>
|
|
||||||
<v:jsonset var="n3optional" >
|
|
||||||
@prefix vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> .
|
|
||||||
?newIndividual vitro:moniker ?moniker .
|
|
||||||
</v:jsonset>
|
|
||||||
|
|
||||||
<%-- note that it's safer to have multiple distinct optional blocks so that a failure in one
|
|
||||||
will not prevent correct sections from being inserted --%>
|
|
||||||
<v:jsonset var="n3link" >
|
|
||||||
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|
|
||||||
@prefix vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> .
|
|
||||||
?newLink
|
|
||||||
rdf:type vitro:Link ;
|
|
||||||
vitro:linkURL ?linkUrl ;
|
|
||||||
vitro:linkAnchor ?name ;
|
|
||||||
vitro:linkDisplayRank "1" .
|
|
||||||
|
|
||||||
?newIndividual vitro:primaryLink ?newLink .
|
|
||||||
</v:jsonset>
|
|
||||||
|
|
||||||
|
|
||||||
<c:set var="editjson" scope="request">
|
|
||||||
{
|
|
||||||
"formUrl" : "${formUrl}",
|
|
||||||
"editKey" : "${editKey}",
|
|
||||||
"urlPatternToReturnTo" : "/entity",
|
|
||||||
|
|
||||||
"subject" : [ "subject", "${subjectUriJson}" ],
|
|
||||||
"predicate" : [ "predicate", "${predicateUriJson}" ],
|
|
||||||
"object" : [ "newIndividual", "${objectUriJson}", "URI" ],
|
|
||||||
|
|
||||||
"n3required" : [ "${n3ForEdit}" ],
|
|
||||||
"n3optional" : [ "${n3optional}", "${n3Inverse}", "${n3link}" ],
|
|
||||||
"newResources" : {
|
|
||||||
"newIndividual" : "http://vivo.library.cornell.edu/ns/0.1#individual",
|
|
||||||
"newLink" : "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#Link"
|
|
||||||
},
|
|
||||||
"urisInScope" : { },
|
|
||||||
"literalsInScope" : { },
|
|
||||||
"urisOnForm" : [ ],
|
|
||||||
"literalsOnForm" : [ "name","moniker","linkUrl" ],
|
|
||||||
"filesOnForm" : [ ],
|
|
||||||
"sparqlForLiterals" : { },
|
|
||||||
"sparqlForUris" : { "inverseProp" : "${queryForInverse}" },
|
|
||||||
"sparqlForExistingLiterals" : {
|
|
||||||
"name" : "${nameExisting}",
|
|
||||||
"moniker" : "${monikerExisting}",
|
|
||||||
"linkUrl" : "${linkUrlExisting}"
|
|
||||||
},
|
|
||||||
"sparqlForExistingUris" : { },
|
|
||||||
"fields" : {
|
|
||||||
"name" : {
|
|
||||||
"newResource" : "false",
|
|
||||||
"validators" : [ "nonempty" ],
|
|
||||||
"optionsType" : "UNDEFINED",
|
|
||||||
"literalOptions" : [ ],
|
|
||||||
"predicateUri" : "",
|
|
||||||
"objectClassUri" : "",
|
|
||||||
"rangeDatatypeUri" : "",
|
|
||||||
"rangeLang" : "",
|
|
||||||
"assertions" : [ "${nameAssertion}" ]
|
|
||||||
},
|
|
||||||
"moniker" : {
|
|
||||||
"newResource" : "false",
|
|
||||||
"validators" : [ ],
|
|
||||||
"optionsType" : "MONIKERS_VIA_VCLASS",
|
|
||||||
"literalOptions" : [ ],
|
|
||||||
"predicateUri" : "",
|
|
||||||
"objectClassUri" : "${newIndividualVClassUri}",
|
|
||||||
"rangeDatatypeUri" : "",
|
|
||||||
"rangeLang" : "",
|
|
||||||
"assertions" : [ "${monikerAssertion}" ]
|
|
||||||
},
|
|
||||||
"linkUrl" : {
|
|
||||||
"newResource" : "false",
|
|
||||||
"validators" : [],
|
|
||||||
"optionsType" : "UNDEFINED",
|
|
||||||
"literalOptions" : [],
|
|
||||||
"predicateUri" : "",
|
|
||||||
"objectClassUri" : "",
|
|
||||||
"rangeDatatypeUri" : "",
|
|
||||||
"rangeLang" : "",
|
|
||||||
"assertions" : [ "${linkUrlAssertion}" ]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</c:set>
|
|
||||||
<%
|
|
||||||
EditConfiguration editConfig = EditConfiguration.getConfigFromSession(session,request);
|
|
||||||
if( editConfig == null ){
|
|
||||||
editConfig = new EditConfiguration((String)request.getAttribute("editjson"));
|
|
||||||
EditConfiguration.putConfigInSession(editConfig, session);
|
|
||||||
}
|
|
||||||
|
|
||||||
Model model = (Model)application.getAttribute("jenaOntModel");
|
|
||||||
String objectUri = (String)request.getAttribute("objectUri");
|
|
||||||
if( objectUri != null ){
|
|
||||||
editConfig.prepareForObjPropUpdate(model);
|
|
||||||
}else{
|
|
||||||
editConfig.prepareForNonUpdate(model);
|
|
||||||
}
|
|
||||||
|
|
||||||
String submitButtonLabel=""; // don't put local variables into the request
|
|
||||||
/* title is used by pre and post form fragments */
|
|
||||||
//set title to Edit to maintain functionality from 1.1.1 and avoid updates to Selenium tests
|
|
||||||
request.setAttribute("title", "Edit");
|
|
||||||
if (objectUri != null) {
|
|
||||||
request.setAttribute("formTitle", "Edit \""+propDomainPublic+"\" entry for " + subject.getName());
|
|
||||||
submitButtonLabel = "Save changes";
|
|
||||||
} else {
|
|
||||||
request.setAttribute("formTitle","Create \""+propDomainPublic+"\" entry for " + subject.getName());
|
|
||||||
submitButtonLabel = "Create \""+propDomainPublic+"\" entry";
|
|
||||||
}
|
|
||||||
|
|
||||||
%>
|
|
||||||
|
|
||||||
<jsp:include page="${preForm}">
|
|
||||||
<jsp:param name="useTinyMCE" value="false"/>
|
|
||||||
<jsp:param name="useAutoComplete" value="true"/>
|
|
||||||
</jsp:include>
|
|
||||||
|
|
||||||
<script type="text/javascript" language="javascript">
|
|
||||||
$(this).load($(this).parent().children('a').attr('src')+" .editForm");
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
|
||||||
var key = $("input[name='editKey']").attr("value");
|
|
||||||
$.getJSON("<c:url value="/dataservice"/>", {getN3EditOptionList:"1", field: "moniker", editKey: key}, function(json){
|
|
||||||
|
|
||||||
$("select#moniker").replaceWith("<input type='text' id='moniker' name='moniker' />");
|
|
||||||
|
|
||||||
$("#moniker").autocomplete(json, {
|
|
||||||
minChars: 0,
|
|
||||||
width: 320,
|
|
||||||
matchContains: true,
|
|
||||||
mustMatch: 0,
|
|
||||||
autoFill: false,
|
|
||||||
formatItem: function(row, i, max) {
|
|
||||||
return row[0];
|
|
||||||
},
|
|
||||||
formatMatch: function(row, i, max) {
|
|
||||||
return row[0];
|
|
||||||
},
|
|
||||||
formatResult: function(row) {
|
|
||||||
return row[0];
|
|
||||||
}
|
|
||||||
|
|
||||||
}).result(function(event, data, formatted) {
|
|
||||||
$("input#moniker").attr("value", data[1]);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
);
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<h2>${formTitle}</h2>
|
|
||||||
<form action="<c:url value="/edit/processRdfForm2.jsp"/>" >
|
|
||||||
<v:input type="text" label="name (required)" id="name" size="30"/>
|
|
||||||
<hr/>
|
|
||||||
<v:input type="select" label="label (optional)" id="moniker"/> <em>start typing to see existing choices, or add a new label</em>
|
|
||||||
<v:input type="text" label="associated web page (optional)" id="linkUrl" size="50"/>
|
|
||||||
<v:input type="submit" id="submit" value="<%=submitButtonLabel%>" cancel="true"/>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
<jsp:include page="${postForm}"/>
|
|
Loading…
Add table
Reference in a new issue