diff --git a/api/src/main/java/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddRubricToELENPHArticleGenerator.java b/api/src/main/java/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddRubricToELENPHArticleGenerator.java deleted file mode 100644 index 59dd0144..00000000 --- a/api/src/main/java/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddRubricToELENPHArticleGenerator.java +++ /dev/null @@ -1,649 +0,0 @@ -/* $This file is distributed under the terms of the license in LICENSE$ */ - -package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators; - -import static edu.cornell.mannlib.vitro.webapp.modelaccess.ModelNames.DISPLAY; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpSession; - -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.JspToGeneratorMapping; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; - -import org.apache.jena.ontology.OntModel; -import org.apache.jena.query.QuerySolution; -import org.apache.jena.query.ResultSet; -import org.apache.jena.rdf.model.Literal; - -import edu.cornell.mannlib.vitro.webapp.application.ApplicationUtils; -import edu.cornell.mannlib.vitro.webapp.beans.Individual; -import edu.cornell.mannlib.vitro.webapp.beans.ObjectProperty; -import edu.cornell.mannlib.vitro.webapp.beans.VClass; -import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; -import edu.cornell.mannlib.vitro.webapp.dao.DisplayVocabulary; -import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary; -import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory; -import edu.cornell.mannlib.vitro.webapp.dao.jena.QueryUtils; -import edu.cornell.mannlib.vitro.webapp.dao.vclassgroup.ProhibitedFromSearch; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldVTwo; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.IndividualsViaObjectPropetyOptions; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.AntiXssValidation; -import edu.cornell.mannlib.vitro.webapp.i18n.I18n; -import edu.cornell.mannlib.vitro.webapp.modelaccess.ModelAccess; -import edu.cornell.mannlib.vitro.webapp.modules.searchEngine.SearchEngine; -import edu.cornell.mannlib.vitro.webapp.modules.searchEngine.SearchEngineException; -import edu.cornell.mannlib.vitro.webapp.modules.searchEngine.SearchQuery; -import edu.cornell.mannlib.vitro.webapp.modules.searchEngine.SearchResponse; -import edu.cornell.mannlib.vitro.webapp.modules.searchEngine.SearchResultDocumentList; -import edu.cornell.mannlib.vitro.webapp.search.VitroSearchTermNames; -import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils; -import edu.cornell.mannlib.vitro.webapp.utils.FrontEndEditingUtils.EditMode; - -/** - * Generates the edit configuration for a default property form. - * This handles the default object property auto complete. - * - * If a default property form is request and the number of indivdiuals - * found in the range is too large, the the auto complete setup and - * template will be used instead. - */ -public class AddRubricToELENPHArticleGenerator implements EditConfigurationGenerator { - - private Log log = LogFactory.getLog(AddRubricToELENPHArticleGenerator.class); - private String subjectUri = null; - private String predicateUri = null; - private String objectUri = null; - - private String objectPropertyTemplate = "defaultPropertyForm.ftl"; - private String acObjectPropertyTemplate = "autoCompleteObjectPropForm.ftl"; - - private ArrayList excerptIDs= new ArrayList(); - - protected boolean doAutoComplete = false; - protected boolean tooManyRangeIndividuals = false; - - protected long maxNonACRangeIndividualCount = 300; - protected String customErrorMessages = null; - - @Override - public EditConfigurationVTwo getEditConfiguration(VitroRequest vreq, - HttpSession session) throws Exception { - - if(!EditConfigurationUtils.isObjectProperty(EditConfigurationUtils.getPredicateUri(vreq), vreq)) { - throw new Exception("DefaultObjectPropertyFormGenerator does not handle data properties."); - } - - //Custom error can also be represented as an exception above, but in this case - //we would like the page to enable the user to go back to the profile page - - customErrorMessages = getCustomErrorMessages(vreq); - if(customErrorMessages != null) { - return this.getCustomErrorEditConfiguration(vreq, session); - } - - if( tooManyRangeOptions( vreq, session ) ){ - tooManyRangeIndividuals = true; - doAutoComplete = true; - } - - //Check if create new and return specific edit configuration from that generator. - if(DefaultAddMissingIndividualFormGenerator.isCreateNewIndividual(vreq, session)) { - EditConfigurationGenerator generator = JspToGeneratorMapping.createFor("defaultAddMissingIndividualForm.jsp", DefaultAddMissingIndividualFormGenerator.class); - return generator.getEditConfiguration(vreq, session); - } - - //TODO: Add a generator for delete: based on command being delete - propDelete.jsp - //Generate a edit configuration for the default object property form and return it. - //if(DefaultDeleteGenerator.isDelete( vreq,session)){ - // return (new DefaultDeleteGenerator()).getEditConfiguration(vreq,session); - - return getDefaultObjectEditConfiguration(vreq, session); - } - - private String getCustomErrorMessages(VitroRequest vreq) { - String errorMessages = null; - String rangeUri = vreq.getParameter("rangeUri"); - VClass rangeVClass = null; - if(rangeUri != null && !rangeUri.isEmpty()) { - WebappDaoFactory ctxDaoFact = vreq.getLanguageNeutralWebappDaoFactory(); - rangeVClass = ctxDaoFact.getVClassDao().getVClassByURI(rangeUri); - if(rangeVClass == null) { - errorMessages = I18n.text(vreq,"the_range_class_does_not_exist"); - } - } - - return errorMessages; - } - - protected List getRangeTypes(VitroRequest vreq) { - // This first part needs a WebappDaoFactory with no filtering/RDFService - // funny business because it needs to be able to retrieve anonymous union - // classes by their "pseudo-bnode URIs". - // Someday we'll need to figure out a different way of doing this. - //WebappDaoFactory ctxDaoFact = ModelAccess.on( - // vreq.getSession().getServletContext()).getWebappDaoFactory(); - WebappDaoFactory ctxDaoFact = vreq.getLanguageNeutralWebappDaoFactory(); - - List types = new ArrayList(); - Individual subject = EditConfigurationUtils.getSubjectIndividual(vreq); - String predicateUri = EditConfigurationUtils.getPredicateUri(vreq); - String rangeUri = EditConfigurationUtils.getRangeUri(vreq); - if (rangeUri != null && !rangeUri.isEmpty()) { - VClass rangeVClass = ctxDaoFact.getVClassDao().getVClassByURI(rangeUri); - if(rangeVClass != null) { - if (!rangeVClass.isUnion()) { - types.add(rangeVClass); - } else { - types.addAll(rangeVClass.getUnionComponents()); - } - return types; - } else { - log.error("Range VClass does not exist for " + rangeUri); - } - } - WebappDaoFactory wDaoFact = vreq.getWebappDaoFactory(); - //Get all vclasses applicable to subject - if(subject != null) { - List vClasses = subject.getVClasses(); - HashMap typesHash = new HashMap(); - for(VClass vclass: vClasses) { - List rangeVclasses = wDaoFact.getVClassDao().getVClassesForProperty(vclass.getURI(),predicateUri); - if(rangeVclasses != null) { - for(VClass range: rangeVclasses) { - //a hash will keep a unique list of types and so prevent duplicates - typesHash.put(range.getURI(), range); - } - } - } - types.addAll(typesHash.values()); - } else { - log.error("Subject individual was null for"); - } - return types; - } - - private boolean tooManyRangeOptions(VitroRequest vreq, HttpSession session ) throws SearchEngineException { - List rangeTypes = getRangeTypes(vreq); - SearchEngine searchEngine = ApplicationUtils.instance().getSearchEngine(); - - List types = new ArrayList(); - for (VClass vclass : rangeTypes) { - if (vclass.getURI() != null) { - types.add(vclass.getURI()); - } - } - - //empty list means the range is not set to anything, force Thing - if(types.size() == 0 ){ - types.add(VitroVocabulary.OWL_THING); - } - - long count = 0; - for( String type:types){ - //search query for type count. - SearchQuery query = searchEngine.createQuery(); - if( VitroVocabulary.OWL_THING.equals( type )){ - query.setQuery( "*:*" ); - }else{ - query.setQuery( VitroSearchTermNames.RDFTYPE + ":" + type); - } - query.setRows(0); - SearchResponse rsp = searchEngine.query(query); - SearchResultDocumentList docs = rsp.getResults(); - long found = docs.getNumFound(); - count = count + found; - if( count > maxNonACRangeIndividualCount ) - break; - } - - return count > maxNonACRangeIndividualCount ; - } - - - private EditConfigurationVTwo getDefaultObjectEditConfiguration(VitroRequest vreq, HttpSession session) throws Exception { - EditConfigurationVTwo editConfiguration = new EditConfigurationVTwo(); - - //process subject, predicate, object parameters - this.initProcessParameters(vreq, session, editConfiguration); - - //Assumes this is a simple case of subject predicate var - editConfiguration.setN3Required(this.generateN3Required(vreq)); - - //n3 optional - editConfiguration.setN3Optional(this.generateN3Optional()); - - //Todo: what do new resources depend on here? - //In original form, these variables start off empty - editConfiguration.setNewResources(new HashMap()); - //In scope - this.setUrisAndLiteralsInScope(editConfiguration); - - //on Form - this.setUrisAndLiteralsOnForm(editConfiguration, vreq); - - editConfiguration.setFilesOnForm(new ArrayList()); - - //Sparql queries - this.setSparqlQueries(editConfiguration); - - //set fields - setFields(editConfiguration, vreq, EditConfigurationUtils.getPredicateUri(vreq), getRangeTypes(vreq)); - - // No need to put in session here b/c put in session within edit request dispatch controller instead - //placing in session depends on having edit key which is handled in edit request dispatch controller - // editConfiguration.putConfigInSession(editConfiguration, session); - - prepareForUpdate(vreq, session, editConfiguration); - - //After the main processing is done, check if select from existing process - processProhibitedFromSearch(vreq, session, editConfiguration); - - //Form title and submit label moved to template - setTemplate(editConfiguration, vreq); - - editConfiguration.addValidator(new AntiXssValidation()); - - //Set edit key - setEditKey(editConfiguration, vreq); - - //Adding additional data, specifically edit mode - if( doAutoComplete ){ - addFormSpecificDataForAC(editConfiguration, vreq, session); - }else{ - addFormSpecificData(editConfiguration, vreq); - } - - return editConfiguration; - } - - //We only need enough for the error message to show up - private EditConfigurationVTwo getCustomErrorEditConfiguration(VitroRequest vreq, HttpSession session) { - EditConfigurationVTwo editConfiguration = new EditConfigurationVTwo(); - - //process subject, predicate, object parameters - this.initProcessParameters(vreq, session, editConfiguration); - - this.setUrisAndLiteralsInScope(editConfiguration); - - //Sparql queries - this.setSparqlQueries(editConfiguration); - - - prepareForUpdate(vreq, session, editConfiguration); - - editConfiguration.setTemplate("customErrorMessages.ftl"); - - //Set edit key - setEditKey(editConfiguration, vreq); - - //if custom error messages is not null, then add to form specific data - if(customErrorMessages != null) { - //at this point, it shouldn't be null - HashMap formSpecificData = new HashMap(); - formSpecificData.put("customErrorMessages", customErrorMessages); - editConfiguration.setFormSpecificData(formSpecificData); - } - return editConfiguration; - } - - private void setEditKey(EditConfigurationVTwo editConfiguration, VitroRequest vreq) { - String editKey = EditConfigurationUtils.getEditKey(vreq); - editConfiguration.setEditKey(editKey); - } - - private void setTemplate(EditConfigurationVTwo editConfiguration, - VitroRequest vreq) { - if( doAutoComplete ) - editConfiguration.setTemplate(acObjectPropertyTemplate); - else - editConfiguration.setTemplate(objectPropertyTemplate); - - } - - //Initialize setup: process parameters - private void initProcessParameters(VitroRequest vreq, HttpSession session, EditConfigurationVTwo editConfiguration) { - String formUrl = EditConfigurationUtils.getFormUrlWithoutContext(vreq); - - subjectUri = EditConfigurationUtils.getSubjectUri(vreq); - predicateUri = EditConfigurationUtils.getPredicateUri(vreq); - - editConfiguration.setFormUrl(formUrl); - - editConfiguration.setUrlPatternToReturnTo("/individual"); - - editConfiguration.setVarNameForSubject("subject"); - editConfiguration.setSubjectUri(subjectUri); - editConfiguration.setEntityToReturnTo(subjectUri); - editConfiguration.setVarNameForPredicate("predicate"); - editConfiguration.setPredicateUri(predicateUri); - - - //this needs to be set for the editing to be triggered properly, otherwise the 'prepare' method - //pretends this is a data property editing statement and throws an error - //"object" : [ "objectVar" , "${objectUriJson}" , "URI"], - if(EditConfigurationUtils.isObjectProperty(predicateUri, vreq)) { - log.debug("This is an predicate property: " + predicateUri); - log.debug("This is an subject property: " + subjectUri); - - this.initObjectParameters(vreq); - log.debug("This is an object property: " + objectUri); - this.processObjectPropForm(vreq, editConfiguration); - } else { - log.debug("This is a data property: " + predicateUri); - } - } - - - private void initObjectParameters(VitroRequest vreq) { - //in case of object property - objectUri = EditConfigurationUtils.getObjectUri(vreq); - } - - private void processObjectPropForm(VitroRequest vreq, EditConfigurationVTwo editConfiguration) { - editConfiguration.setVarNameForObject("objectVar"); - editConfiguration.setObject(objectUri); - //this needs to be set for the editing to be triggered properly, otherwise the 'prepare' method - //pretends this is a data property editing statement and throws an error - //TODO: Check if null in case no object uri exists but this is still an object property - } - - //Get N3 required - //Handles both object and data property - private List generateN3Required(VitroRequest vreq) { - List n3ForEdit = new ArrayList(); - getTextExcerpts(vreq); - if (excerptIDs.isEmpty()) { - String editString = "?subject ?predicate ?objectVar ."; - n3ForEdit.add(editString); - } else { - for (String excerptID : excerptIDs) { - String editString = "<"+excerptID+">" + " ?predicate ?objectVar ."; - log.debug(editString); - n3ForEdit.add(editString); - } - } - return n3ForEdit; - } - - private List generateN3Optional() { - List n3Inverse = new ArrayList(); - n3Inverse.add("?objectVar ?inverseProp ?subject ."); - return n3Inverse; - } - - private void getTextExcerpts(VitroRequest vreq) { - ResultSet excerptResults = QueryUtils.getLanguageNeutralQueryResults(getExcerptsQueryString(), vreq); - while (excerptResults.hasNext()) { - QuerySolution solution = excerptResults.nextSolution(); - String excerptID = solution.get("excerptID").asResource().toString(); - log.debug(excerptID); - excerptIDs.add(excerptID); - } - } - - private String getExcerptsQueryString() { - return "PREFIX ts_: " - +"SELECT DISTINCT ?excerptID " - +"WHERE { " - +"<" + subjectUri + "> ts_:hasTOC ?toc . " - +"?toc (ts_:hasTOCItem/ts_:pointsTo)+/ts_:hasText ?excerptID . " - +"} "; - } - - - //Set queries - private String retrieveQueryForInverse () { - String queryForInverse = "PREFIX owl: " - + " SELECT ?inverse_property " - + " WHERE { ?inverse_property owl:inverseOf ?predicate } "; - return queryForInverse; - } - - private void setUrisAndLiteralsInScope(EditConfigurationVTwo editConfiguration) { - HashMap> urisInScope = new HashMap>(); - //note that at this point the subject, predicate, and object var parameters have already been processed - urisInScope.put(editConfiguration.getVarNameForSubject(), - Arrays.asList(new String[]{editConfiguration.getSubjectUri()})); - urisInScope.put(editConfiguration.getVarNameForPredicate(), - Arrays.asList(new String[]{editConfiguration.getPredicateUri()})); - //this shoudl happen in edit configuration prepare for object prop update - //urisInScope.put(editConfiguration.getVarNameForObject(), - // Arrays.asList(new String[]{editConfiguration.getObject()})); - //inverse property uris should be included in sparql for additional uris in edit configuration - editConfiguration.setUrisInScope(urisInScope); - //Uris in scope include subject, predicate, and object var - - editConfiguration.setLiteralsInScope(new HashMap>()); - } - - //n3 should look as follows - //?subject ?predicate ?objectVar - - private void setUrisAndLiteralsOnForm(EditConfigurationVTwo editConfiguration, VitroRequest vreq) { - List urisOnForm = new ArrayList(); - List literalsOnForm = new ArrayList(); - - //uris on form should be empty if data property - urisOnForm.add("objectVar"); - - editConfiguration.setUrisOnform(urisOnForm); - editConfiguration.setLiteralsOnForm(literalsOnForm); - } - - //This is for various items - private void setSparqlQueries(EditConfigurationVTwo editConfiguration) { - //Sparql queries defining retrieval of literals etc. - editConfiguration.setSparqlForAdditionalLiteralsInScope(new HashMap()); - - Map urisInScope = new HashMap(); - urisInScope.put("inverseProp", this.retrieveQueryForInverse()); - editConfiguration.setSparqlForAdditionalUrisInScope(urisInScope); - - editConfiguration.setSparqlForExistingLiterals(generateSparqlForExistingLiterals()); - editConfiguration.setSparqlForExistingUris(generateSparqlForExistingUris()); - } - - - //Get page uri for object - private HashMap generateSparqlForExistingUris() { - HashMap map = new HashMap(); - return map; - } - - private HashMap generateSparqlForExistingLiterals() { - HashMap map = new HashMap(); - return map; - } - - protected void setFields(EditConfigurationVTwo editConfiguration, VitroRequest vreq, String predicateUri) throws Exception { - setFields(editConfiguration, vreq, predicateUri, null); - } - - protected void setFields(EditConfigurationVTwo editConfiguration, VitroRequest vreq, String predicateUri, List rangeTypes) throws Exception { - FieldVTwo field = new FieldVTwo(); - field.setName("objectVar"); - - List validators = new ArrayList(); - validators.add("nonempty"); - field.setValidators(validators); - - if( ! doAutoComplete ){ - field.setOptions( new IndividualsViaObjectPropetyOptions( - subjectUri, - predicateUri, - rangeTypes, - objectUri, - vreq )); - }else{ - field.setOptions(null); - } - - Map fields = new HashMap(); - fields.put(field.getName(), field); - - editConfiguration.setFields(fields); - } - - private void prepareForUpdate(VitroRequest vreq, HttpSession session, EditConfigurationVTwo editConfiguration) { - //Here, retrieve model from - OntModel model = ModelAccess.on(session.getServletContext()).getOntModel(); - //if object property - if(EditConfigurationUtils.isObjectProperty(EditConfigurationUtils.getPredicateUri(vreq), vreq)){ - Individual objectIndividual = EditConfigurationUtils.getObjectIndividual(vreq); - if(objectIndividual != null) { - //update existing object - editConfiguration.prepareForObjPropUpdate(model); - } else { - //new object to be created - editConfiguration.prepareForNonUpdate( model ); - } - } else { - throw new Error("DefaultObjectPropertyForm does not handle data properties."); - } - } - - private boolean isSelectFromExisting(VitroRequest vreq) { - String predicateUri = EditConfigurationUtils.getPredicateUri(vreq); - if(EditConfigurationUtils.isDataProperty(predicateUri, vreq)) { - return false; - } - ObjectProperty objProp = EditConfigurationUtils.getObjectPropertyForPredicate(vreq, EditConfigurationUtils.getPredicateUri(vreq)); - return objProp.getSelectFromExisting(); - } - - //Additional processing, eg. select from existing - //This is really process prohibited from search - private void processProhibitedFromSearch(VitroRequest vreq, HttpSession session, EditConfigurationVTwo editConfig) { - if(isSelectFromExisting(vreq)) { - // set ProhibitedFromSearch object so picklist doesn't show - // individuals from classes that should be hidden from list views - OntModel displayOntModel = ModelAccess.on(session.getServletContext()).getOntModel(DISPLAY); - ProhibitedFromSearch pfs = new ProhibitedFromSearch( - DisplayVocabulary.SEARCH_INDEX_URI, displayOntModel); - if( editConfig != null ) - editConfig.setProhibitedFromSearch(pfs); - } - } - - //Form specific data - public void addFormSpecificData(EditConfigurationVTwo editConfiguration, VitroRequest vreq) { - HashMap formSpecificData = new HashMap(); - //range options need to be stored for object property - //Store field names - List objectSelect = new ArrayList(); - objectSelect.add(editConfiguration.getVarNameForObject()); - //TODO: Check if this is the proper way to do this? - formSpecificData.put("objectSelect", objectSelect); - if(customErrorMessages != null && !customErrorMessages.isEmpty()) { - formSpecificData.put("customErrorMessages", customErrorMessages); - } - editConfiguration.setFormSpecificData(formSpecificData); - } - - public void addFormSpecificDataForAC(EditConfigurationVTwo editConfiguration, VitroRequest vreq, HttpSession session) throws SearchEngineException { - HashMap formSpecificData = new HashMap(); - //Get the edit mode - formSpecificData.put("editMode", getEditMode(vreq).toString().toLowerCase()); - - //We also need the type of the object itself - List types = getRangeTypes(vreq); - //if types array contains only owl:Thing, the search will not return any results - //In this case, set an empty array - if(types.size() == 1 && types.get(0).getURI().equals(VitroVocabulary.OWL_THING) ){ - types = new ArrayList(); - } - - StringBuilder typesBuff = new StringBuilder(); - for (VClass type : types) { - if (type.getURI() != null) { - typesBuff.append(type.getURI()).append(","); - } - } - - formSpecificData.put("objectTypes", typesBuff.toString()); - log.debug("autocomplete object types : " + formSpecificData.get("objectTypes")); - - //Get label for individual if it exists - if(EditConfigurationUtils.getObjectIndividual(vreq) != null) { - String objectLabel = EditConfigurationUtils.getObjectIndividual(vreq).getName(); - formSpecificData.put("objectLabel", objectLabel); - } - - //TODO: find out if there are any individuals in the classes of objectTypes - formSpecificData.put("rangeIndividualsExist", rangeIndividualsExist(types) ); - - formSpecificData.put("sparqlForAcFilter", getSparqlForAcFilter(vreq)); - if(customErrorMessages != null && !customErrorMessages.isEmpty()) { - formSpecificData.put("customErrorMessages", customErrorMessages); - } - editConfiguration.setTemplate(acObjectPropertyTemplate); - editConfiguration.setFormSpecificData(formSpecificData); - } - - private Object rangeIndividualsExist(List types) throws SearchEngineException { - SearchEngine searchEngine = ApplicationUtils.instance().getSearchEngine(); - - boolean rangeIndividualsFound = false; - for( VClass type:types){ - //search for type count. - SearchQuery query = searchEngine.createQuery(); - query.setQuery( VitroSearchTermNames.RDFTYPE + ":" + type.getURI()); - query.setRows(0); - - SearchResponse rsp = searchEngine.query(query); - SearchResultDocumentList docs = rsp.getResults(); - if( docs.getNumFound() > 0 ){ - rangeIndividualsFound = true; - break; - } - } - - return rangeIndividualsFound; - } - - public String getSubjectUri() { - return subjectUri; - } - - public String getPredicateUri() { - return predicateUri; - } - - public String getObjectUri() { - return objectUri; - } - - - /** get the auto complete edit mode */ - public EditMode getEditMode(VitroRequest vreq) { - //In this case, the original jsp didn't rely on FrontEndEditingUtils - //but instead relied on whether or not the object Uri existed - String objectUri = EditConfigurationUtils.getObjectUri(vreq); - EditMode editMode = FrontEndEditingUtils.EditMode.ADD; - if(objectUri != null && !objectUri.isEmpty()) { - editMode = FrontEndEditingUtils.EditMode.EDIT; - - } - return editMode; - } - - public String getSparqlForAcFilter(VitroRequest vreq) { - String subject = EditConfigurationUtils.getSubjectUri(vreq); - String predicate = EditConfigurationUtils.getPredicateUri(vreq); - //Get all objects for existing predicate, filters out results from addition and edit - String query = "SELECT ?objectVar WHERE { " + - "<" + subject + "> <" + predicate + "> ?objectVar .} "; - return query; - } - - -} diff --git a/api/src/main/java/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/CompilationGenerator.java b/api/src/main/java/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/CompilationGenerator.java deleted file mode 100644 index d11c7213..00000000 --- a/api/src/main/java/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/CompilationGenerator.java +++ /dev/null @@ -1,306 +0,0 @@ -/* $This file is distributed under the terms of the license in LICENSE$ */ - -package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators; - -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Calendar; -import java.util.Collection; -import java.util.Date; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Set; -import java.util.TimeZone; - -import javax.servlet.http.HttpSession; - -import org.apache.jena.rdf.model.Literal; -import org.apache.jena.vocabulary.RDFS; -import org.apache.jena.vocabulary.XSD; - -import edu.cornell.mannlib.vitro.webapp.auth.identifier.IdentifierBundle; -import edu.cornell.mannlib.vitro.webapp.auth.identifier.RequestIdentifiers; -import edu.cornell.mannlib.vitro.webapp.auth.identifier.common.HasAssociatedIndividual; -import edu.cornell.mannlib.vitro.webapp.beans.VClass; -import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; -import edu.cornell.mannlib.vitro.webapp.controller.admin.ShowAuthController.AssociatedIndividual; -import edu.cornell.mannlib.vitro.webapp.dao.VitroVocabulary; -import edu.cornell.mannlib.vitro.webapp.dao.WebappDaoFactory; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationUtils; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.EditConfigurationVTwo; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldVTwo; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.validators.AntiXssValidation; - -/** - * Generates the edit configuration for a default property form. - * ModelChangePreprocessor creates the rdfs:label statement. - */ -public class CompilationGenerator extends BaseEditConfigurationGenerator implements EditConfigurationGenerator { - - private String associatedProfile; - private int excerptsCounter; - - @Override - public EditConfigurationVTwo getEditConfiguration(VitroRequest vreq, HttpSession session) { - - EditConfigurationVTwo config = new EditConfigurationVTwo(); - - associatedProfile = getAssociatedProfile(vreq); - excerptsCounter = parseCounter(vreq); - - 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.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()); - String tocLevel = "tocLevel" + itemN; - config.addNewResource(tocLevel, vreq.getWebappDaoFactory().getDefaultNamespace()); - - String tocItemName = tocItem + "Name"; - config.addField(new FieldVTwo(). - setName(tocItemName). - setRangeDatatypeUri(XSD.xstring.getURI()). - setValidators(getCompilationNameValidators(vreq))); - - String tocLevelName = tocLevel + "Name"; - config.addField(new FieldVTwo(). - setName(tocLevelName). - setRangeDatatypeUri(XSD.xstring.getURI()). - setValidators(getCompilationNameValidators(vreq))); - - String excerpt = "excerpt" + itemN; - config.addField(new FieldVTwo(). - setName(excerpt). - setRangeDatatypeUri(XSD.xstring.getURI()). - setValidators(getCompilationNameValidators(vreq))); - - } - config.setUrisOnform(getUrisOnForm()); - config.setLiteralsOnForm( getLiteralsOnForm()); - setUrisAndLiteralsInScope(config); - //No SPARQL queries for existing since this is only used to create new, never for edit - - config.addField(new FieldVTwo(). - setName("newCompilationLabel"). - setRangeDatatypeUri(XSD.xstring.getURI()). - setValidators(getCompilationNameValidators(vreq))); - - - addFormSpecificData(config, vreq); - - config.addValidator(new AntiXssValidation()); - - //This combines the first and last name into the rdfs:label - // currently being done via javascript in the template. May use this again - // when/if updated to ISF ontology. tlw72 -// config.addModelChangePreprocessor(new FoafNameToRdfsLabelPreprocessor()); - - String formUrl = EditConfigurationUtils.getFormUrlWithoutContext(vreq); - config.setFormUrl(formUrl); - - //Note, the spaces are important - they were added by ProcessRdfFormController earlier - //as a means of ensuring the substitution worked correctly - as the regex expects spaces - config.setEntityToReturnTo(" ?newCompilation "); - prepare(vreq, config); - return config; - } - - private List getUrisOnForm() { - List uris = list(); - for (int itemN = 1; itemN <= excerptsCounter; itemN++) { - String excerpt = "excerpt" + itemN; - uris.add(excerpt); - } - return uris; - } - - private List getLiteralsOnForm() { - List literals = list( "newCompilationLabel"); - for (int itemN = 1; itemN <= excerptsCounter; itemN++) { - String tocItemName = "tocItem" + itemN + "Name"; - String tocLevelName = "tocLevel" + itemN + "Name"; - literals.add(tocItemName); - literals.add(tocLevelName); - literals.add("rawQueryString"); - literals.add("queryBuilderRules"); - } - return literals; - } - - private String getAssociatedProfile(VitroRequest vreq) { - String associatedProfile; - IdentifierBundle ids = RequestIdentifiers.getIdBundleForRequest(vreq); - Collection individualURIs = HasAssociatedIndividual.getIndividualUris(ids); - Iterator uriIterator = individualURIs.iterator(); - if (uriIterator.hasNext()) { - associatedProfile = uriIterator.next(); - } else { - associatedProfile = ""; - } - return associatedProfile; - } - - private List generateN3Required(VitroRequest vreq) { - StringBuilder n3Req = new StringBuilder(); - n3Req.append("@prefix ts: .\n"); - n3Req.append("?newCompilation <" + VitroVocabulary.RDF_TYPE + "> <" + getTypeOfNew(vreq) + "> .\n"); - n3Req.append("?newCompilation " + 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"); - - } - //n3Req.append(); - - for (int itemN = 1; itemN <= excerptsCounter; itemN++) { - String tocItemVar = "?tocItem" + itemN ; - String tocItemNameVar = tocItemVar + "Name" ; - String tocLevelVar = "?tocLevel" + itemN ; - String tocLevelVarName = tocLevelVar + "Name" ; - String excerptVar = "?excerpt" + itemN ; - n3Req.append("?newCompilationTOC ts:hasTOCItem " + tocItemVar + " .\n"); - n3Req.append(tocItemVar + " <" + VitroVocabulary.RDF_TYPE + "> ts:TOCItem .\n"); - n3Req.append(tocItemVar + " <" + RDFS.label.getURI() + "> " + tocItemNameVar + " .\n"); - n3Req.append(tocItemVar + " ts:itemNumber " + itemN + " .\n"); - n3Req.append(tocItemVar + " ts:pointsTo " + tocLevelVar + " .\n"); - n3Req.append(tocLevelVar + " <" + VitroVocabulary.RDF_TYPE + "> ts:TOCLevel .\n"); - n3Req.append(tocLevelVar + " <" + RDFS.label.getURI() + "> " + tocLevelVarName + " .\n"); - n3Req.append(tocLevelVar + " ts:hasText " + excerptVar + ".\n"); - } - return list(n3Req.toString()); - } - - private List generateN3Optional() { - List n3OptList = list(); - StringBuilder n3Opt = new StringBuilder(); - n3Opt.append("@prefix ts: .\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"); - sd.setTimeZone(TimeZone.getTimeZone("GMT")); - Date currentTime = Calendar.getInstance().getTime(); - String todayAsString = "\"" + sd.format(currentTime) + "\"^^"; - return todayAsString; - } - - private static Integer parseCounter(VitroRequest vreq) { - String text = vreq.getParameter("excerptsCount"); - if (text == null ) { - return 0; - } - try { - return Integer.parseInt(text); - } catch (NumberFormatException e) { - return 0; - } - } - - - private List getCompilationNameValidators(VitroRequest vreq) { - List validators = new ArrayList(); - if (isCompilationType(vreq)) { - validators.add("nonempty"); - } - return validators; - } - - //Get parameter from HTTP request for type of new individual - private String getTypeOfNew(VitroRequest vreq) { - String typeUri = vreq.getParameter("typeOfNew"); - if( typeUri == null || typeUri.trim().isEmpty() ) - return getCompilationClassURI(); - else - return typeUri; - } - - //Form specific data - public void addFormSpecificData(EditConfigurationVTwo editConfiguration, VitroRequest vreq) { - HashMap formSpecificData = new HashMap(); - formSpecificData.put("typeName", getTypeName(vreq)); - //Put in whether or not person type - if(isCompilationType(vreq)) { - //Doing this b/c unsure how freemarker will handle boolean value from JAVA - formSpecificData.put("isCompilationType", "true"); - } else { - formSpecificData.put("isCompilationType", "false"); - - } - formSpecificData.put("excerptsCounter", excerptsCounter); - - editConfiguration.setFormSpecificData(formSpecificData); - } - - private String getTypeName(VitroRequest vreq) { - String typeOfNew = getTypeOfNew(vreq); - VClass type = vreq.getWebappDaoFactory().getVClassDao().getVClassByURI(typeOfNew); - return type.getName(); - } - - public String getCompilationClassURI() { - return "https://litvinovg.pro/text_structures#compilation"; - } - - public boolean isCompilationType(VitroRequest vreq) { - WebappDaoFactory wdf = vreq.getWebappDaoFactory(); - Boolean isCompilationType = Boolean.FALSE; - String foafPersonType = getCompilationClassURI(); - String typeOfNew = getTypeOfNew(vreq); - List superTypes = wdf.getVClassDao().getAllSuperClassURIs(typeOfNew); - //add the actual type as well so we can add that for the list to be checked - superTypes.add(typeOfNew); - if( superTypes != null ){ - for( String typeUri : superTypes){ - if( foafPersonType.equals(typeUri)) { - isCompilationType = Boolean.TRUE; - break; - } - } - } - return isCompilationType; - } - private void setUrisAndLiteralsInScope(EditConfigurationVTwo editConfiguration) { - HashMap> urisInScope = new HashMap>(); - //note that at this point the subject, predicate, and object var parameters have already been processed - urisInScope.put(editConfiguration.getVarNameForSubject(), - Arrays.asList(new String[]{editConfiguration.getSubjectUri()})); - urisInScope.put(editConfiguration.getVarNameForPredicate(), - Arrays.asList(new String[]{editConfiguration.getPredicateUri()})); - editConfiguration.setUrisInScope(urisInScope); - //Uris in scope include subject, predicate, and object var - - editConfiguration.setLiteralsInScope(new HashMap>()); - } - - private String N3_PREFIX = "@prefix foaf: .\n"; -} diff --git a/home/src/main/resources/rdf/display/everytime/article_custom_fields.n3 b/home/src/main/resources/rdf/display/everytime/article_custom_fields.n3 index 3bc0bb3a..deceee35 100644 --- a/home/src/main/resources/rdf/display/everytime/article_custom_fields.n3 +++ b/home/src/main/resources/rdf/display/everytime/article_custom_fields.n3 @@ -1,77 +1,24 @@ @prefix : . -@prefix searchIndex: . - @prefix rdfs: . -:vivodocumentModifier_excerptsInComplexPublications +:vivodocumentModifier_excerptsInArticles a , ; - rdfs:label "Populate complex publications with excerpts" ; + rdfs:label "Elenph article excerpts" ; :hasTargetField "ALLTEXT" ; :hasSelectQuery """ PREFIX rdfs: - PREFIX ts: + PREFIX ts_: PREFIX rdf: - SELECT DISTINCT ?value + SELECT DISTINCT ?elenphExcerpt ?property ?value WHERE { - ?uri ts:hasTOC ?toc . - ?toc (ts:hasTOCItem/ts:pointsTo)+/ts:hasText ?excerpt . - VALUES ?property { ts:works ts:bibliography ts:htmlExcerpt ts:keywords } - ?excerpt ?property ?value . + ?uri rdf:type ts_:elenphArticle . + ?uri ts_:hasTOC ?toc . + ?toc (ts_:hasTOCItem/ts_:pointsTo)+/ts_:hasText ?elenphExcerpt . + ?elenphExcerpt ?property ?value . } """ . -:vivoUriFinder_excerptsInComplexPublications - a searchIndex:indexing.IndexingUriFinder , - searchIndex:indexing.SelectQueryUriFinder ; - rdfs:label "When excerpts change" ; - :hasSelectQuery """ - PREFIX ts: - SELECT ?uri - WHERE { - ?uri ts:hasTOC ?toc . - ?toc (ts:hasTOCItem/ts:pointsTo)+/ts:hasText ?subject . - } - """ . - -:vivoUriFinder_onRubricsAssign - a searchIndex:indexing.IndexingUriFinder , - searchIndex:indexing.SelectQueryUriFinder ; - rdfs:label "When rubric was assigned" ; - :hasSelectQuery """ - PREFIX ts: - SELECT ?uri - WHERE { - ?subject a ts:textExcerpt . - VALUES ?uri { ?subject } - } - """ . - -:vivodocumentModifier_PopulateTextWithHTMLContentsOfExcerpts - a , - ; - rdfs:label "Html text to text field" ; - :hasTargetField "text" ; - :hasSelectQuery """ - PREFIX rdfs: - PREFIX ts: - PREFIX rdf: - SELECT DISTINCT ?htmlExcerpt - WHERE { - { - ?uri rdf:type ts:textExcerpt . - ?uri ts:htmlExcerpt ?htmlExcerpt . - } - UNION - { - ?uri rdf:type ts:complexPublication . - ?uri ts:hasTOC ?toc . - ?toc (ts:hasTOCItem/ts:pointsTo)+/ts:hasText ?excerpt . - ?excerpt ts:htmlExcerpt ?htmlExcerpt . - } - } - """ . - :vivodocumentModifier_rubrics a , ; @@ -79,22 +26,22 @@ :hasTargetField "rubrics" ; :hasSelectQuery """ PREFIX rdfs: - PREFIX ts: + PREFIX ts_: PREFIX rdf: PREFIX pr: SELECT DISTINCT ?rubric WHERE { { - ?uri rdf:type ts:textExcerpt . + ?uri rdf:type ts_:elenphExcerpt . ?uri pr:belongsTo ?assignedRubric . ?assignedRubric (pr:hasParent)* ?rubric . } UNION { - ?uri rdf:type ts:complexPublication . - ?uri ts:hasTOC ?toc . - ?toc (ts:hasTOCItem/ts:pointsTo)+/ts:hasText ?excerpt . - ?excerpt pr:belongsTo ?assignedRubric . + ?uri rdf:type ts_:elenphArticle . + ?uri ts_:hasTOC ?toc . + ?toc (ts_:hasTOCItem/ts_:pointsTo)+/ts_:hasText ?artExcerpt . + ?artExcerpt pr:belongsTo ?assignedRubric . ?assignedRubric (pr:hasParent)* ?rubric . } } @@ -122,20 +69,20 @@ :hasTargetField "keywords" ; :hasSelectQuery """ PREFIX rdfs: - PREFIX ts: + PREFIX ts_: PREFIX rdf: SELECT DISTINCT ?keywords WHERE { { - ?uri rdf:type ts:elenphArticle . - ?uri ts:hasTOC ?toc . - ?toc (ts:hasTOCItem/ts:pointsTo)+/ts:hasText ?elenphExcerpt . - ?elenphExcerpt ts:keywords ?keywords . + ?uri rdf:type ts_:elenphArticle . + ?uri ts_:hasTOC ?toc . + ?toc (ts_:hasTOCItem/ts_:pointsTo)+/ts_:hasText ?elenphExcerpt . + ?elenphExcerpt ts_:keywords ?keywords . } UNION { - ?uri rdf:type ts:elenphExcerpt . - ?uri ts:keywords ?keywords . + ?uri rdf:type ts_:elenphExcerpt . + ?uri ts_:keywords ?keywords . } } """ . @@ -147,20 +94,20 @@ :hasTargetField "bibliography" ; :hasSelectQuery """ PREFIX rdfs: - PREFIX ts: + PREFIX ts_: PREFIX rdf: SELECT DISTINCT ?bibliography WHERE { { - ?uri rdf:type ts:elenphArticle . - ?uri ts:hasTOC ?toc . - ?toc (ts:hasTOCItem/ts:pointsTo)+/ts:hasText ?elenphExcerpt . - ?elenphExcerpt ts:bibliography ?bibliography . + ?uri rdf:type ts_:elenphArticle . + ?uri ts_:hasTOC ?toc . + ?toc (ts_:hasTOCItem/ts_:pointsTo)+/ts_:hasText ?elenphExcerpt . + ?elenphExcerpt ts_:bibliography ?bibliography . } UNION { - ?uri rdf:type ts:elenphExcerpt . - ?uri ts:bibliography ?bibliography . + ?uri rdf:type ts_:elenphExcerpt . + ?uri ts_:bibliography ?bibliography . } } """ . diff --git a/home/src/main/resources/rdf/display/everytime/compilationDataGetters.n3 b/home/src/main/resources/rdf/display/everytime/compilationDataGetters.n3 deleted file mode 100644 index eab30a54..00000000 --- a/home/src/main/resources/rdf/display/everytime/compilationDataGetters.n3 +++ /dev/null @@ -1,144 +0,0 @@ -@prefix owl: . -@prefix rdf: . -@prefix rdfs: . -@prefix vitro: . -@prefix xsd: . -@prefix ts_: . -@prefix display: . - - - display:hasDataGetter display:getCompilationExcerptsContentDataGetter . - - display:hasDataGetter display:getCompilationExcerptPathsDataGetter . - - display:hasDataGetter display:getCompilationWorksDataGetter . - - display:hasDataGetter display:getCompilationBibliographyDataGetter . - - display:hasDataGetter display:getCompilationAuthorsDataGetter . - - display:hasDataGetter display:getCompilationRubricsDataGetter . - -display:getCompilationExcerptsContentDataGetter - a ; - display:saveToVar "excerpts"; - display:query - """ - PREFIX rdfs: - PREFIX ts_: - SELECT ?elenphExcerpt ?htmlLabel ?htmlContent (COUNT (distinct ?excerptWorks) as ?worksCounter) (COUNT (distinct ?excerptBibliography) as ?bibliographyCounter) - WHERE { - ?individualURI ts_:hasTOC ?toc . - ?toc (ts_:hasTOCItem/ts_:pointsTo)+/ts_:hasText ?elenphExcerpt . - ?elenphExcerpt ts_:htmlExcerpt ?htmlContent . - ?elenphExcerpt rdfs:label ?htmlLabel . - OPTIONAL{ ?elenphExcerpt ts_:works ?excerptWorks . } - OPTIONAL{ ?elenphExcerpt ts_:bibliography ?excerptBibliography . } - } GROUP BY ?elenphExcerpt ?htmlLabel ?htmlContent ORDER BY ?elenphExcerpt - """ . - -display:getCompilationExcerptPathsDataGetter - a ; - display:saveToVar "paths"; - display:query - """ - PREFIX rdfs: - PREFIX rdf: - PREFIX ts_: - SELECT (GROUP_CONCAT(substr(concat("000",str(?outline)),strlen(str(?outline))); SEPARATOR = ".") AS ?path ) (COUNT(?outline) AS ?level) ?tocElement ?elenphExcerpt - WHERE { - ?individualURI ts_:hasTOC ?toc . - ?toc ts_:hasTOCItem/(ts_:pointsTo/ts_:hasTOCItem)* ?tmpTOCItem . - ?tmpTOCItem rdf:type ts_:TOCItem . - ?tmpTOCItem ts_:pointsTo/(ts_:hasTOCItem/ts_:pointsTo)* ?tocElement . - ?tmpTOCItem ts_:itemNumber ?outline . - OPTIONAL { - ?tocElement ts_:hasText ?elenphExcerpt . - } - { - SELECT ?tocElement - WHERE { - ?individualURI ts_:hasTOC ?toc . - ?toc (ts_:hasTOCItem/ts_:pointsTo)+ ?tocElement . - ?tocElement rdf:type ts_:TOCLevel . - } - } - } GROUP BY ?tocElement ?elenphExcerpt ORDER BY ?path - """ . - -display:getCompilationBibliographyDataGetter - a ; - display:saveToVar "bibliography"; - display:query - """ - PREFIX rdfs: - PREFIX ts_: - PREFIX rdf: - SELECT DISTINCT ?bibliography ?excerpt - WHERE { - ?individualURI ts_:hasTOC ?toc . - ?toc (ts_:hasTOCItem/ts_:pointsTo)+/ts_:hasText ?excerpt . - ?excerpt ts_:bibliography ?bibliography . - } ORDER BY ?bibliography - """ . - -display:getCompilationWorksDataGetter - a ; - display:saveToVar "works"; - display:query - """ - PREFIX rdfs: - PREFIX ts_: - PREFIX rdf: - SELECT DISTINCT ?works ?excerpt - WHERE { - ?individualURI ts_:hasTOC ?toc . - ?toc (ts_:hasTOCItem/ts_:pointsTo)+/ts_:hasText ?excerpt . - ?excerpt ts_:works ?works . - } ORDER BY ?works - """ . - -display:getCompilationAuthorsDataGetter - a ; - display:saveToVar "authors"; - display:query - """ - PREFIX rdfs: - PREFIX ts_: - PREFIX rdf: - SELECT DISTINCT ?authorInitials ?authorFamily ?authorGivenName ?orgName ?orgPostalCode ?orgAddress - WHERE { - ?individualURI ts_:hasTOC ?toc . - ?toc (ts_:hasTOCItem/ts_:pointsTo)+/ts_:hasText ?elenphExcerpt . - ?elenphExcerpt ts_:hasAuthor ?participant . - ?participant ts_:participantFamily ?authorFamily . - ?participant ts_:participantInitials ?authorInitials . - ?participant ts_:participantGivenName ?authorGivenName . - OPTIONAL { ?participant ts_:affiliatedWith ?organization . - OPTIONAL { ?organization ts_:officialOrganizationName ?orgName } . - OPTIONAL { ?organization ts_:organizationPostalCode ?orgPostalCode } . - OPTIONAL { ?organization ts_:organizationAddress ?orgAddress } . - } - - } ORDER BY ?authorFamily - """ . - -display:getCompilationRubricsDataGetter - a ; - display:saveToVar "rubrics"; - display:query - """ - PREFIX rdfs: - PREFIX ts_: - PREFIX rdf: - PREFIX pr: - SELECT DISTINCT ?rubricID ?rubricName - WHERE { - ?uri ts_:hasTOC ?toc . - ?toc (ts_:hasTOCItem/ts_:pointsTo)+/ts_:hasText ?artExcerpt . - ?artExcerpt pr:belongsTo ?rubricID . - ?rubricID rdfs:label ?rubricName . - } ORDER BY ?rubricID - """ . - - diff --git a/home/src/main/resources/rdf/display/everytime/customSearchDataGetters.n3 b/home/src/main/resources/rdf/display/everytime/customSearchDataGetters.n3 index 746d5a88..b5829a4f 100644 --- a/home/src/main/resources/rdf/display/everytime/customSearchDataGetters.n3 +++ b/home/src/main/resources/rdf/display/everytime/customSearchDataGetters.n3 @@ -35,8 +35,7 @@ display:customSearchFiltersDataGetter ?searchFilter search:id ?id . ?searchFilter search:filterFiled ?searchField . ?searchField search:indexField ?field . - BIND (replace ( ?name, "«", "" ) AS ?sortName) - } ORDER BY ?field ?sortName + } ORDER BY ?field ?name """ . diff --git a/home/src/main/resources/rdf/display/everytime/deleteQueries.n3 b/home/src/main/resources/rdf/display/everytime/deleteQueries.n3 deleted file mode 100644 index 6431a4f9..00000000 --- a/home/src/main/resources/rdf/display/everytime/deleteQueries.n3 +++ /dev/null @@ -1,48 +0,0 @@ -@prefix display: . - display:hasDeleteQuery """ - PREFIX ts: - DESCRIBE ?individualURI ?tocElement ?tocItem ?toc - WHERE { - OPTIONAL { - ?individualURI ts:hasTOC ?toc . - ?toc (ts:hasTOCItem/ts:pointsTo)* ?tocElement . - OPTIONAL { - ?tocElement ts:hasTOCItem ?tocItem . - } - } - } - """ . - display:hasDeleteQuery """ - PREFIX ts: - PREFIX rdf: - DESCRIBE ?individualURI ?tocElement ?tocItem ?toc ?excerpt ?author ?organization - WHERE { - ?individualURI rdf:type ts:elenphArticle . - OPTIONAL { - ?individualURI ts:hasTOC ?toc . - ?toc (ts:hasTOCItem/ts:pointsTo)* ?tocElement . - OPTIONAL { - ?tocElement ts:hasTOCItem ?tocItem . - } - OPTIONAL { - ?tocElement ts:hasText ?excerpt . - OPTIONAL { - ?excerpt ts:hasAuthor ?author . - OPTIONAL { - ?author ts:affiliatedWith ?organization . - } - } - } - } - } - """ . - - display:hasDeleteQuery """ - PREFIX ts: - DESCRIBE ?individualURI ?tocElement - WHERE - { - ?tocElement ts:hasText ?individualURI . - FILTER NOT EXISTS {?tocElement ts:hasTOCItem ?tocItem } - } - """ . diff --git a/home/src/main/resources/rdf/display/everytime/elenphArticleDataGetters.n3 b/home/src/main/resources/rdf/display/everytime/elenphArticleDataGetters.n3 index 3c7a3977..647aa06c 100644 --- a/home/src/main/resources/rdf/display/everytime/elenphArticleDataGetters.n3 +++ b/home/src/main/resources/rdf/display/everytime/elenphArticleDataGetters.n3 @@ -26,15 +26,12 @@ display:getArticleExcerptsContentDataGetter """ PREFIX rdfs: PREFIX ts_: - SELECT ?elenphExcerpt ?htmlLabel ?htmlContent (COUNT (distinct ?excerptWorks) as ?worksCounter) (COUNT (distinct ?excerptBibliography) as ?bibliographyCounter) + SELECT ?elenphExcerpt ?property ?value WHERE { ?individualURI ts_:hasTOC ?toc . ?toc (ts_:hasTOCItem/ts_:pointsTo)+/ts_:hasText ?elenphExcerpt . - ?elenphExcerpt ts_:htmlExcerpt ?htmlContent . - ?elenphExcerpt rdfs:label ?htmlLabel . - OPTIONAL{ ?elenphExcerpt ts_:works ?excerptWorks . } - OPTIONAL{ ?elenphExcerpt ts_:bibliography ?excerptBibliography . } - } GROUP BY ?elenphExcerpt ?htmlLabel ?htmlContent ORDER BY ?elenphExcerpt + ?elenphExcerpt ?property ?value . + } ORDER BY ?elenphExcerpt """ . display:getArticleExcerptPathsDataGetter @@ -42,11 +39,11 @@ display:getArticleExcerptPathsDataGetter display:saveToVar "paths"; display:query """ - PREFIX rdfs: - PREFIX rdf: - PREFIX ts_: - SELECT (GROUP_CONCAT(substr(concat("000",str(?outline)),strlen(str(?outline))); SEPARATOR = ".") AS ?path ) (COUNT(?outline) AS ?level) ?tocElement ?elenphExcerpt - WHERE { + PREFIX rdfs: + PREFIX rdf: + PREFIX ts_: + SELECT (GROUP_CONCAT(substr(concat("000",str(?outline)),strlen(str(?outline))); SEPARATOR = ".") AS ?path ) ?tocElement ?elenphExcerpt + WHERE { ?individualURI ts_:hasTOC ?toc . ?toc ts_:hasTOCItem/(ts_:pointsTo/ts_:hasTOCItem)* ?tmpTOCItem . ?tmpTOCItem rdf:type ts_:TOCItem . @@ -56,11 +53,12 @@ display:getArticleExcerptPathsDataGetter ?tocElement ts_:hasText ?elenphExcerpt . } { - SELECT ?elenphArticle ?tocElement + SELECT ?elenphArticle ?tocElement WHERE { - ?individualURI ts_:hasTOC ?toc . - ?toc (ts_:hasTOCItem/ts_:pointsTo)+ ?tocElement . + ?individualURI ts_:hasTOC ?toc . + ?toc (ts_:hasTOCItem/ts_:pointsTo)+ ?tocElement . ?tocElement rdf:type ts_:TOCLevel . + ?individualURI rdf:type ts_:elenphArticle . } } } GROUP BY ?tocElement ?elenphExcerpt ORDER BY ?path @@ -74,11 +72,11 @@ display:getArticleBibliographyDataGetter PREFIX rdfs: PREFIX ts_: PREFIX rdf: - SELECT DISTINCT ?bibliography ?excerpt + SELECT DISTINCT ?bibliography WHERE { ?individualURI ts_:hasTOC ?toc . - ?toc (ts_:hasTOCItem/ts_:pointsTo)+/ts_:hasText ?excerpt . - ?excerpt ts_:bibliography ?bibliography . + ?toc (ts_:hasTOCItem/ts_:pointsTo)+/ts_:hasText ?elenphExcerpt . + ?elenphExcerpt ts_:bibliography ?bibliography . } ORDER BY ?bibliography """ . @@ -90,11 +88,11 @@ display:getArticleWorksDataGetter PREFIX rdfs: PREFIX ts_: PREFIX rdf: - SELECT DISTINCT ?works ?excerpt + SELECT DISTINCT ?works WHERE { ?individualURI ts_:hasTOC ?toc . - ?toc (ts_:hasTOCItem/ts_:pointsTo)+/ts_:hasText ?excerpt . - ?excerpt ts_:works ?works . + ?toc (ts_:hasTOCItem/ts_:pointsTo)+/ts_:hasText ?elenphExcerpt . + ?elenphExcerpt ts_:works ?works . } ORDER BY ?works """ . @@ -106,21 +104,12 @@ display:getArticleAuthorsDataGetter PREFIX rdfs: PREFIX ts_: PREFIX rdf: - SELECT DISTINCT ?authorInitials ?authorFamily ?authorGivenName ?orgName ?orgPostalCode ?orgAddress - WHERE { - ?individualURI ts_:hasTOC ?toc . - ?toc (ts_:hasTOCItem/ts_:pointsTo)+/ts_:hasText ?elenphExcerpt . - ?elenphExcerpt ts_:hasAuthor ?participant . - ?participant ts_:participantFamily ?authorFamily . - ?participant ts_:participantInitials ?authorInitials . - ?participant ts_:participantGivenName ?authorGivenName . - OPTIONAL { ?participant ts_:affiliatedWith ?organization . - OPTIONAL { ?organization ts_:officialOrganizationName ?orgName } . - OPTIONAL { ?organization ts_:organizationPostalCode ?orgPostalCode } . - OPTIONAL { ?organization ts_:organizationAddress ?orgAddress } . - } - - } ORDER BY ?authorFamily + SELECT DISTINCT ?author + WHERE { + ?individualURI ts_:hasTOC ?toc . + ?toc (ts_:hasTOCItem/ts_:pointsTo)+/ts_:hasText ?elenphExcerpt . + ?elenphExcerpt ts_:author ?author . + } ORDER BY ?author """ . display:getArticleRubricsDataGetter diff --git a/home/src/main/resources/rdf/display/everytime/elenphExcerptDataGetters.n3 b/home/src/main/resources/rdf/display/everytime/elenphExcerptDataGetters.n3 index 8cbf13e7..bf9c94e7 100644 --- a/home/src/main/resources/rdf/display/everytime/elenphExcerptDataGetters.n3 +++ b/home/src/main/resources/rdf/display/everytime/elenphExcerptDataGetters.n3 @@ -8,7 +8,6 @@ display:hasDataGetter display:getExcerptAssignedArticlesDataGetter . - display:hasDataGetter display:getExcerptAuthorsDataGetter . display:getExcerptAssignedArticlesDataGetter @@ -28,25 +27,3 @@ display:getExcerptAssignedArticlesDataGetter } ORDER BY ?articleName """ . -display:getExcerptAuthorsDataGetter - a ; - display:saveToVar "authors"; - display:query - """ - PREFIX rdfs: - PREFIX ts_: - PREFIX rdf: - SELECT DISTINCT ?authorInitials ?authorFamily ?authorGivenName ?orgName ?orgPostalCode ?orgAddress - WHERE { - ?individualURI ts_:hasAuthor ?participant . - ?participant ts_:participantFamily ?authorFamily . - ?participant ts_:participantInitials ?authorInitials . - ?participant ts_:participantGivenName ?authorGivenName . - OPTIONAL { ?participant ts_:affiliatedWith ?organization . - OPTIONAL { ?organization ts_:officialOrganizationName ?orgName } . - OPTIONAL { ?organization ts_:organizationPostalCode ?orgPostalCode } . - OPTIONAL { ?organization ts_:organizationAddress ?orgAddress } . - } - - } ORDER BY ?authorFamily - """ . diff --git a/home/src/main/resources/rdf/display/everytime/excluded_classes.n3 b/home/src/main/resources/rdf/display/everytime/excluded_classes.n3 deleted file mode 100644 index bf183cda..00000000 --- a/home/src/main/resources/rdf/display/everytime/excluded_classes.n3 +++ /dev/null @@ -1,11 +0,0 @@ -@prefix vitroDisplay: . - -vitroDisplay:SearchIndex vitroDisplay:excludeClass . -vitroDisplay:SearchIndex vitroDisplay:excludeClass . -vitroDisplay:SearchIndex vitroDisplay:excludeClass . -vitroDisplay:SearchIndex vitroDisplay:excludeClass . -vitroDisplay:SearchIndex vitroDisplay:excludeClass . -vitroDisplay:SearchIndex vitroDisplay:excludeClass . -vitroDisplay:SearchIndex vitroDisplay:excludeClass . -vitroDisplay:SearchIndex vitroDisplay:excludeClass . -vitroDisplay:SearchIndex vitroDisplay:excludeClass . diff --git a/home/src/main/resources/rdf/tbox/filegraph/philosophical_relations.owl b/home/src/main/resources/rdf/tbox/filegraph/philosophical_relations.owl index e2aa1a3d..d98c7605 100644 --- a/home/src/main/resources/rdf/tbox/filegraph/philosophical_relations.owl +++ b/home/src/main/resources/rdf/tbox/filegraph/philosophical_relations.owl @@ -72,7 +72,6 @@ - edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.AddRubricToELENPHArticleGenerator belongs to @@ -80,7 +79,7 @@ true - + diff --git a/home/src/main/resources/rdf/tbox/filegraph/text_structures.owl b/home/src/main/resources/rdf/tbox/filegraph/text_structures.owl index ef5adf7e..f29d37ae 100644 --- a/home/src/main/resources/rdf/tbox/filegraph/text_structures.owl +++ b/home/src/main/resources/rdf/tbox/filegraph/text_structures.owl @@ -1,6 +1,5 @@ - Text structures Ontology - Text structures Ontology ts + Text structures Ontology - - - - Table of contents - Table of contents - - - - - -1 - -1 - -1 - -1 - - - Complex Publication - -1 - -1 - - - + + + + + -1 + -1 + Book + + + Table of contents + -1 + -1 + + + + + + - -1 - -1 - - Publication - Publication - -1 - -1 - - - - Publication Participant -1 - - TOC Item - TOC Item - - - - - - - - - Organization - - - - - - - elenphAritcle.ftl - Electronic philosophical encyclopedia article - - - - - - - - - - - - compilation.ftl - Compilation - edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators.CompilationGenerator - - - - - - - - - - Text excerpt - - - - Book - Book - - - -1 - -1 - -1 - -1 - - - - -1 - -1 - - -1 - -1 - - Journal Article - - - Encyclopedia article @@ -186,7 +81,13 @@ >-1 -1 - + + + + TOC Item + + + @@ -195,53 +96,56 @@ elenphExcerpt.ftl - + + + Elenph Excerpt + + + + elenphAritcle.ftl + Electronic philosophical encyclopedia article + + + + + + + + Text excerpt + + + + + + + + + Journal + -1 + -1 + + + + + - - - TOC Level - TOC Level - - Table of contents element + Table of contents element + TOC Level + + + - - has author - - - - - - true - - - affiliated with - - - - - - true - - - compilatorOf - - - - - - true - @@ -256,13 +160,22 @@ + + has TOC + + + + + + + true + has text - has text @@ -287,31 +200,29 @@ true - - Query Builder Rules - + + + author + + - - - + + + - - Raw Query String - + + - - - - - + + - - - Publication Participant Initials - + Works + @@ -326,14 +237,6 @@ - - Publication Participant Given Name - - - - - - @@ -346,15 +249,6 @@ >First publication - - Modification time - - - - - - - Keywords @@ -380,46 +274,6 @@ html Excerpt - - Publication Participant Family - - - - - - - - - - Issue - - - - - - - - - Publication Participant email - - - - - - - - - - - - - - - Works - - Year and month @@ -433,6 +287,18 @@ + + + + + + + + + + Affiliation + @@ -458,31 +324,18 @@ - - Organization Address - - - - - - - - Organization Postal Code - + + + Issue + + - - - - - - Official Organization Name + - - - - + @@ -509,17 +362,4 @@ - - - - - true - - - has TOC - has TOC - - diff --git a/webapp/src/main/webapp/WEB-INF/resources/shortview_config.n3 b/webapp/src/main/webapp/WEB-INF/resources/shortview_config.n3 deleted file mode 100644 index c912bc22..00000000 --- a/webapp/src/main/webapp/WEB-INF/resources/shortview_config.n3 +++ /dev/null @@ -1,27 +0,0 @@ -@prefix ts_: . -@prefix display: . -@prefix mydomain: . - -ts_:elenphExcerpt display:hasCustomView mydomain:elenphExcerptShortView . - -mydomain:elenphExcerptShortView - a display:customViewForIndividual ; - display:appliesToContext "SEARCH" ; - display:hasTemplate "elenphExcerptShortView.ftl" ; - display:hasDataGetter mydomain:elenphExcerptShortViewDataGetter . - -mydomain:elenphExcerptShortViewDataGetter - a ; - display:saveToVar "excerptInfo"; - display:query - """ - PREFIX rdfs: - PREFIX vivo: - PREFIX rdf: - PREFIX ts_: - SELECT ?property ?value - WHERE { - ?individualUri ?property ?value . - ?individualUri rdf:type ts_:elenphExcerpt . - } - """ . diff --git a/webapp/src/main/webapp/favicon.ico b/webapp/src/main/webapp/favicon.ico index d6f769bc..fe936708 100644 Binary files a/webapp/src/main/webapp/favicon.ico and b/webapp/src/main/webapp/favicon.ico differ diff --git a/webapp/src/main/webapp/js/toc.js b/webapp/src/main/webapp/js/toc.js deleted file mode 100644 index 3d46e7c7..00000000 --- a/webapp/src/main/webapp/js/toc.js +++ /dev/null @@ -1,18 +0,0 @@ -{ - let content = document.getElementById("wrapper-content"); - let toc = document.getElementById("TOC"); - createTOC(content, toc); - - function createTOC(content, toc){ - if (toc === null){ - alert("no TOC element found"); - return; - } - if (content === null){ - alert("no content element found"); - return; - } - - } - -} diff --git a/webapp/src/main/webapp/robots.txt b/webapp/src/main/webapp/robots.txt index 659b6c36..ed35ce7c 100644 --- a/webapp/src/main/webapp/robots.txt +++ b/webapp/src/main/webapp/robots.txt @@ -22,3 +22,4 @@ Disallow: /vis/ # VIVO addition Disallow: /visualizationAjax/ # VIVO addition Disallow: /visualizationData/ # VIVO addition Disallow: /qrcode # VIVO addition +Disallow: /individual # VIVO addition diff --git a/webapp/src/main/webapp/templates/freemarker/body/partials/menupage/menupage-browse.ftl b/webapp/src/main/webapp/templates/freemarker/body/partials/menupage/menupage-browse.ftl deleted file mode 100644 index 5f94bcdb..00000000 --- a/webapp/src/main/webapp/templates/freemarker/body/partials/menupage/menupage-browse.ftl +++ /dev/null @@ -1,49 +0,0 @@ -<#-- $This file is distributed under the terms of the license in LICENSE$ --> - -<#-- Template for browsing individuals in class groups for menupages --> - -<#import "lib-string.ftl" as str> - - - - diff --git a/webapp/src/main/webapp/templates/freemarker/body/partials/shortview/view-search-default.ftl b/webapp/src/main/webapp/templates/freemarker/body/partials/shortview/view-search-default.ftl index 33db0830..be693ca2 100644 --- a/webapp/src/main/webapp/templates/freemarker/body/partials/shortview/view-search-default.ftl +++ b/webapp/src/main/webapp/templates/freemarker/body/partials/shortview/view-search-default.ftl @@ -4,10 +4,8 @@ <#import "lib-vivo-properties.ftl" as p> -
${individual.name} <@p.displayTitle individual />

${individual.snippet}

-
diff --git a/webapp/src/main/webapp/templates/freemarker/body/search/search-error.ftl b/webapp/src/main/webapp/templates/freemarker/body/search/search-error.ftl deleted file mode 100644 index 3f08f55d..00000000 --- a/webapp/src/main/webapp/templates/freemarker/body/search/search-error.ftl +++ /dev/null @@ -1,16 +0,0 @@ -<#-- $This file is distributed under the terms of the license in LICENSE$ --> - -<#-- Template for displaying search error message --> - -<#if title??> -
-

${title?html}

-
- -
-

- ${message?html} -

-
-<#include "searchSelector.ftl"> -<#include "search-help.ftl" > diff --git a/webapp/src/main/webapp/templates/freemarker/body/search/search-help.ftl b/webapp/src/main/webapp/templates/freemarker/body/search/search-help.ftl deleted file mode 100644 index e892f96d..00000000 --- a/webapp/src/main/webapp/templates/freemarker/body/search/search-help.ftl +++ /dev/null @@ -1,49 +0,0 @@ -<#-- $This file is distributed under the terms of the license in LICENSE$ --> - -<#if origination?has_content && origination == "helpLink"> -
-

Search Tips

-
- - Back to results - -<#else> -
-

Search Tips

-
- -
    -
  • Keep it simple! Use short, single terms unless your searches are returning too many results.
  • -
  • Use quotes to search for an entire phrase -- e.g., "protein folding".
  • -
  • Except for boolean operators, searches are not case-sensitive, so "Geneva" and "geneva" are equivalent
  • -
  • If you are unsure of the correct spelling, put ~ at the end of your search term -- e.g., cabage~ finds cabbage, steven~ finds Stephen and Stefan (as well as other similar names).
  • -
- - - - -${stylesheets.add('')} - diff --git a/webapp/src/main/webapp/templates/freemarker/body/search/search-pagedResults.ftl b/webapp/src/main/webapp/templates/freemarker/body/search/search-pagedResults.ftl deleted file mode 100644 index 83c45e9f..00000000 --- a/webapp/src/main/webapp/templates/freemarker/body/search/search-pagedResults.ftl +++ /dev/null @@ -1,252 +0,0 @@ -<#-- $This file is distributed under the terms of the license in LICENSE$ --> - -<#-- Template for displaying paged search results --> - -

- -<#include "searchSelector.ftl"> - -<#escape x as x?html> -
${i18n().search_results_for} '${querytext}'
-
<#if classGroupName?has_content>${i18n().limited_to_type} '${classGroupName}'
-
<#if typeName?has_content>${i18n().limited_to_type} '${typeName}'
- - - - ${i18n().download_results} -<#-- --> -

- -${i18n().not_expected_results} -
- - <#-- Refinement links --> - <#if classGroupLinks?has_content && classGroupLinks?size gt 1> -
-

${i18n().display_only}

-
    - <#list classGroupLinks as link> -
  • ${link.text}(${link.count})
  • - -
-
- - - <#if classLinks?has_content && classLinks?size gt 1 > -
- <#if classGroupName?has_content> -

${i18n().limit} ${classGroupName} ${i18n().to}

- <#else> -

${i18n().limit_to}

- -
    - <#list classLinks as link> -
  • ${link.text}(${link.count})
  • - -
-
- - - -
- - <#if user.loggedIn> - - -
- - - - <#-- Search results --> -
    - <#list individuals as individual> -
  • - <@shortView uri=individual.uri viewContext="search" /> -
  • - -
- - - <#-- Paging controls --> - <#if (pagingLinks?size > 0)> -
- ${i18n().pages}: - <#if prevPage??> - <#list pagingLinks as link> - <#if link.url??> - ${link.text} - <#else> - ${link.text} <#-- no link if current page --> - - - <#if nextPage??> -
- -
- - <#-- VIVO OpenSocial Extension by UCSF --> - <#if openSocial??> - <#if openSocial.visible> -

OpenSocial

- - - - - - -
- - - -${stylesheets.add('', - '', - '')} - -${headScripts.add('', - '', - '' - )} - -${scripts.add('')} diff --git a/webapp/src/main/webapp/themes/iph/templates/compilation.ftl b/webapp/src/main/webapp/templates/freemarker/elenphAritcle.ftl similarity index 69% rename from webapp/src/main/webapp/themes/iph/templates/compilation.ftl rename to webapp/src/main/webapp/templates/freemarker/elenphAritcle.ftl index 73e9704b..24f93877 100644 --- a/webapp/src/main/webapp/themes/iph/templates/compilation.ftl +++ b/webapp/src/main/webapp/templates/freemarker/elenphAritcle.ftl @@ -7,13 +7,8 @@ <#include "individual-setup.ftl"> ${scripts.add('')} ${scripts.add('')} -${scripts.add('')} -${scripts.add('')} -${scripts.add('')} <#import "individual-qrCodeGenerator.ftl" as qr> <#import "lib-vivo-properties.ftl" as vp> -<#include "text-lib.ftl"> - <#--Number of labels present--> <#if !labelCount??> <#assign labelCount = 0 > @@ -34,8 +29,6 @@ ${scripts.add(' <#-- <@dumpAll /> --> <#assign selectedTemplate = "individual--foaf-person-2column.ftl" > @@ -183,7 +239,6 @@ ${scripts.add('')} -${scripts.add('')} -${scripts.add('')} -${scripts.add('')} -${scripts.add('')} - - +<#-- $This file is distributed under the terms of the license in LICENSE$ --> <#-- Individual profile page template for foaf:Person individuals --> - <#-- <#include "individual-setup.ftl"> --> <#import "individual-qrCodeGenerator.ftl" as qr> <#import "lib-vivo-properties.ftl" as vp> -<#include "text-lib.ftl"> - <#--Number of labels present--> <#if !labelCount??> <#assign labelCount = 0 > @@ -38,8 +27,6 @@ ${scripts.add('')} +${scripts.add('')} + +<#assign selectedTemplate = "elenphExcerpt-internal.ftl" > + +<#if profilePageTypesEnabled > + <#assign profilePageType = profileType > + + <#-- targetedView takes precedence over the profilePageType. --> + + <#if targetedView?has_content> + <#if targetedView != "standardView"> + <#assign selectedTemplate = "individual--foaf-person-quickview.ftl" > + + <#elseif profilePageType == "quickView" > + <#assign selectedTemplate = "individual--foaf-person-quickview.ftl" > + + +<#include selectedTemplate > diff --git a/webapp/src/main/webapp/themes/iph/templates/elenphExcerptShortView.ftl b/webapp/src/main/webapp/templates/freemarker/elenphExcerptShortView.ftl similarity index 85% rename from webapp/src/main/webapp/themes/iph/templates/elenphExcerptShortView.ftl rename to webapp/src/main/webapp/templates/freemarker/elenphExcerptShortView.ftl index bae63143..f02ff303 100644 --- a/webapp/src/main/webapp/themes/iph/templates/elenphExcerptShortView.ftl +++ b/webapp/src/main/webapp/templates/freemarker/elenphExcerptShortView.ftl @@ -4,6 +4,7 @@ <#import "lib-vivo-properties.ftl" as p> <#-- <@dumpAll /> --> + -
+
${individual.name} <@p.displayTitle individual />

${individual.snippet}

diff --git a/webapp/src/main/webapp/themes/iph/templates/elenph_issue.ftl b/webapp/src/main/webapp/templates/freemarker/elenph_issue.ftl similarity index 55% rename from webapp/src/main/webapp/themes/iph/templates/elenph_issue.ftl rename to webapp/src/main/webapp/templates/freemarker/elenph_issue.ftl index 5f1ed9eb..f4ca50d0 100644 --- a/webapp/src/main/webapp/themes/iph/templates/elenph_issue.ftl +++ b/webapp/src/main/webapp/templates/freemarker/elenph_issue.ftl @@ -5,17 +5,17 @@ <#if !issueName??> <#assign issueName = article.issue> <#assign divOpened = true > - -
-

${article.name}

+ +
+

${article.name}

<#elseif issueName == article.issue> -

${article.name}

+

${article.name}

<#else> <#assign issueName = article.issue>
- -
-

${article.name}

+ +
+

${article.name}

<#if divOpened> @@ -38,8 +38,4 @@ for (i = 0; i < coll.length; i++) { } }); } -var issueContents = document.getElementsByClassName("issue"); -for (i = 0; i < issueContents.length; i++) { - issueContents[i].style.display = "none"; -} diff --git a/webapp/src/main/webapp/themes/iph/templates/rubric.ftl b/webapp/src/main/webapp/templates/freemarker/rubric.ftl similarity index 70% rename from webapp/src/main/webapp/themes/iph/templates/rubric.ftl rename to webapp/src/main/webapp/templates/freemarker/rubric.ftl index cddbd8b1..f2330967 100644 --- a/webapp/src/main/webapp/themes/iph/templates/rubric.ftl +++ b/webapp/src/main/webapp/templates/freemarker/rubric.ftl @@ -1,20 +1,16 @@ <#import "lib-vivo-properties.ftl" as vp> <#include "individual-setup.ftl"> -${scripts.add('')} -${scripts.add('')} -
<#include "individual-adminPanel.ftl">
-
<#if relatedSubject??>

${relatedSubject.relatingPredicateDomainPublic} ${i18n().for} ${relatedSubject.name}

← ${i18n().return_to(relatedSubject.name)}

<#else> -

style="width:100%;border-right:1px solid #A6B1B0;"> +

style="float:left;width:100%;border-right:1px solid #A6B1B0;"> <@p.label individual editable labelCount localesCount/>

@@ -22,7 +18,6 @@ ${scripts.add(' + + diff --git a/webapp/src/main/webapp/themes/iph/templates/rubrics.ftl b/webapp/src/main/webapp/templates/freemarker/rubrics.ftl similarity index 66% rename from webapp/src/main/webapp/themes/iph/templates/rubrics.ftl rename to webapp/src/main/webapp/templates/freemarker/rubrics.ftl index 16f4c88b..ae08ad5a 100644 --- a/webapp/src/main/webapp/themes/iph/templates/rubrics.ftl +++ b/webapp/src/main/webapp/templates/freemarker/rubrics.ftl @@ -1,15 +1,8 @@ -${scripts.add('')} -${scripts.add('')} - <#list rubrics as rubric> <#if !rubric.parentUri??> <#assign childs = rubric.childs?number> + <@openButton childs=childs/>${rubric.name}
<#include "developer.ftl"> @@ -10,4 +10,23 @@
  • class="selected" >${item.linkText}
  • - \ No newline at end of file + + +
    + <#if flash?has_content> + <#if flash?starts_with(i18n().menu_welcomestart) > +
    + +
    + <#else> +
    + +
    + + + + diff --git a/webapp/src/main/webapp/themes/iph/templates/page-home.ftl b/webapp/src/main/webapp/themes/iph/templates/page-home.ftl index b533b050..0af25af7 100644 --- a/webapp/src/main/webapp/themes/iph/templates/page-home.ftl +++ b/webapp/src/main/webapp/themes/iph/templates/page-home.ftl @@ -30,75 +30,59 @@ <#include "identity.ftl"> <#include "menu.ftl"> - <#include "contentWrapper.ftl"> +
    - <#--

    ${i18n().intro_title}

    +

    ${i18n().intro_title}

    ${i18n().intro_para1}

    -

    ${i18n().intro_para2}

    --> - +

    ${i18n().intro_para2}

    -

    filteredSearch

    +

    ${i18n().intro_searchvivo} filteredSearch

    ${i18n().search_form} +
    - <#include "searchSelector.ftl"> -
    + <#include "queryBuilder.ftl"> +
    -
    -
    О проекте
    -
    -

    Электронная Философская Энциклопедия (ЭФЭ) — открытый научно-исследовательский проект Института философии РАН, ставящий своей целью анализ и систематизацию достижений философских наук за последние десятилетия, создание на этой основе обобщающей картины развития философской мысли в мире во всем ее тематическом и содержательном многообразии. В отличие от прежних энциклопедических изданий, ЭФЭ призвана рассмотреть достижения философии прошлого сквозь призму современных дискуссий, отразить новейшие результаты исследований российских учёных и актуальные тенденции гуманитарного знания. Она нацелена на обобщающий взгляд, который не только фиксирует многообразие имен, понятий, терминов, школ и произведений мировой философии, но, прежде всего, выявляет ее сложную, противоречивую и плюралистичную целостность. Одной из ее доминант является преодоление европоцентризма в понимании философии, всечеловеческое расширение духовного горизонта. Создаваемая ведущими специалистами, ЭФЭ должна способствовать повышению философской культуры общества, стать надежным и авторитетным источником информации, составив конкуренцию всевозможным "пиратским" сайтам, бездумно копирующим сведения из неизвестных и непроверенных источников. Как полноценное электронное издание с выходными данными и закрепленными за отдельными статьями DOI, ЭФЭ позволит специалистам представлять результаты своих исследований в виде энциклопедических статей.

    -
    -
    -

    Редакционно-издательский совет

    -

    А.А. Гусейнов, В.А. Лекторский, А.В. Смирнов, С.В. Месяц

    -

    Редколлегия

    -

    Н.С. Автономова, Р.Г. Апресян, В.В. Бычков, В.Г. Буданов,
    В.В. Васильев, П.А. Гаджикурбанова, А.Л. Доброхотов, А.А. Кара-Мурза,
    И.Т. Касавин, В.Г. Лысенко, М.А. Маслин, В.В. Миронов,
    Н.В. Мотрошилова, В.А. Подорога, Ю.В. Синеокая, М.Т. Степанянц,
    В.Г. Федотова, В.К. Шохин, А.В. Черняев

    -

    Экспертный совет

    -

    Р.Г. Апресян, В.Г. Буданов, Г.В. Вдовина, И.Д. Джохадзе, Л.Б. Карелова,
    В.Г. Лысенко, Н.Б. Маньковская, А.В. Павлов, В.В. Петров,
    С.Ю. Рыков, Ю.В. Синеокая, М.А. Солопова, Ю.Е. Федорова,
    В.И. Шалак, В.К. Шохин, А.В. Черняев

    -

    Научный редактор

    -

    Ю.Н. Попов

    -

    Научно-техническая редакция

    -

    М.В. Егорочкин, Г.В. Литвинов, С.Л. Гурко, С.В. Лаврентьева

    -
    - -
    -

    ISSN (Online): 2658-7092

    -

    Учредитель и издатель: Федеральное государственное бюджетное учреждение науки Институт философии Российской Академии наук.

    -

    Периодичность: 4 раза в год. Выходит с 2018 г.

    -

    Адрес учредителя и издателя: Российская Федерация, 109240, г. Москва, ул. Гончарная, д. 12, стр. 1.

    -

    Сайт: www.elenph.org

    - -
    - -
    -

    Энциклопедия зарегистрирована Федеральной службой по надзору в сфере связи, информационных технологий и массовых коммуникаций (Роскомнадзор). Свидетельство о регистрации СМИ: серия ЭЛ № ФС77 -74569 от 14.12.2018.

    -

    Энциклопедия включена в: базу ROAD (справочник электронных научных ресурсов с полностью открытым доступом к статьям).

    - -
    -
    - - <#-- <@lh.researchClasses /> --> + <@widget name="login" /> + + + <@lh.researchClasses /> - <#-- <@lh.facultyMbrHtml /> --> + <@lh.facultyMbrHtml /> - <#-- <@lh.academicDeptsHtml /> --> + <@lh.academicDeptsHtml /> <#if geoFocusMapsEnabled > <@lh.geographicFocusHtml /> - + + <@lh.allClassGroups vClassGroups! /> - <#include "footer.ftl"> <#-- builds a json object that is used by js to render the academic departments section --> <@lh.listAcademicDepartments /> diff --git a/webapp/src/main/webapp/themes/iph/templates/page.ftl b/webapp/src/main/webapp/themes/iph/templates/page.ftl index 224f8745..f1a2d5b2 100644 --- a/webapp/src/main/webapp/themes/iph/templates/page.ftl +++ b/webapp/src/main/webapp/themes/iph/templates/page.ftl @@ -7,29 +7,12 @@ <#include "head.ftl"> - + <#include "identity.ftl"> + <#include "search.ftl" > <#include "menu.ftl"> -
    - <#if currentServlet = "individual"||currentServlet = "display"||currentServlet = "entity"> - <#include "rightPanel.ftl"> - - <#include "contentWrapper.ftl"> - <#if currentServlet != "individual" && currentServlet != "login" && currentServlet != "display" && currentServlet != "customsearch" && currentServlet != "entity"> -
    -

    filteredSearch

    - -
    - ${i18n().search_form} -
    - - <#include "searchSelector.ftl"> - -
    - - <#-- VIVO OpenSocial Extension by UCSF --> <#if openSocial??> <#if openSocial.visible> @@ -38,7 +21,7 @@ ${body} -
    + <#include "footer.ftl"> diff --git a/webapp/src/main/webapp/themes/iph/templates/queryBuilder.ftl b/webapp/src/main/webapp/themes/iph/templates/queryBuilder.ftl index 81062b49..619835fc 100644 --- a/webapp/src/main/webapp/themes/iph/templates/queryBuilder.ftl +++ b/webapp/src/main/webapp/themes/iph/templates/queryBuilder.ftl @@ -1,148 +1,64 @@ - - - - -<#macro openDocPart count path > - <#if excerptTextName??> - <#assign buttonText = excerptTextName > - <#else> - <#assign buttonText = "No text" > - - <#list 1..count as x> - -
    - - - -<#macro arrangeSources sources counter identifier filter="none"> - <#if sources?? && sources?has_content && counter > 0> - <@compress single_line=true> - - -
    - <#assign lastSource = ""/> - <#list sources as source> - <#if filter == "none" && lastSource != source.works || source.excerpt == filter > - <#assign lastSource = source.works/> -
    -

    ${source.works}

    -
    - - -
    - - - -<#macro arrangeLiterature literature counter identifier filter="none"> - - <#if literature?? && literature?has_content && counter > 0> - <@compress single_line=true> - - -
    - <#assign lastLiterature = ""/> - <#list literature as literatureItem> - <#if filter == "none" && lastLiterature != literatureItem.bibliography || literatureItem.excerpt == filter > - <#assign lastLiterature = literatureItem.bibliography/> -
    -

    ${literatureItem.bibliography}

    -
    - - -
    - - - - -<#macro authors_metadata> - <#if authors?? && authors?has_content> - - - - - - -<#macro authors_underline> - <#if authors?? && authors?has_content> -
    - <#list authors as author> - <#if author.authorFamily??>${author.authorFamily?trim}<#if author.authorInitials??> ${author.authorInitials?trim}<#sep>, - -
    - - - -<#macro expandMetadataSwitch> -
    - -
    - - -<#macro expandSwitch> -
    - -
    - - -<#macro userSettingsModal> - - - - - - -