Save query and rules at compilation creation
This commit is contained in:
parent
293804fcfb
commit
74545944e4
3 changed files with 80 additions and 37 deletions
|
@ -53,13 +53,23 @@ public class CompilationGenerator extends BaseEditConfigurationGenerator impleme
|
|||
config.setTemplate( "compilationForm.ftl" );
|
||||
|
||||
config.setN3Required( generateN3Required(vreq));
|
||||
|
||||
//Optional because user may have selected either person or individual of another kind
|
||||
//Person uses first name and last name whereas individual of other class would use label
|
||||
//middle name is also optional
|
||||
config.setN3Optional(generateN3Optional());
|
||||
//config.setN3Optional(generateN3Optional());
|
||||
|
||||
config.addNewResource("newCompilation", vreq.getWebappDaoFactory().getDefaultNamespace());
|
||||
config.addNewResource("newCompilationTOC", vreq.getWebappDaoFactory().getDefaultNamespace());
|
||||
config.addField(new FieldVTwo().
|
||||
setName("rawQueryString").
|
||||
setRangeDatatypeUri(XSD.xstring.getURI()).
|
||||
setValidators(getCompilationNameValidators(vreq)));
|
||||
config.addField(new FieldVTwo().
|
||||
setName("queryBuilderRules").
|
||||
setRangeDatatypeUri(XSD.xstring.getURI()).
|
||||
setValidators(getCompilationNameValidators(vreq)));
|
||||
|
||||
for (int itemN = 1; itemN <= excerptsCounter; itemN++) {
|
||||
String tocItem = "tocItem" + itemN;
|
||||
config.addNewResource(tocItem, vreq.getWebappDaoFactory().getDefaultNamespace());
|
||||
|
@ -131,6 +141,8 @@ public class CompilationGenerator extends BaseEditConfigurationGenerator impleme
|
|||
String tocLevelName = "tocLevel" + itemN + "Name";
|
||||
literals.add(tocItemName);
|
||||
literals.add(tocLevelName);
|
||||
literals.add("rawQueryString");
|
||||
literals.add("queryBuilderRules");
|
||||
}
|
||||
return literals;
|
||||
}
|
||||
|
@ -153,10 +165,13 @@ public class CompilationGenerator extends BaseEditConfigurationGenerator impleme
|
|||
n3Req.append("@prefix ts: <https://litvinovg.pro/text_structures#> .\n");
|
||||
n3Req.append("?newCompilation <" + VitroVocabulary.RDF_TYPE + "> <" + getTypeOfNew(vreq) + "> .\n");
|
||||
n3Req.append("?newCompilation <https://litvinovg.pro/text_structures#modificationTime> " + getModificationTime() + " .\n");
|
||||
n3Req.append("?newCompilation ts:rawQueryString ?rawQueryString .\n");
|
||||
n3Req.append("?newCompilation ts:queryBuilderRules ?queryBuilderRules .\n");
|
||||
n3Req.append("?newCompilation <" + RDFS.label.getURI() + "> ?newCompilationLabel .\n");
|
||||
n3Req.append("?newCompilation ts:hasTOC ?newCompilationTOC .\n");
|
||||
n3Req.append("?newCompilationTOC <" + VitroVocabulary.RDF_TYPE + "> ts:TOC .\n");
|
||||
n3Req.append("?newCompilationTOC <" + RDFS.label.getURI() + "> ?newCompilationLabel .\n");
|
||||
|
||||
if (!associatedProfile.isEmpty()) {
|
||||
n3Req.append("<" + associatedProfile + "> ts:compilatorOf ?newCompilation .\n");
|
||||
|
||||
|
@ -180,6 +195,16 @@ public class CompilationGenerator extends BaseEditConfigurationGenerator impleme
|
|||
}
|
||||
return list(n3Req.toString());
|
||||
}
|
||||
|
||||
private List<String> generateN3Optional() {
|
||||
List<String> n3OptList = list();
|
||||
StringBuilder n3Opt = new StringBuilder();
|
||||
n3Opt.append("@prefix ts: <https://litvinovg.pro/text_structures#> .\n");
|
||||
n3Opt.append("?newCompilation ts:rawQueryString ?rawQueryString .\n");
|
||||
n3Opt.append("?newCompilation ts:queryBuilderRules ?queryBuilderRules .\n");
|
||||
n3OptList.add(n3Opt.toString());
|
||||
return n3OptList;
|
||||
}
|
||||
|
||||
private String getModificationTime() {
|
||||
SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
|
||||
|
@ -201,21 +226,14 @@ public class CompilationGenerator extends BaseEditConfigurationGenerator impleme
|
|||
}
|
||||
}
|
||||
|
||||
private List<String> generateN3Optional() {
|
||||
return getUrisOnForm();
|
||||
}
|
||||
|
||||
|
||||
//first and last name have validators if is person is true
|
||||
private List<String> getCompilationNameValidators(VitroRequest vreq) {
|
||||
List<String> validators = new ArrayList<String>();
|
||||
if(isCompilationType(vreq)) {
|
||||
validators.add("nonempty");
|
||||
}
|
||||
return validators;
|
||||
}
|
||||
|
||||
|
||||
List<String> validators = new ArrayList<String>();
|
||||
if (isCompilationType(vreq)) {
|
||||
validators.add("nonempty");
|
||||
}
|
||||
return validators;
|
||||
}
|
||||
|
||||
//Get parameter from HTTP request for type of new individual
|
||||
private String getTypeOfNew(VitroRequest vreq) {
|
||||
|
|
|
@ -287,6 +287,24 @@
|
|||
<vitro:selectFromExistingAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean"
|
||||
>true</vitro:selectFromExistingAnnot>
|
||||
</owl:ObjectProperty>
|
||||
<owl:DatatypeProperty rdf:about="https://litvinovg.pro/text_structures#queryBuilderRules">
|
||||
<rdfs:label xml:lang="en-US">Query Builder Rules</rdfs:label>
|
||||
<rdfs:domain rdf:resource="https://litvinovg.pro/text_structures#compilation"/>
|
||||
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
|
||||
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#FunctionalProperty"/>
|
||||
<vitro:hiddenFromDisplayBelowRoleLevelAnnot rdf:resource="http://vitro.mannlib.cornell.edu/ns/vitro/role#public"/>
|
||||
<vitro:prohibitedFromUpdateBelowRoleLevelAnnot rdf:resource="http://vitro.mannlib.cornell.edu/ns/vitro/role#public"/>
|
||||
<vitro:hiddenFromPublishBelowRoleLevelAnnot rdf:resource="http://vitro.mannlib.cornell.edu/ns/vitro/role#public"/>
|
||||
</owl:DatatypeProperty>
|
||||
<owl:DatatypeProperty rdf:about="https://litvinovg.pro/text_structures#rawQueryString">
|
||||
<rdfs:label xml:lang="en-US">Raw Query String</rdfs:label>
|
||||
<rdfs:domain rdf:resource="https://litvinovg.pro/text_structures#compilation"/>
|
||||
<rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#string"/>
|
||||
<rdf:type rdf:resource="http://www.w3.org/2002/07/owl#FunctionalProperty"/>
|
||||
<vitro:hiddenFromDisplayBelowRoleLevelAnnot rdf:resource="http://vitro.mannlib.cornell.edu/ns/vitro/role#public"/>
|
||||
<vitro:prohibitedFromUpdateBelowRoleLevelAnnot rdf:resource="http://vitro.mannlib.cornell.edu/ns/vitro/role#public"/>
|
||||
<vitro:hiddenFromPublishBelowRoleLevelAnnot rdf:resource="http://vitro.mannlib.cornell.edu/ns/vitro/role#public"/>
|
||||
</owl:DatatypeProperty>
|
||||
<owl:DatatypeProperty rdf:about="https://litvinovg.pro/text_structures#participantInitials">
|
||||
<vitro:hiddenFromPublishBelowRoleLevelAnnot rdf:resource="http://vitro.mannlib.cornell.edu/ns/vitro/role#public"/>
|
||||
<vitro:prohibitedFromUpdateBelowRoleLevelAnnot rdf:resource="http://vitro.mannlib.cornell.edu/ns/vitro/role#public"/>
|
||||
|
|
|
@ -48,32 +48,39 @@
|
|||
<form id="newCompilation" class="customForm noIE67" action="${submitUrl}" role="add new individual" method="POST">
|
||||
|
||||
<#if isCompilationType = "true">
|
||||
<p>
|
||||
<label for="newCompilationLabel">${i18n().name_capitalized} ${requiredHint}</label>
|
||||
<input size="30" type="text" id="newCompilationLabel" name="newCompilationLabel" value="${newCompilationLabel}" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="newCompilationLabel">${i18n().name_capitalized} ${requiredHint}</label>
|
||||
<input size="30" type="text" id="newCompilationLabel" name="newCompilationLabel" value="${newCompilationLabel}" />
|
||||
</p>
|
||||
<#if excerptsCounter > 0 >
|
||||
<#list 1..excerptsCounter as i>
|
||||
<p>
|
||||
<label for="tocItem${i}Name">TOC Item ${i} name ${requiredHint}</label>
|
||||
<input size="30" type="text" id="tocItem${i}Name" name="tocItem${i}Name" value="" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="tocLevel${i}Name">TOC Level ${i} name ${requiredHint}</label>
|
||||
<input size="30" type="text" id="tocLevel${i}Name" name="tocLevel${i}Name" value="" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="excerpt${i}">Excerpt ${i} URI ${requiredHint}</label>
|
||||
<input size="30" type="text" id="excerpt${i}" name="excerpt${i}" value="" />
|
||||
</p>
|
||||
|
||||
</#list>
|
||||
<#list 1..excerptsCounter as i>
|
||||
<p>
|
||||
<label for="tocItem${i}Name">TOC Item ${i} name ${requiredHint}</label>
|
||||
<input size="30" type="text" id="tocItem${i}Name" name="tocItem${i}Name" value="" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="tocLevel${i}Name">TOC Level ${i} name ${requiredHint}</label>
|
||||
<input size="30" type="text" id="tocLevel${i}Name" name="tocLevel${i}Name" value="" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="excerpt${i}">Excerpt ${i} URI ${requiredHint}</label>
|
||||
<input size="30" type="text" id="excerpt${i}" name="excerpt${i}" value="" />
|
||||
</p>
|
||||
</#list>
|
||||
</#if>
|
||||
<p>
|
||||
<label for="rawQueryString">Search query</label>
|
||||
<input size="30" type="text" id="rawQueryString" name="rawQueryString" value="" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="queryBuilderRules">Query builder rules </label>
|
||||
<input size="30" type="text" id="queryBuilderRules" name="queryBuilderRules" value="" />
|
||||
</p>
|
||||
<#else>
|
||||
<p>
|
||||
<label for="newCompilationLabel">${i18n().name_capitalized} ${requiredHint}</label>
|
||||
<input size="30" type="text" id="firstName" name="firstName" value="${newCompilationLabel}" />
|
||||
</p>
|
||||
<p>
|
||||
<label for="newCompilationLabel">${i18n().name_capitalized} ${requiredHint}</label>
|
||||
<input size="30" type="text" id="firstName" name="firstName" value="${newCompilationLabel}" />
|
||||
</p>
|
||||
</#if>
|
||||
|
||||
<p class="submit">
|
||||
|
|
Loading…
Add table
Reference in a new issue