Skip to content

Add customizable AST-based search patterns to DataProvider and entity search components - #176

Merged
AlexeyMz merged 2 commits into
masterfrom
lookup-patterns
Nov 22, 2026
Merged

AlexeyMz merged 2 commits into
masterfrom
lookup-patterns

Conversation

@AlexeyMz

@AlexeyMz AlexeyMz commented Nov 9, 2026 •

Copy link
Copy Markdown
Member
  • Add AST-based lookup patterns to DataProvider:
    • Support entity search with composable LookupPattern in DataProvider.lookup();
    • [💥Breaking] Only provide inLinks and outLinks for result items from DataProvider.lookup() when withLinks: true is specified and there is a top-level connectedTo-pattern with constant fromValues sub-pattern (i.e. including just passing refElementId);
  • Add extendable search UI to InstancesSearch and SearchSectionEntities based on lookup patterns:
    • Add SearchPattern-derived types (separate from LookupPattern) to allow customizable search pattern display and editors;
    • Add built-in search criteria options: SearchCriterionAnd, SearchCriterionOr, SearchCriterionHasType
      SearchCriterionConnectedTo, SearchCriterionFromValues, SearchCriterionHasProperty;
    • Add utility "building blocks" for custom search criteria: SearchCriterionBlock,
      SearchCriterionWhereGroup, SearchCriterionWhere.
  • Fix incorrect limit support in SparqlDataProvider.lookup() query if a connected element has more than one type (including transitive super-types) or it is connected by more than one link or direction:
    • Projection variables ?link and ?direction are removed from SparqlDataProviderSettings.lookupQuery;
    • Separate links query is issued instead of a complex single query to compute inLinks and outLinks for DataProviderLookupItem.
  • Depend on @floating-ui/react-dom for better placed dropdown floating panels.
  • Improve element/link/property types processing in data providers:
    • Add lookupElementTypes(), lookupPropertyTypes() and lookupLinkTypes() methods to DataProvider to allow to search for the corresponding types;
    • Add RdfDataProvider options propertyOrLinkBaseTypes and propertyTypeBaseTypes (in addition to existing linkTypeBaseTypes) to distinguish between link and property types;
    • Always compute counts for implicit element/link/property types in RdfDataProvider;
    • Update IndexedDbCachedProvider.DB_VERSION to 5.
  • Remove no entity type fallback to owl:Thing in filterElementInfoPattern for OwlRdfsSettings and WikidataSettings.
  • Clarify useAsync() behavior on undefined return value from load callback to keep the previous result.
  • Add internal utility components:
    • Add ErrorMessage component to display a formatted error message from an exception when possible;
    • Add base Autocomplete component based on Dropdown and SearchInput;
    • Add EntitySelect component based on Autocomplete to lookup one or multiple entities by label;
    • Add SchemaTypeSelect component with default suggestions for select element/property/link types;
    • Extract SchemaTypeView from class tree to display an element/property/link type;
  • Improve code structure and unit tests:
    • Refactor SparqlDataProvider query generation into separate module SparqlGenerator;
    • Add thorough unit tests for lookup() in SparqlDataProvider and RdfDataProvider;
    • Refactor SearchInput and its usages to have proper slots to display additional components inside;
    • Add block display mode to InlineEntity;
    • Add useCombinedRef(), extract useFetchStatus() hook;
  • Add storybook-like components example page as an interactive playground for exported and internal components;

TODO:

  • Change link direction selector to a button group
  • Add JSDoc to newly exported types, components and functions
  • Add tests for SparqlDataProvider.lookup() and RdfDataProvider.lookup()
  • Add tests for SearchPattern lookup pattern generation and serialization;
  • Investigate and fix "connected by inLinks/outLinks" expected behavior for SparqlDataProvider
  • Add CHANGELOG description
  • Add custom search criteria (entities from SPARQL query) example (in the follow-up)

@AlexeyMz
AlexeyMz force-pushed the lookup-patterns branch 6 times, most recently from db095e1 to 3758e6c Compare November 14, 2026 23:10
@AlexeyMz
AlexeyMz force-pushed the lookup-patterns branch 6 times, most recently from 2875d4a to af9881e Compare November 22, 2026 12:55
@AlexeyMz
AlexeyMz marked this pull request as ready for review November 22, 2026 12:56
…ty search components:

- Add AST-based lookup patterns to `DataProvider`:
  * Support entity search with composable `LookupPattern` in `DataProvider.lookup()`;
  * **[💥Breaking]** Only provide `inLinks` and `outLinks` for result items from `DataProvider.lookup()` when `withLinks: true` is specified and there is a top-level `connectedTo`-pattern with constant `fromValues` sub-pattern (i.e. including just passing `refElementId`);
- Add extendable search UI to `InstancesSearch` and `SearchSectionEntities` based on lookup patterns:
  * Add `SearchPattern`-derived types (separate from `LookupPattern`) to allow customizable search pattern display and editors;
  * Add built-in search criteria options: `SearchCriterionAnd`, `SearchCriterionOr`, `SearchCriterionHasType`
  `SearchCriterionConnectedTo`, `SearchCriterionFromValues`, `SearchCriterionHasProperty`;
  * Add utility "building blocks" for custom search criteria: `SearchCriterionBlock`,
  `SearchCriterionWhereGroup`, `SearchCriterionWhere`.
- Fix incorrect `limit` support in `SparqlDataProvider.lookup()` query if a connected element has more than one type (including transitive super-types) or it is connected by more than one link or direction:
  * Projection variables `?link` and `?direction` are removed from `SparqlDataProviderSettings.lookupQuery`;
  * Separate links query is issued instead of a complex single query to compute `inLinks` and `outLinks` for `DataProviderLookupItem`.
- Depend on `@floating-ui/react-dom` for better placed dropdown floating panels.
- Improve element/link/property types processing in data providers:
  * Add `lookupElementTypes()`, `lookupPropertyTypes()` and `lookupLinkTypes()` methods to `DataProvider` to allow to search for the corresponding types;
  * Add `RdfDataProvider` options `propertyOrLinkBaseTypes` and `propertyTypeBaseTypes` (in addition to existing `linkTypeBaseTypes`) to distinguish between link and property types;
  * Always compute counts for implicit element/link/property types in `RdfDataProvider`;
  * Update `IndexedDbCachedProvider.DB_VERSION` to `5`.
- Remove no entity type fallback to `owl:Thing` in `filterElementInfoPattern` for `OwlRdfsSettings` and `WikidataSettings`.
- Clarify `useAsync()` behavior on `undefined` return value from `load` callback to keep the previous result.
- Add internal utility components:
  * Add `ErrorMessage` component to display a formatted error message from an exception when possible;
  * Add base `Autocomplete` component based on `Dropdown` and `SearchInput`;
  * Add `EntitySelect` component based on `Autocomplete` to lookup one or multiple entities by label;
  * Add `SchemaTypeSelect` component with default suggestions for select element/property/link types;
  * Extract `SchemaTypeView` from class tree to display an element/property/link type;
- Improve code structure and unit tests:
  * Refactor `SparqlDataProvider` query generation into separate module `SparqlGenerator`;
  * Add thorough unit tests for `lookup()` in `SparqlDataProvider` and `RdfDataProvider`;
  * Refactor `SearchInput` and its usages to have proper slots to display additional components inside;
  * Add block display mode to `InlineEntity`;
  * Add `useCombinedRef()`, extract `useFetchStatus()` hook;
- Add storybook-like `components` example page as an interactive playground for exported and internal components;
@AlexeyMz
AlexeyMz merged commit b86dfc9 into master Nov 22, 2026
4 checks passed
@AlexeyMz
AlexeyMz deleted the lookup-patterns branch November 22, 2026 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant