Class XTDBQuery
java.lang.Object
org.odpi.openmetadata.adapters.repositoryservices.xtdb.repositoryconnector.model.search.XTDBQuery
- Direct Known Subclasses:
XTDBGraphQuery
Captures the structure of a query against XTDB.
-
Field Summary
Modifier and TypeFieldDescriptionprotected final List<clojure.lang.IPersistentCollection>
static final clojure.lang.Symbol
static final clojure.lang.Symbol
protected final List<clojure.lang.IPersistentCollection>
static final clojure.lang.Keyword
static final clojure.lang.Keyword
static final clojure.lang.Symbol
static final clojure.lang.Symbol
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addClassificationConditions
(SearchClassifications searchClassifications, Set<String> typeNames, XTDBOMRSRepositoryConnector xtdbConnector, boolean luceneEnabled, boolean luceneRegexes) Retrieve the set of conditions appropriate to XTDB for the provided Egeria conditions.void
addConditions
(List<clojure.lang.IPersistentCollection> xtdbConditions) Add the provided list of conditions to those to be included in the query.protected void
addFindElement
(clojure.lang.Symbol element) Add the specified symbol to the list of those that are discovered by the search conditions (if not already in the list)protected void
addPropertyBasedSorting
(Set<clojure.lang.Keyword> qualifiedSortProperties, clojure.lang.Keyword order) Add the necessary conditions for sorting based on a property: somewhat complex as we need to ensure that the property being used in the sort is included in the search results themselves, and given the qualification of property names this could mean several different properties we ultimately need to attempt to sort by, and hence this separate method.void
addPropertyConditions
(SearchProperties searchProperties, String namespace, Set<String> typeNames, XTDBOMRSRepositoryConnector xtdbConnector, boolean luceneEnabled, boolean luceneRegexes) Retrieve the set of conditions appropriate to XTDB for the provided Egeria conditions.void
addRelationshipEndpointConditions
(String reference) Add a condition to match either endpoint of a relationship to the provided reference (primary key).void
addSequencing
(SequencingOrder sequencingOrder, String sequencingProperty, String namespace, Set<String> typeNames, XTDBOMRSRepositoryConnector xtdbConnector) Add the sequencing information onto the query.void
addStatusLimiters
(List<InstanceStatus> limitResultsByStatus, clojure.lang.Symbol toLimit) Add the provided statuses as limiters on which results should be retrieved from the query.void
addTypeCondition
(TypeDefCategory category, String typeGuid, List<String> subtypeLimits) Add a condition to limit the type of the results by their TypeDef GUID.protected List<clojure.lang.IPersistentCollection>
getClassificationConditions
(SearchClassifications searchClassifications, Set<String> typeNames, XTDBOMRSRepositoryConnector xtdbConnector, boolean luceneEnabled, boolean luceneRegexes) Retrieve a set of translated XTDB conditions appropriate to the provided Egeria conditions.clojure.lang.IPersistentMap
getQuery()
Retrieve the query object, as ready-to-be-submitted to XTDB API's query method.protected clojure.lang.PersistentVector
getReferenceCondition
(clojure.lang.Keyword property, String reference) Add a condition to match the value of a property to a reference (primary key).protected List<clojure.lang.IPersistentCollection>
getStatusLimiters
(clojure.lang.Symbol variable, List<InstanceStatus> limitResultsByStatus) Retrieve the status condition(s) for the provided status limiters.protected List<clojure.lang.IPersistentCollection>
getTypeCondition
(clojure.lang.Symbol variable, TypeDefCategory category, String typeGuid, List<String> subtypeLimits) Add a condition to limit the type of the results by their TypeDef GUID.
-
Field Details
-
DOC_ID
public static final clojure.lang.Symbol DOC_ID -
CREATE_TIME
public static final clojure.lang.Symbol CREATE_TIME -
UPDATE_TIME
public static final clojure.lang.Symbol UPDATE_TIME -
SORT_PROPERTY
public static final clojure.lang.Symbol SORT_PROPERTY -
SORT_ASCENDING
public static final clojure.lang.Keyword SORT_ASCENDING -
SORT_DESCENDING
public static final clojure.lang.Keyword SORT_DESCENDING -
conditions
-
rules
-
-
Constructor Details
-
XTDBQuery
public XTDBQuery()Default constructor for a new query.
-
-
Method Details
-
addRelationshipEndpointConditions
Add a condition to match either endpoint of a relationship to the provided reference (primary key).- Parameters:
reference
- the primary key value of an entity, used to match either end of a relationship
-
getReferenceCondition
protected clojure.lang.PersistentVector getReferenceCondition(clojure.lang.Keyword property, String reference) Add a condition to match the value of a property to a reference (primary key).- Parameters:
property
- to matchreference
- the primary key value to which the property should refer- Returns:
- PersistentVector for the condition
-
addTypeCondition
Add a condition to limit the type of the results by their TypeDef GUID.- Parameters:
category
- by which to limit resultstypeGuid
- by which to limit the results (if null, will be ignored)subtypeLimits
- limit the results to only these subtypes (if provided: ignored if typeGuid is null)
-
getTypeCondition
protected List<clojure.lang.IPersistentCollection> getTypeCondition(clojure.lang.Symbol variable, TypeDefCategory category, String typeGuid, List<String> subtypeLimits) Add a condition to limit the type of the results by their TypeDef GUID.- Parameters:
variable
- to resolve against the typecategory
- by which to limit resultstypeGuid
- by which to limit the resultssubtypeLimits
- limit the results to only these subtypes (if provided)- Returns:
List<IPersistentCollection>
of the conditions
-
addConditions
Add the provided list of conditions to those to be included in the query.- Parameters:
xtdbConditions
- list of conditions to add
-
addPropertyConditions
public void addPropertyConditions(SearchProperties searchProperties, String namespace, Set<String> typeNames, XTDBOMRSRepositoryConnector xtdbConnector, boolean luceneEnabled, boolean luceneRegexes) Retrieve the set of conditions appropriate to XTDB for the provided Egeria conditions.- Parameters:
searchProperties
- to translatenamespace
- by which to qualify propertiestypeNames
- of all of the types we are including in the searchxtdbConnector
- connectivity to the repositoryluceneEnabled
- indicates whether Lucene search index is configured (true) or not (false)luceneRegexes
- indicates whether unquoted regexes should be treated as Lucene compatible (true) or not (false)
-
addClassificationConditions
public void addClassificationConditions(SearchClassifications searchClassifications, Set<String> typeNames, XTDBOMRSRepositoryConnector xtdbConnector, boolean luceneEnabled, boolean luceneRegexes) Retrieve the set of conditions appropriate to XTDB for the provided Egeria conditions.- Parameters:
searchClassifications
- to translatetypeNames
- of all of the types we are including in the searchxtdbConnector
- connectivity to the repositoryluceneEnabled
- indicates whether Lucene search index is configured (true) or not (false)luceneRegexes
- indicates whether unquoted regexes should be treated as Lucene compatible (true) or not (false)
-
getClassificationConditions
protected List<clojure.lang.IPersistentCollection> getClassificationConditions(SearchClassifications searchClassifications, Set<String> typeNames, XTDBOMRSRepositoryConnector xtdbConnector, boolean luceneEnabled, boolean luceneRegexes) Retrieve a set of translated XTDB conditions appropriate to the provided Egeria conditions.- Parameters:
searchClassifications
- to translatetypeNames
- of all of the types we are including in the searchxtdbConnector
- connectivity to the repositoryluceneEnabled
- indicates whether Lucene search index is configured (true) or not (false)luceneRegexes
- indicates whether unquoted regexes should be treated as Lucene compatible (true) or not (false)- Returns:
List<IPersistentCollection>
-
addStatusLimiters
public void addStatusLimiters(List<InstanceStatus> limitResultsByStatus, clojure.lang.Symbol toLimit) Add the provided statuses as limiters on which results should be retrieved from the query.- Parameters:
limitResultsByStatus
- list of statuses by which to limit resultstoLimit
- variable by which to limit by status (e.g. entity or relationship)
-
getStatusLimiters
protected List<clojure.lang.IPersistentCollection> getStatusLimiters(clojure.lang.Symbol variable, List<InstanceStatus> limitResultsByStatus) Retrieve the status condition(s) for the provided status limiters.- Parameters:
variable
- that should be limitedlimitResultsByStatus
- list of statuses by which to limit results- Returns:
List<IPersistentCollection>
of the condition(s)
-
addSequencing
public void addSequencing(SequencingOrder sequencingOrder, String sequencingProperty, String namespace, Set<String> typeNames, XTDBOMRSRepositoryConnector xtdbConnector) Add the sequencing information onto the query.- Parameters:
sequencingOrder
- by which to sequence the resultssequencingProperty
- by which to sequence the results (required if sorting by property, otherwise ignored)namespace
- by which to qualify the sorting property (required if sorting by property, otherwise ignored)typeNames
- of all of the types we are including in the search (required if sorting by property, otherwise ignored)xtdbConnector
- connectivity to the repository
-
addPropertyBasedSorting
protected void addPropertyBasedSorting(Set<clojure.lang.Keyword> qualifiedSortProperties, clojure.lang.Keyword order) Add the necessary conditions for sorting based on a property: somewhat complex as we need to ensure that the property being used in the sort is included in the search results themselves, and given the qualification of property names this could mean several different properties we ultimately need to attempt to sort by, and hence this separate method.- Parameters:
qualifiedSortProperties
- the set of properties by which we will sortorder
- indicating ascending or descending
-
getQuery
public clojure.lang.IPersistentMap getQuery()Retrieve the query object, as ready-to-be-submitted to XTDB API's query method.- Returns:
- IPersistentMap containing the query
-
addFindElement
protected void addFindElement(clojure.lang.Symbol element) Add the specified symbol to the list of those that are discovered by the search conditions (if not already in the list)- Parameters:
element
- to add (if not already in the list)
-