VIVO Documentation
Page History
Table of Contents |
---|
Introduction
The search page can be customized in terms of filters and sort options. For the purpose of customizing search page an ontology has been defined. How the default configuration looks like can be seen at Using Search.
Ontology
The ontology is presented below.
Code Block |
---|
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix search: <https://vivoweb.org/ontology/vitro-search#> .
@prefix vitro: <http://vitro.mannlib.cornell.edu/ns/vitro/0.7#> .
<https://vivoweb.org/ontology/vitro-search>
a owl:Ontology ;
vitro:ontologyPrefixAnnot "search" .
search:PublicParameter a owl:Class .
search:SearchField a owl:Class .
search:FilterValue a owl:Class ;
rdfs:subClassOf search:PublicParameter .
search:Sort a owl:Class ;
rdfs:subClassOf search:PublicParameter .
search:RangeFilter a owl:Class ;
rdfs:subClassOf search:Filter .
search:FilterGroup a owl:Class ;
rdfs:subClassOf search:PublicParameter .
search:Filter a owl:Class ;
rdfs:subClassOf search:PublicParameter .
search:multivalued a owl:DatatypeProperty , owl:FunctionalProperty ;
rdfs:domain search:SearchField ;
rdfs:range xsd:boolean .
search:isAscending a owl:DatatypeProperty , owl:FunctionalProperty ;
rdfs:domain search:Sort ;
rdfs:range xsd:boolean .
search:indexField a owl:DatatypeProperty , owl:FunctionalProperty ;
rdfs:domain search:SearchField ;
rdfs:range xsd:string .
search:contains a owl:ObjectProperty ;
rdfs:domain search:FilterGroup ;
rdfs:range search:Filter .
search:step a owl:DatatypeProperty , owl:FunctionalProperty ;
rdfs:domain search:RangeFilter ;
rdfs:range xsd:int .
search:isLanguageSpecific
a owl:DatatypeProperty , owl:FunctionalProperty ;
rdfs:domain search:SearchField ;
rdfs:range xsd:boolean .
search:filterField a owl:ObjectProperty , owl:FunctionalProperty ;
rdfs:domain search:Filter ;
rdfs:range search:SearchField .
search:isUriValues a owl:DatatypeProperty , owl:FunctionalProperty ;
rdfs:domain search:Filter ;
rdfs:range xsd:boolean .
search:order a owl:FunctionalProperty , owl:DatatypeProperty ;
rdfs:domain search:PublicParameter ;
rdfs:range xsd:integer .
search:userInput a owl:DatatypeProperty , owl:FunctionalProperty ;
rdfs:domain search:Filter ;
rdfs:range xsd:boolean .
search:from a owl:DatatypeProperty , owl:FunctionalProperty ;
rdfs:domain search:RangeFilter ;
rdfs:range xsd:string .
search:userInputRegex
a owl:DatatypeProperty , owl:FunctionalProperty ;
rdfs:domain search:Filter ;
rdfs:range xsd:boolean .
search:sortField a owl:FunctionalProperty , owl:ObjectProperty ;
rdfs:domain search:Sort ;
rdfs:range search:SearchField .
search:hasFallback a owl:FunctionalProperty , owl:ObjectProperty ;
rdfs:domain search:Sort ;
rdfs:range search:Sort .
search:id a owl:DatatypeProperty , owl:FunctionalProperty ;
rdfs:domain search:PublicParameter ;
rdfs:range xsd:string .
search:facetResults a owl:DatatypeProperty , owl:FunctionalProperty ;
rdfs:domain search:Filter ;
rdfs:range xsd:boolean .
search:to a owl:DatatypeProperty , owl:FunctionalProperty ;
rdfs:domain search:RangeFilter ;
rdfs:range xsd:string .
search:hasKnownValue a owl:ObjectProperty ;
rdfs:domain search:Filter ;
rdfs:range search:FilterValue .
search:public a owl:DatatypeProperty , owl:FunctionalProperty ;
rdfs:domain search:PublicParameter ;
rdfs:range xsd:boolean .
search:display a owl:DatatypeProperty , owl:FunctionalProperty ;
rdfs:domain search:Sort ;
rdfs:range xsd:boolean .
search:isDefaultForRole
a owl:ObjectProperty ;
rdfs:domain search:FilterValue ;
rdfs:range auth:PermissionSet .
search:moreLimit
a owl:FunctionalProperty ;
rdfs:domain search:Filter ;
rdfs:range xsd:int ;
rdfs:subPropertyOf owl:topDataProperty> . |
Filters
An example of configuration search page filters is provided below. It includes one filter group with four filters. The first filter is range filter and enables filtering by start and end date. The second and third filters enable filtering by organizations and persons, respectively. The last one is filter which enables selection of publication years. The first filter is not public, therefore it wouldn't be seen by visitors, i.e. not logged in users. The listed configuration is default one present in the VIVO codebase by default, and it can be customized for the specific need of a VIVO instance. Moreover, there are also a couple more filters defined in the Vitro codebase by default.
Code Block |
---|
@prefix : <https://vivoweb.org/ontology/vitro-search-individual/> .
@prefix vitro-search: <https://vivoweb.org/ontology/vitro-search#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
:filter_group_search_filters a vitro-search:FilterGroup ;
vitro-search:contains :filter_dates , :filter_organizations , :filter_persons , :filter_publication_year .
:filter_dates a vitro-search:RangeFilter ;
vitro-search:id "dates" ;
vitro-search:filterField :field_dates ;
vitro-search:from "1900" ;
vitro-search:to "2030" ;
vitro-search:public false .
:field_dates a vitro-search:SearchField ;
vitro-search:indexField "dates_drsim" .
:filter_organizations a vitro-search:Filter ;
vitro-search:id "organizations" ;
vitro-search:filterField :field_organizations ;
vitro-search:facetResults true ;
vitro-search:isUriValues true ;
vitro-search:public true .
:field_organizations a vitro-search:SearchField ;
vitro-search:indexField "organizations_ss" ;
vitro-search:multivalued true .
:filter_persons a vitro-search:Filter ;
vitro-search:id "persons" ;
vitro-search:filterField :field_persons ;
vitro-search:facetResults true ;
vitro-search:isUriValues true ;
vitro-search:public true .
:field_persons a vitro-search:SearchField ;
vitro-search:indexField "persons_ss" ;
vitro-search:isLanguageSpecific true ;
vitro-search:multivalued true .
:filter_publication_year a vitro-search:Filter ;
vitro-search:id "publication_year" ;
vitro-search:filterField :field_publication_year ;
vitro-search:facetResults true ;
vitro-search:public true .
:field_publication_year a vitro-search:SearchField ;
vitro-search:indexField "publication_year_ss" .
|
Role based search filtering
Besides defining whether some field is public or not, the VIVO customers can define SelectQueryDocumentModifier for filters which can include typeRestrictions and selectQuery. In this way some restrictions for searching can be defined. Moreover, it is possible to define role-based search results filtering. For instance, it is possible that only a certain type of results can be displayed for a certain role. The listing below presents configuration which is showing only instances of Continent class for public, admin and self-editor.
Code Block |
---|
@prefix : <https://vivoweb.org/ontology/vitro-search-individual/> .
@prefix vitro-search: <https://vivoweb.org/ontology/vitro-search#> .
@prefix auth: <http://vitro.mannlib.cornell.edu/ns/vitro/authorization#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
:locations_value
a vitro-search:FilterValue ;
rdfs:label "Continent"@en-US ;
vitro-search:id "http://vivoweb.org/ontology/core#Continent" ;
vitro-search:public true ;
vitro-search:isDefaultForRole auth:SELF_EDITOR , auth:ADMIN , auth:PUBLIC .
:filter_type vitro-search:hasKnownValue :locations_value . |
Sorting
The options for sorting search results can be also customized. The default configuration enables sorting by title ascending, by title descending, and by relevance. However, it is possible to extend list of fields for sorting. For instance, sorting by dates can be added.
Code Block |
---|
@prefix : <https://vivoweb.org/ontology/vitro-search-individual/> .
@prefix vitro-search: <https://vivoweb.org/ontology/vitro-search#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
:sort_title_desc a vitro-search:Sort ;
vitro-search:isAscending false ;
vitro-search:hasFallback :sort_name_raw_desc ;
vitro-search:order 30 ;
vitro-search:sortField :field_label_sort ;
vitro-search:display true ;
vitro-search:id "titledesc" .
:sort_title_asc a vitro-search:Sort ;
vitro-search:isAscending true ;
vitro-search:hasFallback :sort_name_raw_asc ;
vitro-search:order 20 ;
vitro-search:sortField :field_label_sort ;
vitro-search:display true ;
vitro-search:id "titleasc" .
:sort_name_raw_desc a vitro-search:Sort ;
vitro-search:isAscending false ;
vitro-search:order 50 ;
vitro-search:sortField :field_name_raw ;
vitro-search:id "name_raw_desc" .
:sort_name_raw_asc a vitro-search:Sort ;
vitro-search:isAscending true ;
vitro-search:order 40 ;
vitro-search:sortField :field_name_raw ;
vitro-search:id "name_raw_asc" .
:sort_by_relevance a vitro-search:Sort ;
vitro-search:sortField :field_score ;
vitro-search:display true ;
vitro-search:order 60 ;
vitro-search:id "relevance" .
:field_score
a vitro-search:SearchField ;
vitro-search:indexField "score" .
:field_label_sort
a vitro-search:SearchField ;
vitro-search:isLanguageSpecific true ;
vitro-search:indexField "_label_sort" .
:field_name_raw
a vitro-search:SearchField ;
vitro-search:indexField "nameRaw" .
|