updates for menu management
This commit is contained in:
parent
5f14a66774
commit
7e4cf9a5c7
11 changed files with 429 additions and 97 deletions
134
webapp/ontologies/app/application.owl
Normal file
134
webapp/ontologies/app/application.owl
Normal file
|
@ -0,0 +1,134 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE rdf:RDF [
|
||||||
|
<!ENTITY display "http://vitro.mannlib.cornell.edu/ontologies/display/1.1#">
|
||||||
|
<!ENTITY owl "http://www.w3.org/2002/07/owl#">
|
||||||
|
<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#">
|
||||||
|
<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#">
|
||||||
|
<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#">
|
||||||
|
<!ENTITY vitro "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#">
|
||||||
|
|
||||||
|
]>
|
||||||
|
<rdf:RDF xml:base="http://vitro.mannlib.cornell.edu/ontologies/display/1.1/"
|
||||||
|
xmlns:display="&display;"
|
||||||
|
xmlns:owl="&owl;"
|
||||||
|
xmlns:rdf="&rdf;"
|
||||||
|
xmlns:rdfs="&rdfs;"
|
||||||
|
xmlns:vitro="&vitro;">
|
||||||
|
|
||||||
|
<!-- Ontology Information -->
|
||||||
|
<owl:Ontology rdf:about=""
|
||||||
|
rdfs:label="Vitro display ontology"
|
||||||
|
owl:versionInfo="1.1"/>
|
||||||
|
|
||||||
|
<!-- Classes -->
|
||||||
|
<owl:Class rdf:about="#Menu"/>
|
||||||
|
<owl:Class rdf:about="#parameter"/>
|
||||||
|
<owl:Class rdf:about="&display;ExternallyLinkedNamespace"
|
||||||
|
rdfs:label="Externally Linked Namespace"/>
|
||||||
|
<owl:Class rdf:about="&display;NavigationElement"
|
||||||
|
rdfs:label="Navigation Element">
|
||||||
|
<rdfs:comment>This represents a menu item or other general navigation item.</rdfs:comment>
|
||||||
|
</owl:Class>
|
||||||
|
|
||||||
|
<owl:Class rdf:about="&display;Page"
|
||||||
|
rdfs:comment="Class of pages."
|
||||||
|
rdfs:label="Page"/>
|
||||||
|
<owl:Class rdf:about="&rdfs;subPropertyOf"/>
|
||||||
|
<owl:Class rdf:about="&owl;NamedIndividual"/>
|
||||||
|
<owl:Class rdf:about="&owl;DatatypeProperty"/>
|
||||||
|
<owl:Class rdf:about="&owl;ObjectProperty"/>
|
||||||
|
<owl:Class rdf:about="&owl;AnnotationProperty"/>
|
||||||
|
|
||||||
|
|
||||||
|
<owl:Class rdf:about="&owl;Class"/>
|
||||||
|
<owl:Class rdf:about="&display;MainMenu">
|
||||||
|
<vitro:customDisplayViewAnnot rdf:datatype="http://www.w3.org/2001/XMLSchema#string">
|
||||||
|
individual-menu.ftl
|
||||||
|
</vitro:customDisplayViewAnnot>
|
||||||
|
</owl:Class>
|
||||||
|
<owl:Class rdf:about="&owl;Ontology"/>
|
||||||
|
|
||||||
|
<!-- types of pages -->
|
||||||
|
<owl:Class rdf:about="&display;HomePage"/>
|
||||||
|
<owl:Class rdf:about="&display;ClassGroupPage"/>
|
||||||
|
<owl:Class rdf:about="&display;IndividualsForClassesPage"/>
|
||||||
|
<owl:Class rdf:about="&display;InternalClassesPage"/>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Annotation Properties -->
|
||||||
|
<owl:AnnotationProperty rdf:about="&rdfs;comment"/>
|
||||||
|
<owl:AnnotationProperty rdf:about="&rdfs;label"/>
|
||||||
|
<owl:AnnotationProperty rdf:about="&owl;versionInfo"/>
|
||||||
|
|
||||||
|
<!-- Datatype Properties -->
|
||||||
|
<owl:DatatypeProperty rdf:about="&owl;DatatypeProperty"/>
|
||||||
|
<owl:DatatypeProperty rdf:about="&owl;topDataProperty"/>
|
||||||
|
<!--Originall generated - check if need these-->
|
||||||
|
<owl:DatatypeProperty rdf:about="&rdfs;comment"/>
|
||||||
|
<owl:DatatypeProperty rdf:about="&rdfs;label"/>
|
||||||
|
<owl:DatatypeProperty rdf:about="&owl;versionInfo"/>
|
||||||
|
<!--end originally generated -->
|
||||||
|
|
||||||
|
<owl:DatatypeProperty rdf:about="&display;linkText"
|
||||||
|
rdfs:comment="Text to display to a link.">
|
||||||
|
</owl:DatatypeProperty>
|
||||||
|
|
||||||
|
<owl:DatatypeProperty rdf:about="&display;menuPosition"
|
||||||
|
rdfs:label="menu position">
|
||||||
|
</owl:DatatypeProperty>
|
||||||
|
|
||||||
|
<owl:DatatypeProperty rdf:about="&display;parameterName"
|
||||||
|
rdfs:label="parameter name"/>
|
||||||
|
<owl:DatatypeProperty rdf:about="&display;parameterValue"
|
||||||
|
rdfs:label="parameter value"/>
|
||||||
|
<owl:DatatypeProperty rdf:about="&display;requiresBodyTemplate"
|
||||||
|
rdfs:label="Body Template">
|
||||||
|
<rdfs:comment>Indicates that a page requires a body template.</rdfs:comment>
|
||||||
|
<rdfs:domain rdf:resource="&display;Page"/>
|
||||||
|
</owl:DatatypeProperty>
|
||||||
|
|
||||||
|
<owl:DatatypeProperty rdf:about="&display;title"
|
||||||
|
rdfs:comment="Value for HTML title element."
|
||||||
|
rdfs:label="title">
|
||||||
|
<rdfs:domain rdf:resource="&display;Page"/>
|
||||||
|
</owl:DatatypeProperty>
|
||||||
|
|
||||||
|
<owl:DatatypeProperty rdf:about="&display;urlMapping">
|
||||||
|
<rdfs:comment>Values from HttpRequest.getPathInfo() will be mapped to values from urlMapping.</rdfs:comment>
|
||||||
|
</owl:DatatypeProperty>
|
||||||
|
|
||||||
|
<owl:DatatypeProperty rdf:about="&display;listViewConfigFile"/>
|
||||||
|
<owl:DatatypeProperty rdf:about="&display;restrictResultsByInternalClass"/>
|
||||||
|
|
||||||
|
<!-- Object Properties -->
|
||||||
|
<owl:ObjectProperty rdf:about="&owl;topObjectProperty"/>
|
||||||
|
<owl:ObjectProperty rdf:about="&rdfs;domain"/>
|
||||||
|
<owl:ObjectProperty rdf:about="&rdfs;range"/>
|
||||||
|
<owl:ObjectProperty rdf:about="&display;hasElement">
|
||||||
|
</owl:ObjectProperty>
|
||||||
|
|
||||||
|
<owl:ObjectProperty rdf:about="#hasParameter">
|
||||||
|
<rdfs:domain rdf:resource="&display;Page"/>
|
||||||
|
<rdfs:range rdf:resource="#parameter"/>
|
||||||
|
</owl:ObjectProperty>
|
||||||
|
|
||||||
|
<owl:ObjectProperty rdf:about="excludeClass">
|
||||||
|
</owl:ObjectProperty>
|
||||||
|
|
||||||
|
<owl:ObjectProperty rdf:about="includeClass">
|
||||||
|
</owl:ObjectProperty>
|
||||||
|
|
||||||
|
<owl:ObjectProperty rdf:about="&display;toPage">
|
||||||
|
<rdfs:domain rdf:resource="&display;NavigationElement"/>
|
||||||
|
<rdfs:range rdf:resource="&display;Page"/>
|
||||||
|
</owl:ObjectProperty>
|
||||||
|
<owl:ObjectProperty rdf:about="&display;forClassGroup"/>
|
||||||
|
<owl:ObjectProperty rdf:about="&display;excludeClass"/>
|
||||||
|
<owl:ObjectProperty rdf:about="&display;restrictResultsByClass"/>
|
||||||
|
<owl:ObjectProperty rdf:about="&display;getIndividualsForClass"/>
|
||||||
|
<owl:ObjectProperty rdf:about="&display;hasDataGetter"/>
|
||||||
|
|
||||||
|
<!--Custom properties-->
|
||||||
|
|
||||||
|
|
||||||
|
</rdf:RDF>
|
96
webapp/ontologies/app/menuload/displayDisplay.n3
Normal file
96
webapp/ontologies/app/menuload/displayDisplay.n3
Normal file
|
@ -0,0 +1,96 @@
|
||||||
|
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
||||||
|
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
|
||||||
|
@prefix owl: <http://www.w3.org/2002/07/owl#> .
|
||||||
|
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|
||||||
|
|
||||||
|
<http://vitro.mannlib.cornell.edu/ontologies/display/1.1#MenuText>
|
||||||
|
<http://vitro.mannlib.cornell.edu/ontologies/display/1.1#hasMenuText>
|
||||||
|
"""# $This file is distributed under the terms of the license in /doc/license.txt$
|
||||||
|
|
||||||
|
@prefix owl: <http://www.w3.org/2002/07/owl#> .
|
||||||
|
@prefix display: <http://vitro.mannlib.cornell.edu/ontologies/display/1.1#> .
|
||||||
|
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|
||||||
|
@prefix core: <http://vivoweb.org/ontology/core#> .
|
||||||
|
@prefix vivoweb: <http://vivoweb.org/ontology#> .
|
||||||
|
|
||||||
|
### This file defines the default menu for vivo. ###
|
||||||
|
|
||||||
|
#### Default Menu ####
|
||||||
|
|
||||||
|
display:DefaultMenu
|
||||||
|
a display:MainMenu ;
|
||||||
|
display:hasElement display:EventsMenuItem ;
|
||||||
|
display:hasElement display:HomeMenuItem ;
|
||||||
|
display:hasElement display:OrganizationsMenuItem ;
|
||||||
|
display:hasElement display:PeopleMenuItem ;
|
||||||
|
display:hasElement display:ResearchMenuItem .
|
||||||
|
|
||||||
|
#### Menu Items for Default Menu ####
|
||||||
|
|
||||||
|
display:HomeMenuItem
|
||||||
|
a display:NavigationElement ;
|
||||||
|
display:menuPosition 1;
|
||||||
|
display:linkText \"Home\";
|
||||||
|
display:toPage display:Home .
|
||||||
|
|
||||||
|
display:PeopleMenuItem
|
||||||
|
a display:NavigationElement ;
|
||||||
|
display:menuPosition 2;
|
||||||
|
display:linkText \"People\";
|
||||||
|
display:toPage display:People .
|
||||||
|
|
||||||
|
display:OrganizationsMenuItem
|
||||||
|
a display:NavigationElement ;
|
||||||
|
display:menuPosition 3;
|
||||||
|
display:linkText \"Organizations\";
|
||||||
|
display:toPage display:Organizations .
|
||||||
|
|
||||||
|
display:ResearchMenuItem
|
||||||
|
a display:NavigationElement ;
|
||||||
|
display:menuPosition 4;
|
||||||
|
display:linkText \"Research\";
|
||||||
|
display:toPage display:Research .
|
||||||
|
|
||||||
|
display:EventsMenuItem
|
||||||
|
a display:NavigationElement ;
|
||||||
|
display:menuPosition 5;
|
||||||
|
display:linkText \"Events\";
|
||||||
|
display:toPage display:Events .
|
||||||
|
|
||||||
|
########## Pages ############
|
||||||
|
|
||||||
|
display:Home
|
||||||
|
a display:HomePage ;
|
||||||
|
a display:Page ;
|
||||||
|
display:title \"Home\" ;
|
||||||
|
display:urlMapping \"/\" .
|
||||||
|
|
||||||
|
display:Events
|
||||||
|
a display:Page ;
|
||||||
|
a display:ClassGroupPage;
|
||||||
|
display:forClassGroup vivoweb:vitroClassGroupevents ;
|
||||||
|
display:title \"Events\" ;
|
||||||
|
display:urlMapping \"/events\" .
|
||||||
|
|
||||||
|
display:Organizations
|
||||||
|
a display:Page ;
|
||||||
|
a display:ClassGroupPage;
|
||||||
|
display:forClassGroup vivoweb:vitroClassGrouporganizations ;
|
||||||
|
display:title \"Organizations\" ;
|
||||||
|
display:urlMapping \"/organizations\" .
|
||||||
|
|
||||||
|
display:People
|
||||||
|
a display:Page ;
|
||||||
|
a display:ClassGroupPage;
|
||||||
|
display:forClassGroup vivoweb:vitroClassGrouppeople ;
|
||||||
|
display:requiresBodyTemplate \"menupage--classgroup-people.ftl\" ;
|
||||||
|
display:title \"People\" ;
|
||||||
|
display:urlMapping \"/people\" .
|
||||||
|
|
||||||
|
display:Research
|
||||||
|
a display:Page ;
|
||||||
|
a display:ClassGroupPage;
|
||||||
|
display:forClassGroup vivoweb:vitroClassGrouppublications ;
|
||||||
|
display:title \"Research\" ;
|
||||||
|
display:urlMapping \"/research\" .
|
||||||
|
""" .
|
85
webapp/ontologies/app/menuload/displayTBOX.n3
Normal file
85
webapp/ontologies/app/menuload/displayTBOX.n3
Normal file
|
@ -0,0 +1,85 @@
|
||||||
|
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
||||||
|
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
|
||||||
|
@prefix owl: <http://www.w3.org/2002/07/owl#> .
|
||||||
|
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|
||||||
|
|
||||||
|
owl:Ontology
|
||||||
|
a owl:Class .
|
||||||
|
|
||||||
|
rdfs:range
|
||||||
|
a owl:ObjectProperty .
|
||||||
|
|
||||||
|
owl:AnnotationProperty
|
||||||
|
a owl:Class .
|
||||||
|
|
||||||
|
<http://vitro.mannlib.cornell.edu/ontologies/display/1.1#urlMapping>
|
||||||
|
a owl:DatatypeProperty .
|
||||||
|
|
||||||
|
<http://vitro.mannlib.cornell.edu/ontologies/display/1.1#requiresBodyTemplate>
|
||||||
|
a owl:DatatypeProperty .
|
||||||
|
|
||||||
|
<http://vitro.mannlib.cornell.edu/ontologies/display/1.1#toPage>
|
||||||
|
a owl:ObjectProperty .
|
||||||
|
|
||||||
|
rdfs:label
|
||||||
|
a owl:DatatypeProperty .
|
||||||
|
|
||||||
|
<http://vitro.mannlib.cornell.edu/ontologies/display/1.1#excludeClass>
|
||||||
|
a owl:ObjectProperty .
|
||||||
|
|
||||||
|
owl:DatatypeProperty
|
||||||
|
a owl:Class .
|
||||||
|
|
||||||
|
rdfs:comment
|
||||||
|
a owl:DatatypeProperty .
|
||||||
|
|
||||||
|
<http://vitro.mannlib.cornell.edu/ontologies/display/1.1#forClassGroup>
|
||||||
|
a owl:ObjectProperty .
|
||||||
|
|
||||||
|
<http://vitro.mannlib.cornell.edu/ontologies/display/1.1#menuPosition>
|
||||||
|
a owl:DatatypeProperty .
|
||||||
|
|
||||||
|
<http://vitro.mannlib.cornell.edu/ontologies/display/1.1#Page>
|
||||||
|
a owl:Class .
|
||||||
|
|
||||||
|
<http://vitro.mannlib.cornell.edu/ontologies/display/1.1#HomePage>
|
||||||
|
a owl:Class .
|
||||||
|
|
||||||
|
<http://vitro.mannlib.cornell.edu/ontologies/display/1.1#hasDataGetter>
|
||||||
|
a owl:ObjectProperty .
|
||||||
|
|
||||||
|
<http://vitro.mannlib.cornell.edu/ontologies/display/1.1#ClassGroupPage>
|
||||||
|
a owl:Class .
|
||||||
|
|
||||||
|
owl:Class
|
||||||
|
a owl:Class .
|
||||||
|
|
||||||
|
<http://vitro.mannlib.cornell.edu/ontologies/display/1.1#hasElement>
|
||||||
|
a owl:ObjectProperty .
|
||||||
|
|
||||||
|
<http://vitro.mannlib.cornell.edu/ontologies/display/1.1#title>
|
||||||
|
a owl:DatatypeProperty .
|
||||||
|
|
||||||
|
owl:ObjectProperty
|
||||||
|
a owl:Class .
|
||||||
|
|
||||||
|
<http://vitro.mannlib.cornell.edu/ontologies/display/1.1#MainMenu>
|
||||||
|
a owl:Class .
|
||||||
|
|
||||||
|
rdfs:domain
|
||||||
|
a owl:ObjectProperty .
|
||||||
|
|
||||||
|
owl:versionInfo
|
||||||
|
a owl:DatatypeProperty .
|
||||||
|
|
||||||
|
<http://vitro.mannlib.cornell.edu/ontologies/display/1.1#listViewConfigFile>
|
||||||
|
a owl:DatatypeProperty .
|
||||||
|
|
||||||
|
<http://vitro.mannlib.cornell.edu/ontologies/display/1.1#linkText>
|
||||||
|
a owl:DatatypeProperty .
|
||||||
|
|
||||||
|
<http://vitro.mannlib.cornell.edu/ontologies/display/1.1#NavigationElement>
|
||||||
|
a owl:Class .
|
||||||
|
|
||||||
|
<http://vitro.mannlib.cornell.edu/ns/vitro/0.7#customDisplayViewAnnot>
|
||||||
|
a owl:DatatypeProperty .
|
|
@ -349,10 +349,16 @@ public class MenuManagementEdit extends VitroHttpServlet {
|
||||||
if(!internalClassSelected(vreq) && allClassesSelected(vreq)) {
|
if(!internalClassSelected(vreq) && allClassesSelected(vreq)) {
|
||||||
dataGetterModel = getClassGroupDataGetter(vreq, dataGetterResource, addModel, displayModel);
|
dataGetterModel = getClassGroupDataGetter(vreq, dataGetterResource, addModel, displayModel);
|
||||||
} else {
|
} else {
|
||||||
dataGetterModel = getIndividualsForClassesDataGetter(vreq, dataGetterResource, addModel, displayModel);
|
dataGetterModel = getIndividualsForClassesDataGetter(vreq, dataGetterResource, addModel, displayModel, pageResource);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
addModel.add(dataGetterModel);
|
addModel.add(dataGetterModel);
|
||||||
|
//Also add special template to page
|
||||||
|
addModel.add(addModel.createStatement(pageResource,
|
||||||
|
DisplayVocabulary.REQUIRES_BODY_TEMPLATE,
|
||||||
|
addModel.createTypedLiteral(DisplayVocabulary.INTERNAL_CLASS_TEMPLATE)));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -369,12 +375,12 @@ public class MenuManagementEdit extends VitroHttpServlet {
|
||||||
}
|
}
|
||||||
|
|
||||||
private Model getIndividualsForClassesDataGetter(VitroRequest vreq, Resource dataGetterResource,
|
private Model getIndividualsForClassesDataGetter(VitroRequest vreq, Resource dataGetterResource,
|
||||||
Model addModel, OntModel displayModel) {
|
Model addModel, OntModel displayModel, Resource pageResource) {
|
||||||
String[] selectedClasses = vreq.getParameterValues("classInClassGroup");
|
String[] selectedClasses = vreq.getParameterValues("classInClassGroup");
|
||||||
Model dgModel = ModelFactory.createDefaultModel();
|
Model dgModel = ModelFactory.createDefaultModel();
|
||||||
dgModel.add(dgModel.createStatement(dataGetterResource,
|
dgModel.add(dgModel.createStatement(dataGetterResource,
|
||||||
RDF.type,
|
RDF.type,
|
||||||
ResourceFactory.createResource(DisplayVocabulary.CLASSINDIVIDUALS_PAGE_TYPE)));
|
ResourceFactory.createResource(DisplayVocabulary.CLASSINDIVIDUALS_INTERNAL_TYPE)));
|
||||||
for(String classUri: selectedClasses) {
|
for(String classUri: selectedClasses) {
|
||||||
dgModel.add(dgModel.createStatement(
|
dgModel.add(dgModel.createStatement(
|
||||||
dataGetterResource,
|
dataGetterResource,
|
||||||
|
@ -388,8 +394,8 @@ public class MenuManagementEdit extends VitroHttpServlet {
|
||||||
//The value should be the internal class uri
|
//The value should be the internal class uri
|
||||||
dgModel.add(dgModel.createStatement(
|
dgModel.add(dgModel.createStatement(
|
||||||
dataGetterResource,
|
dataGetterResource,
|
||||||
ResourceFactory.createProperty(DisplayVocabulary.RESTRICT_RESULTS_BY),
|
ResourceFactory.createProperty(DisplayVocabulary.RESTRICT_RESULTS_BY_INTERNAL),
|
||||||
ResourceFactory.createResource(internalClass)));
|
dgModel.createLiteral("true")));
|
||||||
}
|
}
|
||||||
return dgModel;
|
return dgModel;
|
||||||
}
|
}
|
||||||
|
|
|
@ -205,6 +205,7 @@ public class IndividualListController extends FreemarkerHttpServlet {
|
||||||
try{
|
try{
|
||||||
// make query for multiple rdf types
|
// make query for multiple rdf types
|
||||||
SolrQuery query = getQuery(vclassURIs, alpha);
|
SolrQuery query = getQuery(vclassURIs, alpha);
|
||||||
|
log.debug("Executed solr query for " + vclassURIs.toString());
|
||||||
rvMap = getResultsForVClassQuery(query, page, alpha, indDao, context);
|
rvMap = getResultsForVClassQuery(query, page, alpha, indDao, context);
|
||||||
List<Individual> individuals = (List<Individual>) rvMap.get("entities");
|
List<Individual> individuals = (List<Individual>) rvMap.get("entities");
|
||||||
if (individuals == null)
|
if (individuals == null)
|
||||||
|
|
|
@ -242,7 +242,7 @@ public class InstitutionalInternalClassController extends FreemarkerHttpServlet
|
||||||
//Get current internal class
|
//Get current internal class
|
||||||
private String retrieveCurrentInternalClass() {
|
private String retrieveCurrentInternalClass() {
|
||||||
String internalClassUri = "";
|
String internalClassUri = "";
|
||||||
OntModel mainModel = (OntModel) getServletContext().getAttribute("jenaOntModel");
|
Model mainModel = ModelContext.getBaseOntModelSelector(getServletContext()).getTBoxModel();;
|
||||||
StmtIterator internalIt = mainModel.listStatements(null,
|
StmtIterator internalIt = mainModel.listStatements(null,
|
||||||
ResourceFactory.createProperty(VitroVocabulary.IS_INTERNAL_CLASSANNOT),
|
ResourceFactory.createProperty(VitroVocabulary.IS_INTERNAL_CLASSANNOT),
|
||||||
(RDFNode) null);
|
(RDFNode) null);
|
||||||
|
|
|
@ -276,7 +276,7 @@ public class MenuManagementController extends FreemarkerHttpServlet {
|
||||||
String dataGetterType = dataGetterTypes.nextStatement().getResource().getURI();
|
String dataGetterType = dataGetterTypes.nextStatement().getResource().getURI();
|
||||||
if(dataGetterType.equals(DisplayVocabulary.CLASSGROUP_PAGE_TYPE)) {
|
if(dataGetterType.equals(DisplayVocabulary.CLASSGROUP_PAGE_TYPE)) {
|
||||||
this.retrieveClassGroupPage(writeModel, dataGetter, data);
|
this.retrieveClassGroupPage(writeModel, dataGetter, data);
|
||||||
} else if(dataGetterType.equals(DisplayVocabulary.CLASSINDIVIDUALS_PAGE_TYPE)) {
|
} else if(dataGetterType.equals(DisplayVocabulary.CLASSINDIVIDUALS_INTERNAL_TYPE)) {
|
||||||
this.retrieveIndividualsForClassesPage(writeModel, dataGetter, data);
|
this.retrieveIndividualsForClassesPage(writeModel, dataGetter, data);
|
||||||
} else {
|
} else {
|
||||||
//Not sure what to do here
|
//Not sure what to do here
|
||||||
|
@ -286,13 +286,14 @@ public class MenuManagementController extends FreemarkerHttpServlet {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Based on institutional internal page and not general individualsForClasses
|
||||||
private void retrieveIndividualsForClassesPage(OntModel writeModel,
|
private void retrieveIndividualsForClassesPage(OntModel writeModel,
|
||||||
Resource dataGetter, Map<String, Object> data) {
|
Resource dataGetter, Map<String, Object> data) {
|
||||||
data.put("isIndividualsForClassesPage", true);
|
data.put("isIndividualsForClassesPage", true);
|
||||||
data.put("isClassGroupPage", false);
|
data.put("isClassGroupPage", false);
|
||||||
data.put("includeAllClasses", false);
|
data.put("includeAllClasses", false);
|
||||||
//Get the classes and put them here
|
//Get the classes and put them here
|
||||||
this.getClassesForDataGetter(writeModel, dataGetter, data);
|
this.getClassesForInternalDataGetter(writeModel, dataGetter, data);
|
||||||
//Also save the class group for display
|
//Also save the class group for display
|
||||||
this.getClassGroupForDataGetter(writeModel, dataGetter, data);
|
this.getClassGroupForDataGetter(writeModel, dataGetter, data);
|
||||||
this.checkIfPageInternal(writeModel, data);
|
this.checkIfPageInternal(writeModel, data);
|
||||||
|
@ -301,12 +302,10 @@ public class MenuManagementController extends FreemarkerHttpServlet {
|
||||||
|
|
||||||
private void checkIfPageInternal(OntModel writeModel,
|
private void checkIfPageInternal(OntModel writeModel,
|
||||||
Map<String, Object> data) {
|
Map<String, Object> data) {
|
||||||
if(data.containsKey("internalClass") && data.containsKey("restrictClasses")) {
|
//if internal class exists, and data getter indicates page is internal
|
||||||
List<String> restrictClasses = (List<String>)data.get("restrictClasses");
|
if(data.containsKey("internalClass") && data.containsKey("isInternal")) {
|
||||||
String internalClass = (String) data.get("internalClass");
|
|
||||||
if(restrictClasses.contains(internalClass)) {
|
|
||||||
data.put("pageInternalOnly", true);
|
data.put("pageInternalOnly", true);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -324,7 +323,7 @@ public class MenuManagementController extends FreemarkerHttpServlet {
|
||||||
|
|
||||||
//Instead of returning vclasses, just returning class Uris as vclasses appear to need their own template
|
//Instead of returning vclasses, just returning class Uris as vclasses appear to need their own template
|
||||||
//to show up correctly
|
//to show up correctly
|
||||||
private void getClassesForDataGetter(OntModel writeModel, Resource dataGetter,
|
private void getClassesForInternalDataGetter(OntModel writeModel, Resource dataGetter,
|
||||||
Map<String, Object> data) {
|
Map<String, Object> data) {
|
||||||
|
|
||||||
|
|
||||||
|
@ -344,22 +343,20 @@ public class MenuManagementController extends FreemarkerHttpServlet {
|
||||||
//This checks whether restrict classes returned and include institutional internal class
|
//This checks whether restrict classes returned and include institutional internal class
|
||||||
//TODO: Create separate method to get restricted classes
|
//TODO: Create separate method to get restricted classes
|
||||||
//Get restrict classes - specifically internal class
|
//Get restrict classes - specifically internal class
|
||||||
List<String> restrictClassUris = new ArrayList<String>();
|
|
||||||
StmtIterator restrictClassesIt = writeModel.listStatements(dataGetter,
|
|
||||||
ResourceFactory.createProperty(DisplayVocabulary.RESTRICT_RESULTS_BY),
|
|
||||||
(RDFNode) null);
|
|
||||||
while(restrictClassesIt.hasNext()) {
|
|
||||||
String restrictClassUri = restrictClassesIt.nextStatement().getResource().getURI();
|
|
||||||
restrictClassUris.add(restrictClassUri);
|
|
||||||
}
|
|
||||||
data.put("restrictClasses", restrictClassUris);
|
|
||||||
|
|
||||||
|
StmtIterator internalIt = writeModel.listStatements(dataGetter,
|
||||||
|
ResourceFactory.createProperty(DisplayVocabulary.RESTRICT_RESULTS_BY_INTERNAL),
|
||||||
|
(RDFNode) null);
|
||||||
|
if(internalIt.hasNext()) {
|
||||||
|
data.put("isInternal", internalIt.nextStatement().getLiteral().getString());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//Check whether any classes exist with internal class restrictions
|
//Check whether any classes exist with internal class restrictions
|
||||||
private void checkInstitutionalInternalClass(Map<String, Object> data) {
|
private void checkInstitutionalInternalClass(Map<String, Object> data) {
|
||||||
|
//TODO: replace with more generic ModelContext retrieval method
|
||||||
OntModel mainModel = (OntModel) getServletContext().getAttribute("jenaOntModel");
|
OntModel mainModel = (OntModel) getServletContext().getAttribute("jenaOntModel");
|
||||||
StmtIterator internalIt = mainModel.listStatements(null, ResourceFactory.createProperty(VitroVocabulary.IS_INTERNAL_CLASSANNOT), (RDFNode) null);
|
StmtIterator internalIt = mainModel.listStatements(null, ResourceFactory.createProperty(VitroVocabulary.IS_INTERNAL_CLASSANNOT), (RDFNode) null);
|
||||||
//List<String> internalClasses = new ArrayList<String>();
|
//List<String> internalClasses = new ArrayList<String>();
|
||||||
|
|
|
@ -24,6 +24,7 @@ import edu.cornell.mannlib.vitro.webapp.utils.pageDataGetter.BrowseDataGetter;
|
||||||
import edu.cornell.mannlib.vitro.webapp.utils.pageDataGetter.PageDataGetter;
|
import edu.cornell.mannlib.vitro.webapp.utils.pageDataGetter.PageDataGetter;
|
||||||
import edu.cornell.mannlib.vitro.webapp.utils.pageDataGetter.ClassGroupPageData;
|
import edu.cornell.mannlib.vitro.webapp.utils.pageDataGetter.ClassGroupPageData;
|
||||||
import edu.cornell.mannlib.vitro.webapp.utils.pageDataGetter.IndividualsForClassesDataGetter;
|
import edu.cornell.mannlib.vitro.webapp.utils.pageDataGetter.IndividualsForClassesDataGetter;
|
||||||
|
import edu.cornell.mannlib.vitro.webapp.utils.pageDataGetter.InternalClassesDataGetter;
|
||||||
import edu.cornell.mannlib.vitro.webapp.utils.pageDataGetter.DataGetterUtils;
|
import edu.cornell.mannlib.vitro.webapp.utils.pageDataGetter.DataGetterUtils;
|
||||||
/**
|
/**
|
||||||
* Controller for getting data for pages defined in the display model.
|
* Controller for getting data for pages defined in the display model.
|
||||||
|
@ -140,9 +141,10 @@ public class PageController extends FreemarkerHttpServlet{
|
||||||
getPageDataGetterMap(context).put(cgpd.getType(), cgpd);
|
getPageDataGetterMap(context).put(cgpd.getType(), cgpd);
|
||||||
BrowseDataGetter bdg = new BrowseDataGetter();
|
BrowseDataGetter bdg = new BrowseDataGetter();
|
||||||
getPageDataGetterMap(context).put(bdg.getType(), bdg);
|
getPageDataGetterMap(context).put(bdg.getType(), bdg);
|
||||||
//TODO: Check if can include by type here
|
|
||||||
IndividualsForClassesDataGetter cidg = new IndividualsForClassesDataGetter();
|
IndividualsForClassesDataGetter cidg = new IndividualsForClassesDataGetter();
|
||||||
getPageDataGetterMap(context).put(cidg.getType(), cidg);
|
getPageDataGetterMap(context).put(cidg.getType(), cidg);
|
||||||
|
InternalClassesDataGetter internalCdg = new InternalClassesDataGetter();
|
||||||
|
getPageDataGetterMap(context).put(internalCdg.getType(), internalCdg);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -120,6 +120,7 @@ public class DisplayVocabulary {
|
||||||
//URL for menu management
|
//URL for menu management
|
||||||
public static final String PROCESS_MENU_MANAGEMENT_URL = "/processEditDisplayModel";
|
public static final String PROCESS_MENU_MANAGEMENT_URL = "/processEditDisplayModel";
|
||||||
public static final String REORDER_MENU_URL = PROCESS_MENU_MANAGEMENT_URL + "?cmd=Reorder&" + SWITCH_TO_DISPLAY_MODEL + "=true";
|
public static final String REORDER_MENU_URL = PROCESS_MENU_MANAGEMENT_URL + "?cmd=Reorder&" + SWITCH_TO_DISPLAY_MODEL + "=true";
|
||||||
|
public static final String INTERNAL_CLASS_TEMPLATE = "menupage--individualsforclasses.ftl";
|
||||||
/* URIs for some individuals in the dispaly ontology */
|
/* URIs for some individuals in the dispaly ontology */
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,8 @@ public interface PageDao {
|
||||||
|
|
||||||
String getClassGroupPage(String pageUri);
|
String getClassGroupPage(String pageUri);
|
||||||
|
|
||||||
Map<String, List<String>> getClassIntersections(String pageUri);
|
|
||||||
|
|
||||||
Map<String, List<String>> getClassesAndRestrictionsForPage(String pageUri);
|
Map<String, List<String>> getClassesAndRestrictionsForPage(String pageUri);
|
||||||
|
|
||||||
|
Map<String, Object> getClassesAndCheckInternal(String pageUri);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,8 @@ public class PageDaoJena extends JenaBaseDao implements PageDao {
|
||||||
static protected Query classIntersectionPageQuery;
|
static protected Query classIntersectionPageQuery;
|
||||||
static protected Query individualsForClassesQuery;
|
static protected Query individualsForClassesQuery;
|
||||||
static protected Query individualsForClassesRestrictedQuery;
|
static protected Query individualsForClassesRestrictedQuery;
|
||||||
|
static protected Query institutionalInternalClassQuery;
|
||||||
|
static protected Query individualsForClassesInternalQuery;
|
||||||
|
|
||||||
|
|
||||||
static final String prefixes =
|
static final String prefixes =
|
||||||
|
@ -101,16 +103,6 @@ public class PageDaoJena extends JenaBaseDao implements PageDao {
|
||||||
" ?dg <" + DisplayVocabulary.FOR_CLASSGROUP + "> ?classGroup . \n" +
|
" ?dg <" + DisplayVocabulary.FOR_CLASSGROUP + "> ?classGroup . \n" +
|
||||||
"} \n" ;
|
"} \n" ;
|
||||||
|
|
||||||
|
|
||||||
static final protected String classIntersectionPageQueryString =
|
|
||||||
prefixes + "\n" +
|
|
||||||
"SELECT ?classIntersection ?label ?class ?WHERE { ?pageUri <" + DisplayVocabulary.HAS_CLASS_INTERSECTION + "> ?classIntersection . \n " +
|
|
||||||
" ?classIntersection <" + DisplayVocabulary.CLASS_INTERSECTION + "> ?class . \n "+
|
|
||||||
" ?classIntersection rdfs:label ?label . \n" +
|
|
||||||
"}";
|
|
||||||
//prefixes + "\n" +
|
|
||||||
//"SELECT ?classIntersection WHERE { ?pageUri <" + DisplayVocabulary.CLASS_INTERSECTION + "> ?classIntersection . }";
|
|
||||||
|
|
||||||
//Query to get what classes are to be employed on the page
|
//Query to get what classes are to be employed on the page
|
||||||
static final protected String individualsForClassesDataGetterQueryString =
|
static final protected String individualsForClassesDataGetterQueryString =
|
||||||
prefixes + "\n" +
|
prefixes + "\n" +
|
||||||
|
@ -122,14 +114,30 @@ public class PageDaoJena extends JenaBaseDao implements PageDao {
|
||||||
"} \n" ;
|
"} \n" ;
|
||||||
|
|
||||||
//Given a data getter, check if results are to be restricted by class
|
//Given a data getter, check if results are to be restricted by class
|
||||||
//Also possible to merge these two into the same query
|
|
||||||
|
|
||||||
static final protected String individualsForClassesRestrictedQueryString =
|
static final protected String individualsForClassesRestrictedQueryString =
|
||||||
prefixes + "\n" +
|
prefixes + "\n" +
|
||||||
"SELECT ?restrictClass WHERE {\n" +
|
"SELECT ?restrictClass WHERE {\n" +
|
||||||
" ?dg <"+ DisplayVocabulary.RESTRICT_RESULTS_BY + "> ?restrictClass .\n" +
|
" ?dg <"+ DisplayVocabulary.RESTRICT_RESULTS_BY + "> ?restrictClass .\n" +
|
||||||
"} \n" ;
|
"} \n" ;
|
||||||
// " ?pageUri display:hasDataGetter ?dg .\n"+
|
|
||||||
|
//Is this data getter using internal class
|
||||||
|
static final protected String institutionalInternalClassQueryString =
|
||||||
|
prefixes + "\n" +
|
||||||
|
"SELECT ?restrictByInternalClass WHERE {\n" +
|
||||||
|
" ?dg <"+ DisplayVocabulary.RESTRICT_RESULTS_BY_INTERNAL + "> ?restrictsByInternalClass .\n" +
|
||||||
|
"} \n" ;
|
||||||
|
|
||||||
|
//Query to get classes employed on internal class page
|
||||||
|
//Query to get what classes are to be employed on the page
|
||||||
|
static final protected String individualsForClassesInternalQueryString =
|
||||||
|
prefixes + "\n" +
|
||||||
|
"SELECT ?dg ?class ?isInternal WHERE {\n" +
|
||||||
|
" ?pageUri display:hasDataGetter ?dg .\n"+
|
||||||
|
" ?dg rdf:type <" + DisplayVocabulary.CLASSINDIVIDUALS_INTERNAL_TYPE + ">. \n" +
|
||||||
|
" ?dg <" + DisplayVocabulary.GETINDIVIDUALS_FOR_CLASS + "> ?class . \n" +
|
||||||
|
" ?dg <"+ DisplayVocabulary.RESTRICT_RESULTS_BY_INTERNAL + "> ?isInternal .\n" +
|
||||||
|
"} \n" ;
|
||||||
|
|
||||||
|
|
||||||
static{
|
static{
|
||||||
try{
|
try{
|
||||||
|
@ -168,13 +176,6 @@ public class PageDaoJena extends JenaBaseDao implements PageDao {
|
||||||
log.error("could not create SPARQL query for classGroupPageQuery " + th.getMessage());
|
log.error("could not create SPARQL query for classGroupPageQuery " + th.getMessage());
|
||||||
log.error(classGroupPageQueryString);
|
log.error(classGroupPageQueryString);
|
||||||
}
|
}
|
||||||
try{
|
|
||||||
classIntersectionPageQuery=QueryFactory.create(classIntersectionPageQueryString);
|
|
||||||
}catch(Throwable th){
|
|
||||||
log.error("could not create SPARQL query for classIntersectionPageQuery " + th.getMessage());
|
|
||||||
log.error(classIntersectionPageQueryString);
|
|
||||||
}
|
|
||||||
|
|
||||||
try{
|
try{
|
||||||
individualsForClassesQuery=QueryFactory.create(individualsForClassesDataGetterQueryString);
|
individualsForClassesQuery=QueryFactory.create(individualsForClassesDataGetterQueryString);
|
||||||
}catch(Throwable th){
|
}catch(Throwable th){
|
||||||
|
@ -188,6 +189,23 @@ public class PageDaoJena extends JenaBaseDao implements PageDao {
|
||||||
log.error("could not create SPARQL query for individualsForClassesRestrictedQuery " + th.getMessage());
|
log.error("could not create SPARQL query for individualsForClassesRestrictedQuery " + th.getMessage());
|
||||||
log.error(individualsForClassesDataGetterQueryString);
|
log.error(individualsForClassesDataGetterQueryString);
|
||||||
}
|
}
|
||||||
|
//Check if data getter uses internal class
|
||||||
|
try{
|
||||||
|
institutionalInternalClassQuery=QueryFactory.create(institutionalInternalClassQueryString);
|
||||||
|
}catch(Throwable th){
|
||||||
|
log.error("could not create SPARQL query for institutionalInternalClassQuery " + th.getMessage());
|
||||||
|
log.error(institutionalInternalClassQueryString);
|
||||||
|
}
|
||||||
|
//Check which classes set for page and whether or not page should only have internal classes
|
||||||
|
try{
|
||||||
|
individualsForClassesInternalQuery = QueryFactory.create(individualsForClassesInternalQueryString);
|
||||||
|
}catch(Throwable th){
|
||||||
|
log.error("could not create SPARQL query for individualsForClassesInternalQuery " + th.getMessage());
|
||||||
|
log.error(individualsForClassesInternalQueryString);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public PageDaoJena(WebappDaoFactoryJena wadf) {
|
public PageDaoJena(WebappDaoFactoryJena wadf) {
|
||||||
|
@ -350,52 +368,6 @@ public class PageDaoJena extends JenaBaseDao implements PageDao {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the set of intersections for page - each intersection has a label and includes names of the classes for class intersection. Multiple classes possible.
|
|
||||||
*/
|
|
||||||
public Map<String, List<String>> getClassIntersections(String pageUri) {
|
|
||||||
Map<String, List<String>> classIntersectionsMap = new HashMap<String, List<String>>();
|
|
||||||
QuerySolutionMap initialBindings = new QuerySolutionMap();
|
|
||||||
initialBindings.add("pageUri", ResourceFactory.createResource(pageUri));
|
|
||||||
|
|
||||||
Model displayModel = getOntModelSelector().getDisplayModel();
|
|
||||||
displayModel.enterCriticalSection(false);
|
|
||||||
try{
|
|
||||||
QueryExecution qexec = QueryExecutionFactory.create( classIntersectionPageQuery, displayModel , initialBindings);
|
|
||||||
try{
|
|
||||||
//Assuming unique labels or could use URI itself?
|
|
||||||
//TODO: Review whether to use labels or URIs
|
|
||||||
|
|
||||||
|
|
||||||
ResultSet resultSet = qexec.execSelect();
|
|
||||||
while(resultSet.hasNext()){
|
|
||||||
QuerySolution soln = resultSet.next();
|
|
||||||
//Results format should be ?page hasClassIntersection <a>. <a> intersectsWithClass ?c; <a> intersects With Class ?e.
|
|
||||||
String intersectionLabel = nodeToString(soln.get("label"));
|
|
||||||
|
|
||||||
//first time encountering label, set up
|
|
||||||
if(!classIntersectionsMap.containsKey(intersectionLabel)) {
|
|
||||||
classIntersectionsMap.put(intersectionLabel, new ArrayList<String>());
|
|
||||||
}
|
|
||||||
|
|
||||||
List<String> classes = classIntersectionsMap.get(intersectionLabel);
|
|
||||||
classes.add(nodeToString(soln.get("class")));
|
|
||||||
//classIntersections.add( nodeToString(soln.get("classIntersection")) );
|
|
||||||
}
|
|
||||||
if( classIntersectionsMap.size() == 0 ){
|
|
||||||
log.debug("No class intersections info defined in display model for "+ pageUri);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return classIntersectionsMap;
|
|
||||||
}finally{
|
|
||||||
qexec.close();
|
|
||||||
}
|
|
||||||
}finally{
|
|
||||||
displayModel.leaveCriticalSection();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the classes for which to get individuals returned. This should return a list of class uris.
|
* Get the classes for which to get individuals returned. This should return a list of class uris.
|
||||||
|
@ -448,6 +420,44 @@ public class PageDaoJena extends JenaBaseDao implements PageDao {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Get classes for page along with whether or not internal class
|
||||||
|
public Map<String, Object> getClassesAndCheckInternal(String pageUri) {
|
||||||
|
Map<String, Object> classesAndRestrictions = new HashMap<String, Object>();
|
||||||
|
QuerySolutionMap initialBindings = new QuerySolutionMap();
|
||||||
|
initialBindings.add("pageUri", ResourceFactory.createResource(pageUri));
|
||||||
|
List<String> classes = new ArrayList<String>();
|
||||||
|
|
||||||
|
Model displayModel = getOntModelSelector().getDisplayModel();
|
||||||
|
displayModel.enterCriticalSection(false);
|
||||||
|
try{
|
||||||
|
QueryExecution qexec = QueryExecutionFactory.create( individualsForClassesInternalQuery, displayModel , initialBindings);
|
||||||
|
try{
|
||||||
|
ResultSet resultSet = qexec.execSelect();
|
||||||
|
while(resultSet.hasNext()){
|
||||||
|
QuerySolution soln = resultSet.next();
|
||||||
|
String dg = nodeToString(soln.get("dg"));
|
||||||
|
classes.add(nodeToString(soln.get("class")));
|
||||||
|
String isInternal = nodeToString(soln.get("isInternal"));
|
||||||
|
if(isInternal != null && !isInternal.isEmpty()) {
|
||||||
|
log.debug("Internal value is "+ isInternal);
|
||||||
|
//Retrieve and add internal class
|
||||||
|
classesAndRestrictions.put("isInternal", isInternal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( classes.size() == 0 ){
|
||||||
|
log.debug("No classes defined in display model for "+ pageUri);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
classesAndRestrictions.put("classes", classes);
|
||||||
|
return classesAndRestrictions;
|
||||||
|
}finally{
|
||||||
|
qexec.close();
|
||||||
|
}
|
||||||
|
}finally{
|
||||||
|
displayModel.leaveCriticalSection();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue