Class Search
java.lang.Object
it.uniroma2.art.semanticturkey.services.STServiceAdapter
it.uniroma2.art.semanticturkey.services.core.Search
- All Implemented Interfaces:
NewerNewStyleService
,STService
-
Field Summary
FieldsFields inherited from class it.uniroma2.art.semanticturkey.services.STServiceAdapter
applicationEventPublisher, cfManager, exptManager, stServiceContext
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCollection<AnnotatedValue<org.eclipse.rdf4j.model.Resource>>
advancedSearch
(String searchString, boolean useLexicalizations, boolean useLocalName, boolean useURI, SearchMode searchMode, boolean useNotes, List<String> langs, boolean includeLocales, SearchStrategy.StatusFilter statusFilter, List<List<org.eclipse.rdf4j.model.IRI>> types, List<List<org.eclipse.rdf4j.model.IRI>> schemes, List<Pair<org.eclipse.rdf4j.model.IRI, List<org.eclipse.rdf4j.model.Value>>> outgoingLinks, List<TripleForSearch<org.eclipse.rdf4j.model.IRI, String, SearchMode>> outgoingSearch, List<Pair<org.eclipse.rdf4j.model.IRI, List<org.eclipse.rdf4j.model.Value>>> ingoingLinks, boolean searchInRDFSLabel, boolean searchInSKOSLabel, boolean searchInSKOSXLLabel, boolean searchInOntolex) 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 expandedvoid
Creates the Indexes.Collection<AnnotatedValue<org.eclipse.rdf4j.model.Resource>>
customSearch
(String searchParameterizationReference, Map<String, org.eclipse.rdf4j.model.Value> boundValues) Perform a custom search by passing a SPARQL query and a map of variable-value to assign to such SPARQL querygetCustomSearchSettings
(Scope scope) Collection<AnnotatedValue<org.eclipse.rdf4j.model.Resource>>
getPathFromRoot
(RDFResourceRole role, org.eclipse.rdf4j.model.IRI resourceURI, List<org.eclipse.rdf4j.model.IRI> schemesIRI, String schemeFilter, org.eclipse.rdf4j.model.IRI root, List<org.eclipse.rdf4j.model.IRI> broaderProps, List<org.eclipse.rdf4j.model.IRI> narrowerProps, boolean includeSubProperties) Returns the shortest path from the Root Element to the desired resourceCollection<AnnotatedValue<org.eclipse.rdf4j.model.Resource>>
searchAlignedResources
(String searchString, boolean useLocalName, boolean useURI, SearchMode searchMode, boolean useNotes, List<String> langs, boolean includeLocales, List<org.eclipse.rdf4j.model.IRI> predList, int maxNumOfResPerQuery) Collection<AnnotatedValue<org.eclipse.rdf4j.model.Resource>>
searchInstancesOfClass
(org.eclipse.rdf4j.model.IRI cls, String searchString, boolean useLexicalizations, boolean useLocalName, boolean useURI, SearchMode searchMode, boolean useNotes, List<String> langs, boolean includeLocales, boolean includeNonDirect) Searched the Instances of the given class and return all relevant info about the desired resources (such as the show).Collection<AnnotatedValue<org.eclipse.rdf4j.model.Resource>>
searchLexicalEntry
(String searchString, boolean useLexicalizations, boolean useLocalName, boolean useURI, SearchMode searchMode, boolean useNotes, List<org.eclipse.rdf4j.model.IRI> lexicons, List<String> langs, boolean includeLocales, boolean searchInRDFSLabel, boolean searchInSKOSLabel, boolean searchInSKOSXLLabel, boolean searchInOntolex) Search in the Lexical EntriessearchPrefix
(String searchString, SearchMode searchMode) Collection<AnnotatedValue<org.eclipse.rdf4j.model.Resource>>
searchResource
(String searchString, String[] rolesArray, boolean useLexicalizations, boolean useLocalName, boolean useURI, SearchMode searchMode, boolean useNotes, List<org.eclipse.rdf4j.model.IRI> schemes, String schemeFilter, List<String> langs, boolean includeLocales, boolean searchInRDFSLabel, boolean searchInSKOSLabel, boolean searchInSKOSXLLabel, boolean searchInOntolex) The standard search in all resources.searchStringList
(String searchString, String[] rolesArray, boolean useLocalName, SearchMode searchMode, List<org.eclipse.rdf4j.model.IRI> schemes, String schemeFilter, List<String> langs, org.eclipse.rdf4j.model.IRI cls, boolean includeLocales) Searches the Resource (and returns their labels), according to the input parameters, and return their IRIs (as String)searchURIList
(String searchString, String[] rolesArray, SearchMode searchMode, List<org.eclipse.rdf4j.model.IRI> schemes, String schemeFilter, org.eclipse.rdf4j.model.IRI cls, @jakarta.validation.constraints.Min(0L) int maxNumResults) Search the resources, according to the specified input parameters If searchMode is startsWith, prefixes in qname (in the searchString) are expandedvoid
storeCustomSearchSettings
(Scope scope, com.fasterxml.jackson.databind.node.ObjectNode settings) void
Updates the indexes.Methods inherited from class it.uniroma2.art.semanticturkey.services.STServiceAdapter
addValue, checkNotLocallyDefined, createQueryBuilder, generateIRI, generateNatureSPARQLSelectPart, generateNatureSPARQLWherePart, generateResourceWithCustomConstructor, getCodaLexModeForSearchFromLexicalizationModel, getDeleteGraph, getGraphFromNature, getInitializedCodaCore, getManagedConnection, getMetadataGraph, getOptionalProject, getPlatformTransactionManager, getProject, getRepository, getRoleFromNature, getUserNamedGraphs, getWorkingGraph, instantiateSearchStrategy, instantiateSearchStrategy, parseReference, publishResourceDeleted, publishResourceDeleted, removeReifiedValue, retrieveResources, shutDownCodaCore, updateTriplePredicate
-
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 ExceptionCreates the Indexes. Only useful in GraphDB repositories- Throws:
Exception
-
updateIndexes
@STServiceOperation @Write @PreAuthorize("@auth.isAdmin()") public void updateIndexes() throws ExceptionUpdates 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, STPropertyAccessExceptionPerform 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 executeboundValues
- 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, throws IllegalStateException, STPropertyAccessException, SearchStatusExceptionString, 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) 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 searchuseLexicalizations
- true to search in the lexicalizations, false otherwise. Optional and default value is trueuseLocalName
- true to search in the localName of the resources, false otherwiseuseURI
- true to search in the URI of the resources, false otherwisesearchMode
- the searchMode to use during the search. CheckSearchMode
to get the * possible SerchModeuseNotes
- 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 falselangs
- the languages of the Literals in which to search the input text. OptionalincludeLocales
- true to includes locales in the searchstatusFilter
- the status of the desired resources. CheckSearchStrategy.StatusFilter
to get the possible Statusestypes
- the list ofschemes
- 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) OptionaloutgoingLinks
- a list of outgoing predicate and List of Values for the desired resourcesoutgoingSearch
- a list of outgoing predicate and a search function (stringSearch and SearchMode) for the object of such predicate for the desired resourcesingoingLinks
- a list of incoming predicate and List of Values for the desired resourcessearchInRDFSLabel
- true to search in rdfs:label, false otherwise. Optional and default value is falsesearchInSKOSLabel
- true to search in SKOS lexicalizations, false otherwise. Optional and default value is falsesearchInSKOSXLLabel
- true to search in SKOSXL Lericalizations, false otherwise. Optional and default value is falsesearchInOntolex
- 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 -
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 searchrolesArray
- the role(s) the returned resources should belong touseLexicalizations
- true to search in the lexicalizations, false otherwise. Optional and default value is trueuseLocalName
- true to search in the localName of the resources, false otherwiseuseURI
- true to search in the URI of the resources, false otherwisesearchMode
- the searchMode to use during the search. CheckSearchMode
to get the possible SerchModeuseNotes
- 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 falseschemes
- the list of schemes in which the skos:Concept will be searched. Useful only in SKOS/SKOSXL. OptionalschemeFilter
- 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 orlangs
- the languages of the Literals in which to search the input text. OptionalincludeLocales
- 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 falsesearchInRDFSLabel
- true to search in rdfs:label, false otherwise. Optional and default value is falsesearchInSKOSLabel
- true to search in SKOS lexicalizations, false otherwise. Optional and default value is falsesearchInSKOSXLLabel
- true to search in SKOSXL Lericalizations, false otherwise. Optional and default value is falsesearchInOntolex
- 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 searchrolesArray
- the role(s) the returned resources should belong to. OptionaluseLocalName
- true to search in the localName of the resources, false otherwisesearchMode
- the searchMode to use during the search. CheckSearchMode
to get the * possible SerchModeschemes
- the list of schemes in which the skos:Concept will be searched. Useful only in SKOS/SKOSXL. OptionalschemeFilter
- 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 orlangs
- the languages of the Literals in which to search the input text. Optionalcls
- the iri of the class in which to search Instances matching the input text. OptionalincludeLocales
- 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 searchrolesArray
- the role(s) the returned resources should belong to. OptionalsearchMode
- the searchMode to use during the search. CheckSearchMode
to get the * possible SerchModeschemes
- the list of schemes in which the skos:Concept will be searched. Useful only in SKOS/SKOSXL. OptionalschemeFilter
- 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 orcls
- the iri of the classes in which to search Instances matching the input text. OptionalmaxNumResults
- 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 textsearchString
- the text to searchuseLexicalizations
- true to search in the lexicalizations, false otherwise. Optional and default value is trueuseLocalName
- true to search in the localName of the resources, false otherwiseuseURI
- true to search in the URI of the resources, false otherwisesearchMode
- the searchMode to use during the search. CheckSearchMode
to get the * possible SerchModeuseNotes
- 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 falselangs
- the languages of the Literals in which to search the input text. OptionalincludeLocales
- 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 searchuseLexicalizations
- true to search in the lexicalizations, false otherwise. Optional and default value is trueuseLocalName
- true to search in the localName of the resources, false otherwiseuseURI
- true to search in the URI of the resources, false otherwisesearchMode
- the searchMode to use during the search. CheckSearchMode
to get the * possible SerchModeuseNotes
- 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 falselexicons
- the Lexicons the Lexical Entries should belong to (in OR)langs
- the languages of the Literals in which to search the input text. OptionalincludeLocales
- 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 falsesearchInRDFSLabel
- true to search in rdfs:label, false otherwise. Optional and default value is falsesearchInSKOSLabel
- true to search in SKOS lexicalizations, false otherwise. Optional and default value is falsesearchInSKOSXLLabel
- true to search in SKOSXL Lericalizations, false otherwise. Optional and default value is falsesearchInOntolex
- true to search in ONTOLEX lexicalizations, false otherwise. Optional and default value is false * @return The list of AnnotatedValuewith 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 resourceresourceURI
- the input resource to which the path is searchedschemesIRI
- the list of schemes in which the skos:Concept will be searched. Useful only in SKOS/SKOSXL. OptionalschemeFilter
- 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 orroot
- the Root element (if a single root is present). OptionalbroaderProps
- 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 -
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
-