java.lang.Object
it.uniroma2.art.semanticturkey.services.STServiceAdapter
it.uniroma2.art.semanticturkey.services.core.Search
All Implemented Interfaces:
NewerNewStyleService, STService

@STService public class Search extends STServiceAdapter
  • Field Details

    • logger

      protected static org.slf4j.Logger logger
  • Constructor Details

    • Search

      public Search()
  • Method Details

    • createIndexes

      @STServiceOperation @Write @PreAuthorize("@auth.isAdmin()") public void createIndexes() throws Exception
      Creates the Indexes. Only useful in GraphDB repositories
      Throws:
      Exception
    • updateIndexes

      @STServiceOperation @Write @PreAuthorize("@auth.isAdmin()") public void updateIndexes() throws Exception
      Updates the indexes. Only useful in GraphDB repositories
      Throws:
      Exception
    • customSearch

      @STServiceOperation(method=GET) @Read @PreAuthorize("@auth.isAuthorized(\'rdf(resource)\', \'R\')") public Collection<AnnotatedValue<org.eclipse.rdf4j.model.Resource>> customSearch(String searchParameterizationReference, @JsonSerialized Map<String,org.eclipse.rdf4j.model.Value> boundValues) throws IOException, ConfigurationNotFoundException, WrongPropertiesException, NoSuchConfigurationManager, STPropertyAccessException
      Perform a custom search by passing a SPARQL query and a map of variable-value to assign to such SPARQL query
      Parameters:
      searchParameterizationReference - the SPARQL query to execute
      boundValues - the map of variable-value to assign to the the SPARQL query
      Returns:
      The list of AnnotatedValue with all the infos about the desired resources
      Throws:
      IOException
      ConfigurationNotFoundException
      WrongPropertiesException
      NoSuchConfigurationManager
      STPropertyAccessException
    • advancedSearch

      @STServiceOperation(method=POST) @Read @PreAuthorize("@auth.isAuthorized(\'rdf(resource)\', \'R\')") public Collection<AnnotatedValue<org.eclipse.rdf4j.model.Resource>> advancedSearch(@Optional String searchString, @Optional(defaultValue="true") boolean useLexicalizations, @Optional(defaultValue="false") boolean useLocalName, @Optional(defaultValue="false") boolean useURI, SearchMode searchMode, @Optional(defaultValue="false") boolean useNotes, @Optional List<String> langs, @Optional(defaultValue="false") boolean includeLocales, SearchStrategy.StatusFilter statusFilter, @Optional @JsonSerialized List<List<org.eclipse.rdf4j.model.IRI>> types, @Optional @JsonSerialized List<List<org.eclipse.rdf4j.model.IRI>> schemes, @Optional @JsonSerialized List<Pair<org.eclipse.rdf4j.model.IRI,List<org.eclipse.rdf4j.model.Value>>> outgoingLinks, @Optional @JsonSerialized List<TripleForSearch<org.eclipse.rdf4j.model.IRI,String,SearchMode>> outgoingSearch, @Optional @JsonSerialized List<Pair<org.eclipse.rdf4j.model.IRI,List<org.eclipse.rdf4j.model.Value>>> ingoingLinks, @Optional(defaultValue="false") boolean searchInRDFSLabel, @Optional(defaultValue="false") boolean searchInSKOSLabel, @Optional(defaultValue="false") boolean searchInSKOSXLLabel, @Optional(defaultValue="false") boolean searchInOntolex) throws IllegalStateException, STPropertyAccessException, SearchStatusException
      Perform a complex search with many custom input parameters If parameter useURI is true and searchMode is startsWith, prefixes in qname (in the searchString) are expanded
      Parameters:
      searchString - the text to search
      useLexicalizations - true to search in the lexicalizations, false otherwise. Optional and default value is true
      useLocalName - true to search in the localName of the resources, false otherwise
      useURI - true to search in the URI of the resources, false otherwise
      searchMode - the searchMode to use during the search. Check SearchMode to get the * possible SerchMode
      useNotes - true to search in all the values of the skos:note and its subProperties, false otherwise. Can be set to true only if * the parameter useLocalName is true as well. Optional and default value is false
      langs - the languages of the Literals in which to search the input text. Optional
      includeLocales - true to includes locales in the search
      statusFilter - the status of the desired resources. Check SearchStrategy.StatusFilter to get the possible Statuses
      types - the list of
      schemes - the list of schemes in which the skos:Concept will be searched. Useful only in SKOS/SKOSXL. This list is composed of List of Schemes considered in AND (so an OR list of AND schemes) Optional
      outgoingLinks - a list of outgoing predicate and List of Values for the desired resources
      outgoingSearch - a list of outgoing predicate and a search function (stringSearch and SearchMode) for the object of such predicate for the desired resources
      ingoingLinks - a list of incoming predicate and List of Values for the desired resources
      searchInRDFSLabel - true to search in rdfs:label, false otherwise. Optional and default value is false
      searchInSKOSLabel - true to search in SKOS lexicalizations, false otherwise. Optional and default value is false
      searchInSKOSXLLabel - true to search in SKOSXL Lericalizations, false otherwise. Optional and default value is false
      searchInOntolex - true to search in ONTOLEX lexicalizations, false otherwise. Optional and default value is false
      Returns:
      The list of AnnotatedValue with all the infos about the desired resources
      Throws:
      IllegalStateException
      STPropertyAccessException
      SearchStatusException
    • searchAlignedResources

      @STServiceOperation @Read @PreAuthorize("@auth.isAuthorized(\'rdf(resource)\', \'R\')") public Collection<AnnotatedValue<org.eclipse.rdf4j.model.Resource>> searchAlignedResources(String searchString, boolean useLocalName, boolean useURI, SearchMode searchMode, @Optional(defaultValue="false") boolean useNotes, @Optional List<String> langs, @Optional(defaultValue="false") boolean includeLocales, @Optional List<org.eclipse.rdf4j.model.IRI> predList, @Optional(defaultValue="30") int maxNumOfResPerQuery) throws STPropertyAccessException, SearchStatusException
      Throws:
      STPropertyAccessException
      SearchStatusException
    • searchResource

      @STServiceOperation @Read @PreAuthorize("@auth.isAuthorized(\'rdf(resource)\', \'R\')") public Collection<AnnotatedValue<org.eclipse.rdf4j.model.Resource>> searchResource(String searchString, String[] rolesArray, @Optional(defaultValue="true") boolean useLexicalizations, boolean useLocalName, boolean useURI, SearchMode searchMode, @Optional(defaultValue="false") boolean useNotes, @Optional List<org.eclipse.rdf4j.model.IRI> schemes, @Optional(defaultValue="or") String schemeFilter, @Optional List<String> langs, @Optional(defaultValue="false") boolean includeLocales, @Optional(defaultValue="false") boolean searchInRDFSLabel, @Optional(defaultValue="false") boolean searchInSKOSLabel, @Optional(defaultValue="false") boolean searchInSKOSXLLabel, @Optional(defaultValue="false") boolean searchInOntolex) throws IllegalStateException, STPropertyAccessException, SearchStatusException
      The standard search in all resources. Its input can be a URI (part of it) or a text (part of a Lexicalization and/or notes) depending on the other input parameters. It returns all relevant info about the desired resources (such as the show). If parameter useURI is true and searchMode is startsWith, prefixes in qname (in the searchString) are expanded
      Parameters:
      searchString - the text to search
      rolesArray - the role(s) the returned resources should belong to
      useLexicalizations - true to search in the lexicalizations, false otherwise. Optional and default value is true
      useLocalName - true to search in the localName of the resources, false otherwise
      useURI - true to search in the URI of the resources, false otherwise
      searchMode - the searchMode to use during the search. Check SearchMode to get the possible SerchMode
      useNotes - true to search in all the values of the skos:note and its subProperties, false otherwise. Can be set to true only if the parameter useLocalName is true as well. Optional and default value is false
      schemes - the list of schemes in which the skos:Concept will be searched. Useful only in SKOS/SKOSXL. Optional
      schemeFilter - if the returned concepts should belong to just one of the input sheme ()or value or to all of them (and value). Optional and default value is or
      langs - the languages of the Literals in which to search the input text. Optional
      includeLocales - true to includes locales in the search (e.g. searching in 'en' will include results from 'en-us' as well). Optional and default value is false
      searchInRDFSLabel - true to search in rdfs:label, false otherwise. Optional and default value is false
      searchInSKOSLabel - true to search in SKOS lexicalizations, false otherwise. Optional and default value is false
      searchInSKOSXLLabel - true to search in SKOSXL Lericalizations, false otherwise. Optional and default value is false
      searchInOntolex - true to search in ONTOLEX lexicalizations, false otherwise. Optional and default value is false
      Returns:
      The list of AnnotatedValue with all the infos about the desired resources
      Throws:
      IllegalStateException
      STPropertyAccessException
      SearchStatusException
    • searchStringList

      @STServiceOperation @Read @PreAuthorize("@auth.isAuthorized(\'rdf(resource)\', \'R\')") public Collection<String> searchStringList(String searchString, @Optional String[] rolesArray, boolean useLocalName, SearchMode searchMode, @Optional List<org.eclipse.rdf4j.model.IRI> schemes, @Optional(defaultValue="or") String schemeFilter, @Optional List<String> langs, @Optional org.eclipse.rdf4j.model.IRI cls, @Optional(defaultValue="false") boolean includeLocales) throws IllegalStateException, STPropertyAccessException, SearchStatusException
      Searches the Resource (and returns their labels), according to the input parameters, and return their IRIs (as String)
      Parameters:
      searchString - the text to search
      rolesArray - the role(s) the returned resources should belong to. Optional
      useLocalName - true to search in the localName of the resources, false otherwise
      searchMode - the searchMode to use during the search. Check SearchMode to get the * possible SerchMode
      schemes - the list of schemes in which the skos:Concept will be searched. Useful only in SKOS/SKOSXL. Optional
      schemeFilter - if the returned concepts should belong to just one of the input sheme ()or value or to all of them (and value). * Optional and default value is or
      langs - the languages of the Literals in which to search the input text. Optional
      cls - the iri of the class in which to search Instances matching the input text. Optional
      includeLocales - true to includes locales in the search (e.g. searching in 'en' will include results from 'en-us' as well). * Optional and default value is false
      Returns:
      the list of Labels of the desired resources
      Throws:
      IllegalStateException
      STPropertyAccessException
      SearchStatusException
    • searchURIList

      @STServiceOperation @Read @PreAuthorize("@auth.isAuthorized(\'rdf(resource)\', \'R\')") public Collection<String> searchURIList(String searchString, @Optional String[] rolesArray, SearchMode searchMode, @Optional List<org.eclipse.rdf4j.model.IRI> schemes, @Optional(defaultValue="or") String schemeFilter, @Optional org.eclipse.rdf4j.model.IRI cls, @Optional(defaultValue="0") @Min(0L) @jakarta.validation.constraints.Min(0L) int maxNumResults) throws IllegalStateException, STPropertyAccessException, SearchStatusException
      Search the resources, according to the specified input parameters If searchMode is startsWith, prefixes in qname (in the searchString) are expanded
      Parameters:
      searchString - the text to search
      rolesArray - the role(s) the returned resources should belong to. Optional
      searchMode - the searchMode to use during the search. Check SearchMode to get the * possible SerchMode
      schemes - the list of schemes in which the skos:Concept will be searched. Useful only in SKOS/SKOSXL. Optional
      schemeFilter - if the returned concepts should belong to just one of the input sheme ()or value or to all of them (and value). * Optional and default value is or
      cls - the iri of the classes in which to search Instances matching the input text. Optional
      maxNumResults - the maximum number of results the service will return. Only positive numbers are accepted. 0 means no limit in the number of results. Optional and default value is 0 (no limit)
      Returns:
      List of Local names of the retrieved resources
      Throws:
      IllegalStateException
      STPropertyAccessException
      SearchStatusException
    • searchInstancesOfClass

      @STServiceOperation @Read @PreAuthorize("@auth.isAuthorized(\'rdf(cls, instances)\', \'R\')") public Collection<AnnotatedValue<org.eclipse.rdf4j.model.Resource>> searchInstancesOfClass(org.eclipse.rdf4j.model.IRI cls, String searchString, @Optional(defaultValue="true") boolean useLexicalizations, boolean useLocalName, boolean useURI, SearchMode searchMode, @Optional(defaultValue="false") boolean useNotes, @Optional List<String> langs, @Optional(defaultValue="false") boolean includeLocales, @Optional(defaultValue="false") boolean includeNonDirect) throws IllegalStateException, STPropertyAccessException, SearchStatusException
      Searched the Instances of the given class and return all relevant info about the desired resources (such as the show).
      Parameters:
      cls - the iri of the classes in which to search Instances matching the input text
      searchString - the text to search
      useLexicalizations - true to search in the lexicalizations, false otherwise. Optional and default value is true
      useLocalName - true to search in the localName of the resources, false otherwise
      useURI - true to search in the URI of the resources, false otherwise
      searchMode - the searchMode to use during the search. Check SearchMode to get the * possible SerchMode
      useNotes - true to search in all the values of the skos:note and its subProperties, false otherwise. Can be set to true only if * the parameter useLocalName is true as well. Optional and default value is false
      langs - the languages of the Literals in which to search the input text. Optional
      includeLocales - true to includes locales in the search (e.g. searching in 'en' will include results from 'en-us' as well). * Optional and default value is false
      Returns:
      he list of AnnotatedValue with all the infos about the desired instances
      Throws:
      IllegalStateException
      STPropertyAccessException
      SearchStatusException
    • searchLexicalEntry

      @STServiceOperation @Read @PreAuthorize("@auth.isAuthorized(\'rdf(limeLexicon)\', \'R\')") public Collection<AnnotatedValue<org.eclipse.rdf4j.model.Resource>> searchLexicalEntry(String searchString, @Optional(defaultValue="true") boolean useLexicalizations, boolean useLocalName, boolean useURI, SearchMode searchMode, @Optional(defaultValue="false") boolean useNotes, @Optional List<org.eclipse.rdf4j.model.IRI> lexicons, @Optional List<String> langs, @Optional(defaultValue="false") boolean includeLocales, @Optional(defaultValue="false") boolean searchInRDFSLabel, @Optional(defaultValue="false") boolean searchInSKOSLabel, @Optional(defaultValue="false") boolean searchInSKOSXLLabel, @Optional(defaultValue="false") boolean searchInOntolex) throws IllegalStateException, STPropertyAccessException, SearchStatusException
      Search in the Lexical Entries
      Parameters:
      searchString - the text to search
      useLexicalizations - true to search in the lexicalizations, false otherwise. Optional and default value is true
      useLocalName - true to search in the localName of the resources, false otherwise
      useURI - true to search in the URI of the resources, false otherwise
      searchMode - the searchMode to use during the search. Check SearchMode to get the * possible SerchMode
      useNotes - true to search in all the values of the skos:note and its subProperties, false otherwise. Can be set to true only if * the parameter useLocalName is true as well. Optional and default value is false
      lexicons - the Lexicons the Lexical Entries should belong to (in OR)
      langs - the languages of the Literals in which to search the input text. Optional
      includeLocales - true to includes locales in the search (e.g. searching in 'en' will include results from 'en-us' as well). * Optional and default value is false
      searchInRDFSLabel - true to search in rdfs:label, false otherwise. Optional and default value is false
      searchInSKOSLabel - true to search in SKOS lexicalizations, false otherwise. Optional and default value is false
      searchInSKOSXLLabel - true to search in SKOSXL Lericalizations, false otherwise. Optional and default value is false
      searchInOntolex - true to search in ONTOLEX lexicalizations, false otherwise. Optional and default value is false * @return The list of AnnotatedValue with all the infos about the desired resources
      Returns:
      The list of AnnotatedValue with all the infos about the desired Lexical Entries
      Throws:
      IllegalStateException
      STPropertyAccessException
      SearchStatusException
    • getPathFromRoot

      @STServiceOperation @Read @PreAuthorize("@auth.isAuthorized(\'rdf(\' +@auth.typeof(#resourceURI)+ \')\', \'R\')") public Collection<AnnotatedValue<org.eclipse.rdf4j.model.Resource>> getPathFromRoot(RDFResourceRole role, org.eclipse.rdf4j.model.IRI resourceURI, @Optional List<org.eclipse.rdf4j.model.IRI> schemesIRI, @Optional(defaultValue="or") String schemeFilter, @Optional(defaultValue="<http://www.w3.org/2002/07/owl#Thing>") org.eclipse.rdf4j.model.IRI root, @Optional @LocallyDefinedResources List<org.eclipse.rdf4j.model.IRI> broaderProps, @Optional @LocallyDefinedResources List<org.eclipse.rdf4j.model.IRI> narrowerProps, @Optional(defaultValue="true") boolean includeSubProperties) throws InvalidParameterException
      Returns the shortest path from the Root Element to the desired resource
      Parameters:
      role - the role of the input resource
      resourceURI - the input resource to which the path is searched
      schemesIRI - the list of schemes in which the skos:Concept will be searched. Useful only in SKOS/SKOSXL. Optional
      schemeFilter - if the returned concepts should belong to just one of the input sheme ()or value or to all of them (and value). * Optional and default value is or
      root - the Root element (if a single root is present). Optional
      broaderProps - the list of broader property to use (when role is concept)
      narrowerProps - the list of broader property to use (when role is concept)
      includeSubProperties - true to include subproperty of the broader/narrower passed properties (when role is concept)
      Returns:
      the shortest path to reach the desired concept
      Throws:
      InvalidParameterException
    • searchPrefix

      @STServiceOperation @Read @PreAuthorize("@auth.isAuthorized(\'rdf(resource)\', \'R\')") public Collection<String> searchPrefix(String searchString, SearchMode searchMode)
    • getCustomSearchSettings

      @STServiceOperation public Settings getCustomSearchSettings(Scope scope) throws NoSuchSettingsManager, STPropertyAccessException
      Throws:
      NoSuchSettingsManager
      STPropertyAccessException
    • storeCustomSearchSettings

      @PreAuthorize("@auth.isSettingsActionAuthorized(#scope, \'U\')") @STServiceOperation(method=POST) public void storeCustomSearchSettings(Scope scope, com.fasterxml.jackson.databind.node.ObjectNode settings) throws NoSuchSettingsManager, STPropertyAccessException, IllegalStateException, STPropertyUpdateException, WrongPropertiesException
      Throws:
      NoSuchSettingsManager
      STPropertyAccessException
      IllegalStateException
      STPropertyUpdateException
      WrongPropertiesException