@manta-eu/react 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +100 -37
- package/dist/components/breadcrumbs/index.d.ts +26 -0
- package/dist/components/breadcrumbs/index.d.ts.map +1 -0
- package/dist/components/breadcrumbs/index.js +36 -0
- package/dist/components/channel-icon/index.d.ts +1 -2
- package/dist/components/channel-icon/index.d.ts.map +1 -1
- package/dist/components/channel-icon/index.js +0 -4
- package/dist/components/chip/index.d.ts +14 -0
- package/dist/components/chip/index.d.ts.map +1 -0
- package/dist/components/chip/index.js +8 -0
- package/dist/components/editable-text/index.d.ts +13 -0
- package/dist/components/editable-text/index.d.ts.map +1 -0
- package/dist/components/editable-text/index.js +61 -0
- package/dist/components/explain-fact/ExplainFact.d.ts +16 -0
- package/dist/components/explain-fact/ExplainFact.d.ts.map +1 -0
- package/dist/components/{rdfox-explain/RDFoxExplain.js → explain-fact/ExplainFact.js} +12 -12
- package/dist/components/explain-fact/OutdatedFactNotice.d.ts.map +1 -0
- package/dist/components/input/index.d.ts +2 -0
- package/dist/components/input/index.d.ts.map +1 -1
- package/dist/components/input/index.js +2 -0
- package/dist/components/input/input-numeric.d.ts +19 -0
- package/dist/components/input/input-numeric.d.ts.map +1 -0
- package/dist/components/input/input-numeric.js +85 -0
- package/dist/components/input/input-tags.d.ts +17 -0
- package/dist/components/input/input-tags.d.ts.map +1 -0
- package/dist/components/input/input-tags.js +46 -0
- package/dist/components/multi-select/index.d.ts +32 -0
- package/dist/components/multi-select/index.d.ts.map +1 -0
- package/dist/components/multi-select/index.js +33 -0
- package/dist/components/multi-select/toggle-value.d.ts +2 -0
- package/dist/components/multi-select/toggle-value.d.ts.map +1 -0
- package/dist/components/multi-select/toggle-value.js +3 -0
- package/dist/components/plan-row/index.d.ts +2 -1
- package/dist/components/plan-row/index.d.ts.map +1 -1
- package/dist/components/plan-row/index.js +2 -14
- package/dist/components/sidebar/index.d.ts +4 -1
- package/dist/components/sidebar/index.d.ts.map +1 -1
- package/dist/components/sidebar/index.js +2 -2
- package/dist/components/skeleton/index.js +1 -1
- package/dist/components/tool-invocation-card/ExplainFactResultDisplay.d.ts +9 -0
- package/dist/components/tool-invocation-card/ExplainFactResultDisplay.d.ts.map +1 -0
- package/dist/components/tool-invocation-card/{ExplainRDFoxResultDisplay.js → ExplainFactResultDisplay.js} +3 -3
- package/dist/components/tool-invocation-card/ToolOutputRenderer.js +2 -2
- package/dist/components/tool-invocation-card/types.d.ts +4 -4
- package/dist/components/tool-invocation-card/types.d.ts.map +1 -1
- package/dist/components/tool-invocation-card/types.js +2 -2
- package/dist/components/tree-multi-select/index.d.ts +1 -1
- package/dist/components/tree-multi-select/index.d.ts.map +1 -1
- package/dist/components/tree-multi-select/index.js +1 -1
- package/dist/components/tree-multi-select/tree-multi-select-rows.d.ts +2 -1
- package/dist/components/tree-multi-select/tree-multi-select-rows.d.ts.map +1 -1
- package/dist/components/tree-multi-select/tree-multi-select-rows.js +21 -31
- package/dist/components/tree-multi-select/tree-multi-select.d.ts +2 -0
- package/dist/components/tree-multi-select/tree-multi-select.d.ts.map +1 -1
- package/dist/components/tree-multi-select/tree-multi-select.js +21 -8
- package/dist/explain-fact/DatalogCode.d.ts.map +1 -0
- package/dist/explain-fact/EntityChip.d.ts.map +1 -0
- package/dist/explain-fact/EntityChip.js +17 -0
- package/dist/explain-fact/ExplainCompactView.d.ts.map +1 -0
- package/dist/explain-fact/ExplainFactState.d.ts +7 -0
- package/dist/explain-fact/ExplainFactState.d.ts.map +1 -0
- package/dist/{rdfox-explain/RDFoxExplainState.js → explain-fact/ExplainFactState.js} +1 -1
- package/dist/explain-fact/ExplainFullView.d.ts.map +1 -0
- package/dist/explain-fact/ExplainStates.d.ts.map +1 -0
- package/dist/explain-fact/ExplainTag.d.ts.map +1 -0
- package/dist/explain-fact/FactNotice.d.ts +7 -0
- package/dist/explain-fact/FactNotice.d.ts.map +1 -0
- package/dist/explain-fact/FactNotice.js +25 -0
- package/dist/explain-fact/FactValue.d.ts.map +1 -0
- package/dist/explain-fact/NumDot.d.ts.map +1 -0
- package/dist/explain-fact/PanelLabel.d.ts.map +1 -0
- package/dist/explain-fact/ProofSubjectHeader.d.ts.map +1 -0
- package/dist/explain-fact/ProvenanceBadge.d.ts.map +1 -0
- package/dist/{rdfox-explain → explain-fact}/ProvenanceBadge.js +2 -1
- package/dist/explain-fact/RuleVariableTypes.d.ts.map +1 -0
- package/dist/explain-fact/SubstitutedFactNotice.d.ts.map +1 -0
- package/dist/explain-fact/ValuePill.d.ts.map +1 -0
- package/dist/explain-fact/conclusion/ConclusionCard.d.ts.map +1 -0
- package/dist/explain-fact/conclusion/ConclusionSubtitle.d.ts.map +1 -0
- package/dist/{rdfox-explain → explain-fact}/conclusion/ConclusionSubtitle.js +3 -1
- package/dist/explain-fact/conclusion/index.d.ts.map +1 -0
- package/dist/explain-fact/explain-styles.d.ts.map +1 -0
- package/dist/explain-fact/fact-token.d.ts.map +1 -0
- package/dist/explain-fact/formula-hues.d.ts.map +1 -0
- package/dist/{rdfox-explain → explain-fact}/index.d.ts +2 -3
- package/dist/explain-fact/index.d.ts.map +1 -0
- package/dist/{rdfox-explain → explain-fact}/index.js +2 -3
- package/dist/explain-fact/inspector/ExplainInspector.d.ts.map +1 -0
- package/dist/explain-fact/inspector/ExplainInspector.js +20 -0
- package/dist/explain-fact/inspector/InspectorBindings.d.ts.map +1 -0
- package/dist/explain-fact/inspector/InspectorFact.d.ts.map +1 -0
- package/dist/explain-fact/inspector/InspectorHeader.d.ts.map +1 -0
- package/dist/{rdfox-explain → explain-fact}/inspector/InspectorRule.d.ts +3 -0
- package/dist/explain-fact/inspector/InspectorRule.d.ts.map +1 -0
- package/dist/{rdfox-explain → explain-fact}/inspector/InspectorRule.js +4 -5
- package/dist/explain-fact/inspector/SupportsSection.d.ts.map +1 -0
- package/dist/{rdfox-explain → explain-fact}/inspector/SupportsSection.js +2 -1
- package/dist/explain-fact/inspector/index.d.ts.map +1 -0
- package/dist/explain-fact/proof-tree/ProofFactLabel.d.ts.map +1 -0
- package/dist/explain-fact/proof-tree/ProofRowBadge.d.ts.map +1 -0
- package/dist/explain-fact/proof-tree/ProofRowContent.d.ts.map +1 -0
- package/dist/explain-fact/proof-tree/ProofRowValue.d.ts.map +1 -0
- package/dist/explain-fact/proof-tree/ProofTree.d.ts.map +1 -0
- package/dist/{rdfox-explain → explain-fact}/proof-tree/ProofTree.js +1 -1
- package/dist/explain-fact/proof-tree/ProofTreeFormulaFooter.d.ts.map +1 -0
- package/dist/explain-fact/proof-tree/ProofTreeNode.d.ts.map +1 -0
- package/dist/explain-fact/proof-tree/SupportsTag.d.ts.map +1 -0
- package/dist/explain-fact/proof-tree/SupportsTag.js +6 -0
- package/dist/explain-fact/proof-tree/index.d.ts.map +1 -0
- package/dist/explain-fact/proof-tree/proof-tree-navigation.d.ts.map +1 -0
- package/dist/explain-fact/proof-tree/proof-tree-root-view.d.ts.map +1 -0
- package/dist/explain-fact/proof-tree/visible-premises.d.ts.map +1 -0
- package/dist/explain-fact/rule-presentation.d.ts.map +1 -0
- package/dist/{rdfox-explain → explain-fact}/tree-model.d.ts +18 -9
- package/dist/explain-fact/tree-model.d.ts.map +1 -0
- package/dist/{rdfox-explain → explain-fact}/tree-model.js +19 -10
- package/dist/explain-fact/use-fact-measure.d.ts.map +1 -0
- package/dist/globals.css +383 -108
- package/dist/graph/nodes/AdMockupCard.js +1 -1
- package/dist/graph/nodes/CreativeMediaCard.js +1 -1
- package/dist/graph/nodes/EntityCardShell.js +1 -1
- package/dist/hooks/use-conversation-starters.d.ts +1 -1
- package/dist/hooks/useValidateActionPlan.d.ts.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/ldo-ui.d.ts +1 -1
- package/dist/ldo-ui.d.ts.map +1 -1
- package/dist/ldo-ui.js +1 -1
- package/dist/lib/datastore-route-paths.d.ts +2 -2
- package/dist/lib/datastore-route-paths.d.ts.map +1 -1
- package/dist/lib/datastore-route-paths.js +2 -2
- package/dist/lib/datastore-route-table.d.ts +36 -0
- package/dist/lib/datastore-route-table.d.ts.map +1 -0
- package/dist/lib/datastore-route-table.js +43 -0
- package/dist/lib/datastore-routes.d.ts +1 -1
- package/dist/lib/datastore-routes.d.ts.map +1 -1
- package/dist/lib/datastore-routes.js +1 -1
- package/dist/lib/spa-routes.d.ts +3 -0
- package/dist/lib/spa-routes.d.ts.map +1 -0
- package/dist/lib/spa-routes.js +5 -0
- package/dist/routes/data-explorer/components/Breadcrumbs.d.ts.map +1 -1
- package/dist/routes/data-explorer/components/Breadcrumbs.js +5 -5
- package/dist/routes/datastores/components/DatastoreFormDialog.d.ts +18 -0
- package/dist/routes/datastores/components/DatastoreFormDialog.d.ts.map +1 -0
- package/dist/routes/datastores/components/DatastoreFormDialog.js +27 -0
- package/dist/routes/datastores/components/DatastoreTableSkeleton.d.ts +2 -0
- package/dist/routes/datastores/components/DatastoreTableSkeleton.d.ts.map +1 -0
- package/dist/routes/datastores/components/DatastoreTableSkeleton.js +7 -0
- package/dist/routes/datastores/components/DatastoresToolbar.d.ts +18 -0
- package/dist/routes/datastores/components/DatastoresToolbar.d.ts.map +1 -0
- package/dist/routes/datastores/components/DatastoresToolbar.js +29 -0
- package/dist/routes/datastores/components/LinkUnlinkedDatastoreDialog.d.ts +14 -0
- package/dist/routes/datastores/components/LinkUnlinkedDatastoreDialog.d.ts.map +1 -0
- package/dist/routes/datastores/components/LinkUnlinkedDatastoreDialog.js +83 -0
- package/dist/routes/datastores/components/RenameDatastoreGroupDialog.d.ts +9 -0
- package/dist/routes/datastores/components/RenameDatastoreGroupDialog.d.ts.map +1 -0
- package/dist/routes/datastores/components/RenameDatastoreGroupDialog.js +21 -0
- package/dist/routes/datastores/components/StatusBadge.d.ts +21 -0
- package/dist/routes/datastores/components/StatusBadge.d.ts.map +1 -0
- package/dist/routes/datastores/components/StatusBadge.js +49 -0
- package/dist/routes/datastores/components/UnlinkedDatastoresPanel.d.ts +20 -0
- package/dist/routes/datastores/components/UnlinkedDatastoresPanel.d.ts.map +1 -0
- package/dist/routes/datastores/components/UnlinkedDatastoresPanel.js +13 -0
- package/dist/routes/datastores/flatten.d.ts +33 -0
- package/dist/routes/datastores/flatten.d.ts.map +1 -0
- package/dist/routes/datastores/flatten.js +86 -0
- package/dist/routes/datastores/hooks/useDatastoreColumns.d.ts +47 -0
- package/dist/routes/datastores/hooks/useDatastoreColumns.d.ts.map +1 -0
- package/dist/routes/datastores/hooks/useDatastoreColumns.js +165 -0
- package/dist/routes/datastores/hooks/useDatastoreTable.d.ts +14 -0
- package/dist/routes/datastores/hooks/useDatastoreTable.d.ts.map +1 -0
- package/dist/routes/datastores/hooks/useDatastoreTable.js +45 -0
- package/dist/routes/datastores/index.d.ts +2 -0
- package/dist/routes/datastores/index.d.ts.map +1 -0
- package/dist/routes/datastores/index.js +467 -0
- package/dist/routes/explain/ExplainEmpty.d.ts +2 -0
- package/dist/routes/explain/ExplainEmpty.d.ts.map +1 -0
- package/dist/routes/explain/ExplainEmpty.js +8 -0
- package/dist/routes/explain/index.d.ts +2 -0
- package/dist/routes/explain/index.d.ts.map +1 -0
- package/dist/routes/explain/index.js +16 -0
- package/dist/routes/explain/url-params.d.ts +9 -0
- package/dist/routes/explain/url-params.d.ts.map +1 -0
- package/dist/routes/explain/url-params.js +21 -0
- package/dist/routes/integrations/components/ConnectionRow.d.ts.map +1 -1
- package/dist/routes/integrations/components/ConnectionRow.js +1 -1
- package/dist/routes/integrations/connection-view.d.ts.map +1 -1
- package/dist/routes/integrations/connection-view.js +17 -1
- package/dist/routes/integrations/types.d.ts +2 -1
- package/dist/routes/integrations/types.d.ts.map +1 -1
- package/dist/routes/memories/components/ChangeScopeDialog.d.ts +12 -0
- package/dist/routes/memories/components/ChangeScopeDialog.d.ts.map +1 -0
- package/dist/routes/memories/components/ChangeScopeDialog.js +89 -0
- package/dist/routes/memories/components/ConflictMemoryCard.d.ts +13 -0
- package/dist/routes/memories/components/ConflictMemoryCard.d.ts.map +1 -0
- package/dist/routes/memories/components/ConflictMemoryCard.js +43 -0
- package/dist/routes/memories/components/ConflictTimeoutFooter.d.ts +7 -0
- package/dist/routes/memories/components/ConflictTimeoutFooter.d.ts.map +1 -0
- package/dist/routes/memories/components/ConflictTimeoutFooter.js +6 -0
- package/dist/routes/memories/components/ConsolidationReviewDialog.d.ts +61 -0
- package/dist/routes/memories/components/ConsolidationReviewDialog.d.ts.map +1 -0
- package/dist/routes/memories/components/ConsolidationReviewDialog.js +121 -0
- package/dist/routes/memories/components/EmptyStates.d.ts +18 -0
- package/dist/routes/memories/components/EmptyStates.d.ts.map +1 -0
- package/dist/routes/memories/components/EmptyStates.js +22 -0
- package/dist/routes/memories/components/ImportanceSlider.d.ts +11 -0
- package/dist/routes/memories/components/ImportanceSlider.d.ts.map +1 -0
- package/dist/routes/memories/components/ImportanceSlider.js +31 -0
- package/dist/routes/memories/components/LiveContextTab.d.ts +6 -0
- package/dist/routes/memories/components/LiveContextTab.d.ts.map +1 -0
- package/dist/routes/memories/components/LiveContextTab.js +37 -0
- package/dist/routes/memories/components/LoadingSkeleton.d.ts +2 -0
- package/dist/routes/memories/components/LoadingSkeleton.d.ts.map +1 -0
- package/dist/routes/memories/components/LoadingSkeleton.js +7 -0
- package/dist/routes/memories/components/MemoriesFilters.d.ts +31 -0
- package/dist/routes/memories/components/MemoriesFilters.d.ts.map +1 -0
- package/dist/routes/memories/components/MemoriesFilters.js +88 -0
- package/dist/routes/memories/components/MemoriesPanel.d.ts +6 -0
- package/dist/routes/memories/components/MemoriesPanel.d.ts.map +1 -0
- package/dist/routes/memories/components/MemoriesPanel.js +99 -0
- package/dist/routes/memories/components/MemoriesTabPanel.d.ts +30 -0
- package/dist/routes/memories/components/MemoriesTabPanel.d.ts.map +1 -0
- package/dist/routes/memories/components/MemoriesTabPanel.js +11 -0
- package/dist/routes/memories/components/MemoryActions.d.ts +12 -0
- package/dist/routes/memories/components/MemoryActions.d.ts.map +1 -0
- package/dist/routes/memories/components/MemoryActions.js +24 -0
- package/dist/routes/memories/components/MemoryFields.d.ts +32 -0
- package/dist/routes/memories/components/MemoryFields.d.ts.map +1 -0
- package/dist/routes/memories/components/MemoryFields.js +30 -0
- package/dist/routes/memories/components/MemoryFormDialog.d.ts +15 -0
- package/dist/routes/memories/components/MemoryFormDialog.d.ts.map +1 -0
- package/dist/routes/memories/components/MemoryFormDialog.js +299 -0
- package/dist/routes/memories/components/MemoryOnboardingWizard.d.ts +9 -0
- package/dist/routes/memories/components/MemoryOnboardingWizard.d.ts.map +1 -0
- package/dist/routes/memories/components/MemoryOnboardingWizard.js +99 -0
- package/dist/routes/memories/components/RestoreBlockedDialog.d.ts +8 -0
- package/dist/routes/memories/components/RestoreBlockedDialog.d.ts.map +1 -0
- package/dist/routes/memories/components/RestoreBlockedDialog.js +7 -0
- package/dist/routes/memories/components/SchemasTab.d.ts +6 -0
- package/dist/routes/memories/components/SchemasTab.d.ts.map +1 -0
- package/dist/routes/memories/components/SchemasTab.js +35 -0
- package/dist/routes/memories/components/SupersessionConflictDialog.d.ts +18 -0
- package/dist/routes/memories/components/SupersessionConflictDialog.d.ts.map +1 -0
- package/dist/routes/memories/components/SupersessionConflictDialog.js +78 -0
- package/dist/routes/memories/components/TeamPicker.d.ts +8 -0
- package/dist/routes/memories/components/TeamPicker.d.ts.map +1 -0
- package/dist/routes/memories/components/TeamPicker.js +25 -0
- package/dist/routes/memories/components/badges.d.ts +50 -0
- package/dist/routes/memories/components/badges.d.ts.map +1 -0
- package/dist/routes/memories/components/badges.js +106 -0
- package/dist/routes/memories/expiry-utils.d.ts +23 -0
- package/dist/routes/memories/expiry-utils.d.ts.map +1 -0
- package/dist/routes/memories/expiry-utils.js +97 -0
- package/dist/routes/memories/hooks/useConflictCheck.d.ts +18 -0
- package/dist/routes/memories/hooks/useConflictCheck.d.ts.map +1 -0
- package/dist/routes/memories/hooks/useConflictCheck.js +35 -0
- package/dist/routes/memories/hooks/useDuplicateDetection.d.ts +11 -0
- package/dist/routes/memories/hooks/useDuplicateDetection.d.ts.map +1 -0
- package/dist/routes/memories/hooks/useDuplicateDetection.js +73 -0
- package/dist/routes/memories/hooks/useLiveContext.d.ts +23 -0
- package/dist/routes/memories/hooks/useLiveContext.d.ts.map +1 -0
- package/dist/routes/memories/hooks/useLiveContext.js +102 -0
- package/dist/routes/memories/hooks/useMemoryColumns.d.ts +33 -0
- package/dist/routes/memories/hooks/useMemoryColumns.d.ts.map +1 -0
- package/dist/routes/memories/hooks/useMemoryColumns.js +188 -0
- package/dist/routes/memories/hooks/useMemoryTable.d.ts +33 -0
- package/dist/routes/memories/hooks/useMemoryTable.d.ts.map +1 -0
- package/dist/routes/memories/hooks/useMemoryTable.js +121 -0
- package/dist/routes/memories/index.d.ts +11 -0
- package/dist/routes/memories/index.d.ts.map +1 -0
- package/dist/routes/memories/index.js +472 -0
- package/dist/routes/memories/memory-form-validation.d.ts +8 -0
- package/dist/routes/memories/memory-form-validation.d.ts.map +1 -0
- package/dist/routes/memories/memory-form-validation.js +33 -0
- package/dist/routes/memories/memory-mutation-input.d.ts +6 -0
- package/dist/routes/memories/memory-mutation-input.d.ts.map +1 -0
- package/dist/routes/memories/memory-mutation-input.js +41 -0
- package/dist/routes/plans/components/actionPlansTableConfig.d.ts +3 -3
- package/dist/routes/rules/components/CreateRuleChatModal.d.ts +10 -0
- package/dist/routes/rules/components/CreateRuleChatModal.d.ts.map +1 -0
- package/dist/routes/rules/components/CreateRuleChatModal.js +52 -0
- package/dist/routes/rules/components/RuleActionabilityBadge.d.ts +8 -0
- package/dist/routes/rules/components/RuleActionabilityBadge.d.ts.map +1 -0
- package/dist/routes/rules/components/RuleActionabilityBadge.js +18 -0
- package/dist/routes/rules/components/RuleAffectedActionPlansSection.d.ts +6 -0
- package/dist/routes/rules/components/RuleAffectedActionPlansSection.d.ts.map +1 -0
- package/dist/routes/rules/components/RuleAffectedActionPlansSection.js +151 -0
- package/dist/routes/rules/components/RuleAst.d.ts +6 -0
- package/dist/routes/rules/components/RuleAst.d.ts.map +1 -0
- package/dist/routes/rules/components/RuleAst.js +23 -0
- package/dist/routes/rules/components/RuleDependentRulesSection.d.ts +6 -0
- package/dist/routes/rules/components/RuleDependentRulesSection.d.ts.map +1 -0
- package/dist/routes/rules/components/RuleDependentRulesSection.js +16 -0
- package/dist/routes/rules/components/RuleDetailsPage.d.ts +14 -0
- package/dist/routes/rules/components/RuleDetailsPage.d.ts.map +1 -0
- package/dist/routes/rules/components/RuleDetailsPage.js +51 -0
- package/dist/routes/rules/components/RuleProducersSection.d.ts +7 -0
- package/dist/routes/rules/components/RuleProducersSection.d.ts.map +1 -0
- package/dist/routes/rules/components/RuleProducersSection.js +10 -0
- package/dist/routes/rules/components/RuleSampleFactsSection.d.ts +7 -0
- package/dist/routes/rules/components/RuleSampleFactsSection.d.ts.map +1 -0
- package/dist/routes/rules/components/RuleSampleFactsSection.js +70 -0
- package/dist/routes/rules/components/RulesOverviewHeaderActions.d.ts +17 -0
- package/dist/routes/rules/components/RulesOverviewHeaderActions.d.ts.map +1 -0
- package/dist/routes/rules/components/RulesOverviewHeaderActions.js +55 -0
- package/dist/routes/rules/components/RulesOverviewPage.d.ts +13 -0
- package/dist/routes/rules/components/RulesOverviewPage.d.ts.map +1 -0
- package/dist/routes/rules/components/RulesOverviewPage.js +236 -0
- package/dist/routes/rules/components/SupportedActionShapesList/SupportedActionShapeDetails.d.ts +7 -0
- package/dist/routes/rules/components/SupportedActionShapesList/SupportedActionShapeDetails.d.ts.map +1 -0
- package/dist/routes/rules/components/SupportedActionShapesList/SupportedActionShapeDetails.js +47 -0
- package/dist/routes/rules/components/SupportedActionShapesList/SupportedActionShapesList.d.ts +8 -0
- package/dist/routes/rules/components/SupportedActionShapesList/SupportedActionShapesList.d.ts.map +1 -0
- package/dist/routes/rules/components/SupportedActionShapesList/SupportedActionShapesList.js +76 -0
- package/dist/routes/rules/components/SupportedActionShapesList/TokenList.d.ts +6 -0
- package/dist/routes/rules/components/SupportedActionShapesList/TokenList.d.ts.map +1 -0
- package/dist/routes/rules/components/SupportedActionShapesList/TokenList.js +9 -0
- package/dist/routes/rules/components/SupportedActionShapesList/index.d.ts +2 -0
- package/dist/routes/rules/components/SupportedActionShapesList/index.d.ts.map +1 -0
- package/dist/routes/rules/components/SupportedActionShapesList/index.js +1 -0
- package/dist/routes/rules/components/SupportedActionShapesList/shacl-shape.d.ts +20 -0
- package/dist/routes/rules/components/SupportedActionShapesList/shacl-shape.d.ts.map +1 -0
- package/dist/routes/rules/components/SupportedActionShapesList/shacl-shape.js +48 -0
- package/dist/routes/rules/components/datalog-editor/BindingsPreview.d.ts +9 -0
- package/dist/routes/rules/components/datalog-editor/BindingsPreview.d.ts.map +1 -0
- package/dist/routes/rules/components/datalog-editor/BindingsPreview.js +38 -0
- package/dist/routes/rules/components/datalog-editor/FactsPreview.d.ts +10 -0
- package/dist/routes/rules/components/datalog-editor/FactsPreview.d.ts.map +1 -0
- package/dist/routes/rules/components/datalog-editor/FactsPreview.js +43 -0
- package/dist/routes/rules/components/datalog-editor/PreviewPanel.d.ts +7 -0
- package/dist/routes/rules/components/datalog-editor/PreviewPanel.d.ts.map +1 -0
- package/dist/routes/rules/components/datalog-editor/PreviewPanel.js +8 -0
- package/dist/routes/rules/components/datalog-editor/QueryResults.d.ts +9 -0
- package/dist/routes/rules/components/datalog-editor/QueryResults.d.ts.map +1 -0
- package/dist/routes/rules/components/datalog-editor/QueryResults.js +22 -0
- package/dist/routes/rules/components/datalog-editor/SparqlQueryPanel.d.ts +11 -0
- package/dist/routes/rules/components/datalog-editor/SparqlQueryPanel.d.ts.map +1 -0
- package/dist/routes/rules/components/datalog-editor/SparqlQueryPanel.js +21 -0
- package/dist/routes/rules/components/rule-producers.d.ts +15 -0
- package/dist/routes/rules/components/rule-producers.d.ts.map +1 -0
- package/dist/routes/rules/components/rule-producers.js +76 -0
- package/dist/routes/rules/components/sample-facts-query.d.ts +9 -0
- package/dist/routes/rules/components/sample-facts-query.d.ts.map +1 -0
- package/dist/routes/rules/components/sample-facts-query.js +71 -0
- package/dist/routes/rules/datalog-editor.d.ts +6 -0
- package/dist/routes/rules/datalog-editor.d.ts.map +1 -0
- package/dist/routes/rules/datalog-editor.js +7 -0
- package/dist/routes/rules/hooks/useRuleFactsPreview.d.ts +53 -0
- package/dist/routes/rules/hooks/useRuleFactsPreview.d.ts.map +1 -0
- package/dist/routes/rules/hooks/useRuleFactsPreview.js +214 -0
- package/dist/routes/rules/hooks/useSparqlQueryExecution.d.ts +14 -0
- package/dist/routes/rules/hooks/useSparqlQueryExecution.d.ts.map +1 -0
- package/dist/routes/rules/hooks/useSparqlQueryExecution.js +77 -0
- package/dist/routes/rules/pages.d.ts +6 -0
- package/dist/routes/rules/pages.d.ts.map +1 -0
- package/dist/routes/rules/pages.js +7 -0
- package/dist/rules/RuleNameLink.d.ts +6 -0
- package/dist/rules/RuleNameLink.d.ts.map +1 -0
- package/dist/rules/RuleNameLink.js +8 -0
- package/package.json +64 -24
- package/src/globals.css +18 -18
- package/src/themes/manta-dark.css +1 -4
- package/src/themes/manta.css +1 -0
- package/src/themes/standard.css +12 -11
- package/dist/components/channel-icon/marketer-icon.d.ts +0 -4
- package/dist/components/channel-icon/marketer-icon.d.ts.map +0 -1
- package/dist/components/channel-icon/marketer-icon.js +0 -6
- package/dist/components/rdfox-explain/OutdatedFactNotice.d.ts.map +0 -1
- package/dist/components/rdfox-explain/RDFoxExplain.d.ts +0 -16
- package/dist/components/rdfox-explain/RDFoxExplain.d.ts.map +0 -1
- package/dist/components/tool-invocation-card/ExplainRDFoxResultDisplay.d.ts +0 -9
- package/dist/components/tool-invocation-card/ExplainRDFoxResultDisplay.d.ts.map +0 -1
- package/dist/lib/test-utils.d.ts +0 -4
- package/dist/lib/test-utils.d.ts.map +0 -1
- package/dist/lib/test-utils.js +0 -16
- package/dist/rdfox-explain/AbsentFactNotice.d.ts +0 -5
- package/dist/rdfox-explain/AbsentFactNotice.d.ts.map +0 -1
- package/dist/rdfox-explain/AbsentFactNotice.js +0 -6
- package/dist/rdfox-explain/DatalogCode.d.ts.map +0 -1
- package/dist/rdfox-explain/EntityChip.d.ts.map +0 -1
- package/dist/rdfox-explain/EntityChip.js +0 -9
- package/dist/rdfox-explain/ExplainCompactView.d.ts.map +0 -1
- package/dist/rdfox-explain/ExplainFullView.d.ts.map +0 -1
- package/dist/rdfox-explain/ExplainStates.d.ts.map +0 -1
- package/dist/rdfox-explain/ExplainTag.d.ts.map +0 -1
- package/dist/rdfox-explain/FactValue.d.ts.map +0 -1
- package/dist/rdfox-explain/NumDot.d.ts.map +0 -1
- package/dist/rdfox-explain/PanelLabel.d.ts.map +0 -1
- package/dist/rdfox-explain/ProofSubjectHeader.d.ts.map +0 -1
- package/dist/rdfox-explain/ProvenanceBadge.d.ts.map +0 -1
- package/dist/rdfox-explain/RDFoxExplainState.d.ts +0 -7
- package/dist/rdfox-explain/RDFoxExplainState.d.ts.map +0 -1
- package/dist/rdfox-explain/RuleVariableTypes.d.ts.map +0 -1
- package/dist/rdfox-explain/StoredFactNotice.d.ts +0 -5
- package/dist/rdfox-explain/StoredFactNotice.d.ts.map +0 -1
- package/dist/rdfox-explain/StoredFactNotice.js +0 -6
- package/dist/rdfox-explain/SubstitutedFactNotice.d.ts.map +0 -1
- package/dist/rdfox-explain/ValuePill.d.ts.map +0 -1
- package/dist/rdfox-explain/busy-aggregate-fixture.d.ts +0 -7
- package/dist/rdfox-explain/busy-aggregate-fixture.d.ts.map +0 -1
- package/dist/rdfox-explain/busy-aggregate-fixture.js +0 -6
- package/dist/rdfox-explain/conclusion/ConclusionCard.d.ts.map +0 -1
- package/dist/rdfox-explain/conclusion/ConclusionSubtitle.d.ts.map +0 -1
- package/dist/rdfox-explain/conclusion/index.d.ts.map +0 -1
- package/dist/rdfox-explain/explain-styles.d.ts.map +0 -1
- package/dist/rdfox-explain/fact-token.d.ts.map +0 -1
- package/dist/rdfox-explain/formula-hues.d.ts.map +0 -1
- package/dist/rdfox-explain/index.d.ts.map +0 -1
- package/dist/rdfox-explain/inspector/ExplainInspector.d.ts.map +0 -1
- package/dist/rdfox-explain/inspector/ExplainInspector.js +0 -22
- package/dist/rdfox-explain/inspector/InspectorBindings.d.ts.map +0 -1
- package/dist/rdfox-explain/inspector/InspectorFact.d.ts.map +0 -1
- package/dist/rdfox-explain/inspector/InspectorHeader.d.ts.map +0 -1
- package/dist/rdfox-explain/inspector/InspectorRule.d.ts.map +0 -1
- package/dist/rdfox-explain/inspector/SupportsSection.d.ts.map +0 -1
- package/dist/rdfox-explain/inspector/index.d.ts.map +0 -1
- package/dist/rdfox-explain/proof-tree/ProofFactLabel.d.ts.map +0 -1
- package/dist/rdfox-explain/proof-tree/ProofRowBadge.d.ts.map +0 -1
- package/dist/rdfox-explain/proof-tree/ProofRowContent.d.ts.map +0 -1
- package/dist/rdfox-explain/proof-tree/ProofRowValue.d.ts.map +0 -1
- package/dist/rdfox-explain/proof-tree/ProofTree.d.ts.map +0 -1
- package/dist/rdfox-explain/proof-tree/ProofTreeFormulaFooter.d.ts.map +0 -1
- package/dist/rdfox-explain/proof-tree/ProofTreeNode.d.ts.map +0 -1
- package/dist/rdfox-explain/proof-tree/SupportsTag.d.ts.map +0 -1
- package/dist/rdfox-explain/proof-tree/SupportsTag.js +0 -6
- package/dist/rdfox-explain/proof-tree/index.d.ts.map +0 -1
- package/dist/rdfox-explain/proof-tree/proof-tree-navigation.d.ts.map +0 -1
- package/dist/rdfox-explain/proof-tree/proof-tree-root-view.d.ts.map +0 -1
- package/dist/rdfox-explain/proof-tree/visible-premises.d.ts.map +0 -1
- package/dist/rdfox-explain/rule-presentation.d.ts.map +0 -1
- package/dist/rdfox-explain/tree-model.d.ts.map +0 -1
- package/dist/rdfox-explain/use-fact-measure.d.ts.map +0 -1
- package/dist/test-support.d.ts +0 -9
- package/dist/test-support.d.ts.map +0 -1
- package/dist/test-support.js +0 -18
- package/src/themes/marketer-dark.css +0 -70
- /package/dist/components/{rdfox-explain → explain-fact}/OutdatedFactNotice.d.ts +0 -0
- /package/dist/components/{rdfox-explain → explain-fact}/OutdatedFactNotice.js +0 -0
- /package/dist/{rdfox-explain → explain-fact}/DatalogCode.d.ts +0 -0
- /package/dist/{rdfox-explain → explain-fact}/DatalogCode.js +0 -0
- /package/dist/{rdfox-explain → explain-fact}/EntityChip.d.ts +0 -0
- /package/dist/{rdfox-explain → explain-fact}/ExplainCompactView.d.ts +0 -0
- /package/dist/{rdfox-explain → explain-fact}/ExplainCompactView.js +0 -0
- /package/dist/{rdfox-explain → explain-fact}/ExplainFullView.d.ts +0 -0
- /package/dist/{rdfox-explain → explain-fact}/ExplainFullView.js +0 -0
- /package/dist/{rdfox-explain → explain-fact}/ExplainStates.d.ts +0 -0
- /package/dist/{rdfox-explain → explain-fact}/ExplainStates.js +0 -0
- /package/dist/{rdfox-explain → explain-fact}/ExplainTag.d.ts +0 -0
- /package/dist/{rdfox-explain → explain-fact}/ExplainTag.js +0 -0
- /package/dist/{rdfox-explain → explain-fact}/FactValue.d.ts +0 -0
- /package/dist/{rdfox-explain → explain-fact}/FactValue.js +0 -0
- /package/dist/{rdfox-explain → explain-fact}/NumDot.d.ts +0 -0
- /package/dist/{rdfox-explain → explain-fact}/NumDot.js +0 -0
- /package/dist/{rdfox-explain → explain-fact}/PanelLabel.d.ts +0 -0
- /package/dist/{rdfox-explain → explain-fact}/PanelLabel.js +0 -0
- /package/dist/{rdfox-explain → explain-fact}/ProofSubjectHeader.d.ts +0 -0
- /package/dist/{rdfox-explain → explain-fact}/ProofSubjectHeader.js +0 -0
- /package/dist/{rdfox-explain → explain-fact}/ProvenanceBadge.d.ts +0 -0
- /package/dist/{rdfox-explain → explain-fact}/RuleVariableTypes.d.ts +0 -0
- /package/dist/{rdfox-explain → explain-fact}/RuleVariableTypes.js +0 -0
- /package/dist/{rdfox-explain → explain-fact}/SubstitutedFactNotice.d.ts +0 -0
- /package/dist/{rdfox-explain → explain-fact}/SubstitutedFactNotice.js +0 -0
- /package/dist/{rdfox-explain → explain-fact}/ValuePill.d.ts +0 -0
- /package/dist/{rdfox-explain → explain-fact}/ValuePill.js +0 -0
- /package/dist/{rdfox-explain → explain-fact}/conclusion/ConclusionCard.d.ts +0 -0
- /package/dist/{rdfox-explain → explain-fact}/conclusion/ConclusionCard.js +0 -0
- /package/dist/{rdfox-explain → explain-fact}/conclusion/ConclusionSubtitle.d.ts +0 -0
- /package/dist/{rdfox-explain → explain-fact}/conclusion/index.d.ts +0 -0
- /package/dist/{rdfox-explain → explain-fact}/conclusion/index.js +0 -0
- /package/dist/{rdfox-explain → explain-fact}/explain-styles.d.ts +0 -0
- /package/dist/{rdfox-explain → explain-fact}/explain-styles.js +0 -0
- /package/dist/{rdfox-explain → explain-fact}/fact-token.d.ts +0 -0
- /package/dist/{rdfox-explain → explain-fact}/fact-token.js +0 -0
- /package/dist/{rdfox-explain → explain-fact}/formula-hues.d.ts +0 -0
- /package/dist/{rdfox-explain → explain-fact}/formula-hues.js +0 -0
- /package/dist/{rdfox-explain → explain-fact}/inspector/ExplainInspector.d.ts +0 -0
- /package/dist/{rdfox-explain → explain-fact}/inspector/InspectorBindings.d.ts +0 -0
- /package/dist/{rdfox-explain → explain-fact}/inspector/InspectorBindings.js +0 -0
- /package/dist/{rdfox-explain → explain-fact}/inspector/InspectorFact.d.ts +0 -0
- /package/dist/{rdfox-explain → explain-fact}/inspector/InspectorFact.js +0 -0
- /package/dist/{rdfox-explain → explain-fact}/inspector/InspectorHeader.d.ts +0 -0
- /package/dist/{rdfox-explain → explain-fact}/inspector/InspectorHeader.js +0 -0
- /package/dist/{rdfox-explain → explain-fact}/inspector/SupportsSection.d.ts +0 -0
- /package/dist/{rdfox-explain → explain-fact}/inspector/index.d.ts +0 -0
- /package/dist/{rdfox-explain → explain-fact}/inspector/index.js +0 -0
- /package/dist/{rdfox-explain → explain-fact}/proof-tree/ProofFactLabel.d.ts +0 -0
- /package/dist/{rdfox-explain → explain-fact}/proof-tree/ProofFactLabel.js +0 -0
- /package/dist/{rdfox-explain → explain-fact}/proof-tree/ProofRowBadge.d.ts +0 -0
- /package/dist/{rdfox-explain → explain-fact}/proof-tree/ProofRowBadge.js +0 -0
- /package/dist/{rdfox-explain → explain-fact}/proof-tree/ProofRowContent.d.ts +0 -0
- /package/dist/{rdfox-explain → explain-fact}/proof-tree/ProofRowContent.js +0 -0
- /package/dist/{rdfox-explain → explain-fact}/proof-tree/ProofRowValue.d.ts +0 -0
- /package/dist/{rdfox-explain → explain-fact}/proof-tree/ProofRowValue.js +0 -0
- /package/dist/{rdfox-explain → explain-fact}/proof-tree/ProofTree.d.ts +0 -0
- /package/dist/{rdfox-explain → explain-fact}/proof-tree/ProofTreeFormulaFooter.d.ts +0 -0
- /package/dist/{rdfox-explain → explain-fact}/proof-tree/ProofTreeFormulaFooter.js +0 -0
- /package/dist/{rdfox-explain → explain-fact}/proof-tree/ProofTreeNode.d.ts +0 -0
- /package/dist/{rdfox-explain → explain-fact}/proof-tree/ProofTreeNode.js +0 -0
- /package/dist/{rdfox-explain → explain-fact}/proof-tree/SupportsTag.d.ts +0 -0
- /package/dist/{rdfox-explain → explain-fact}/proof-tree/index.d.ts +0 -0
- /package/dist/{rdfox-explain → explain-fact}/proof-tree/index.js +0 -0
- /package/dist/{rdfox-explain → explain-fact}/proof-tree/proof-tree-navigation.d.ts +0 -0
- /package/dist/{rdfox-explain → explain-fact}/proof-tree/proof-tree-navigation.js +0 -0
- /package/dist/{rdfox-explain → explain-fact}/proof-tree/proof-tree-root-view.d.ts +0 -0
- /package/dist/{rdfox-explain → explain-fact}/proof-tree/proof-tree-root-view.js +0 -0
- /package/dist/{rdfox-explain → explain-fact}/proof-tree/visible-premises.d.ts +0 -0
- /package/dist/{rdfox-explain → explain-fact}/proof-tree/visible-premises.js +0 -0
- /package/dist/{rdfox-explain → explain-fact}/rule-presentation.d.ts +0 -0
- /package/dist/{rdfox-explain → explain-fact}/rule-presentation.js +0 -0
- /package/dist/{rdfox-explain → explain-fact}/use-fact-measure.d.ts +0 -0
- /package/dist/{rdfox-explain → explain-fact}/use-fact-measure.js +0 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { namespaces } from "@manta-eu/client/shared/rdf-namespaces";
|
|
3
|
+
import { isPresent } from "@manta-eu/lib/present";
|
|
4
|
+
import { AlertCircle, ChevronDown, ChevronRight, Database, TrendingUp } from "lucide-react";
|
|
5
|
+
import { forwardRef, useState } from "react";
|
|
6
|
+
import { useDebounceValue } from "usehooks-ts";
|
|
7
|
+
import { useRuleFactsPreview } from "../../hooks/useRuleFactsPreview.js";
|
|
8
|
+
import { Badge } from "#components/badge/index";
|
|
9
|
+
import { Button } from "#components/button/index";
|
|
10
|
+
import { Skeleton } from "#components/skeleton/index";
|
|
11
|
+
import { cn } from "#lib/utils";
|
|
12
|
+
import { useMantaClient } from "#providers/MantaClientProvider";
|
|
13
|
+
const compactNumber = new Intl.NumberFormat("en", { notation: "compact", maximumFractionDigits: 1 });
|
|
14
|
+
function formatCount(count) {
|
|
15
|
+
return compactNumber.format(count);
|
|
16
|
+
}
|
|
17
|
+
function getCountColor(count) {
|
|
18
|
+
if (count === 0)
|
|
19
|
+
return "text-muted-foreground";
|
|
20
|
+
if (count < 100)
|
|
21
|
+
return "text-success";
|
|
22
|
+
if (count < 1000)
|
|
23
|
+
return "text-warning";
|
|
24
|
+
return "text-error-foreground";
|
|
25
|
+
}
|
|
26
|
+
export const FactsPreview = forwardRef(function FactsPreview(props, ref) {
|
|
27
|
+
const { mantaClient } = useMantaClient();
|
|
28
|
+
const { rule, ast, prefixes = namespaces, sampleLimit = 10, className, ...restProps } = props;
|
|
29
|
+
const [showSamples, setShowSamples] = useState(true);
|
|
30
|
+
const [debouncedRule] = useDebounceValue(rule, 500);
|
|
31
|
+
const [debouncedAst] = useDebounceValue(ast, 500);
|
|
32
|
+
const hasQueryableRule = !!debouncedAst && isPresent(debouncedAst.head) && isPresent(debouncedAst.body);
|
|
33
|
+
const factsPreview = useRuleFactsPreview({
|
|
34
|
+
rule: debouncedRule,
|
|
35
|
+
graphqlClient: mantaClient,
|
|
36
|
+
prefixes,
|
|
37
|
+
enabled: hasQueryableRule,
|
|
38
|
+
sampleLimit,
|
|
39
|
+
});
|
|
40
|
+
return (_jsxs("div", { ref: ref, className: cn("border rounded-lg overflow-hidden", className), ...restProps, children: [_jsx("div", { className: "bg-muted/30 px-4 py-2 border-b", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Database, { className: "size-4 text-muted-foreground" }), _jsx("h4", { className: "typography-caption text-muted-foreground", children: "Facts Preview" })] }), factsPreview.factCount !== null && (_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(TrendingUp, { className: "size-4 text-muted-foreground" }), _jsxs("span", { className: cn("typography-caption", getCountColor(factsPreview.factCount)), children: [formatCount(factsPreview.factCount), " facts"] })] }))] }) }), _jsx("div", { className: "p-4", children: !debouncedAst ? (_jsx("p", { className: "typography-small text-muted-foreground", children: "Enter a valid rule to see inferred facts" })) : !isPresent(debouncedAst.head) ? (_jsx("p", { className: "typography-small text-muted-foreground", children: "Add head atoms to see inferred facts preview" })) : !isPresent(debouncedAst.body) ? (_jsx("p", { className: "typography-small text-muted-foreground", children: "Add body formulas to infer facts" })) : factsPreview.isLoadingCount ? (_jsx("div", { className: "space-y-3", children: _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Skeleton, { className: "h-6 w-24" }), _jsx(Skeleton, { className: "h-6 w-16" })] }) })) : factsPreview.error ? (_jsxs("div", { className: "flex items-start gap-2 text-error-foreground", children: [_jsx(AlertCircle, { className: "size-4 mt-0.5 shrink-0" }), _jsx("p", { className: "typography-small", children: factsPreview.error })] })) : (_jsxs("div", { className: "space-y-4", children: [factsPreview.factCount !== null && (_jsxs("div", { className: "flex items-center justify-between p-3 bg-muted/20 rounded-lg border border-muted", children: [_jsxs("div", { children: [_jsx("p", { className: "typography-small", children: "Total Inferred Facts" }), _jsx("p", { className: "typography-caption text-muted-foreground", children: factsPreview.factCount === 0
|
|
41
|
+
? "No facts would be inferred"
|
|
42
|
+
: `This rule would create ${formatCount(factsPreview.factCount)} new facts` })] }), _jsx(Badge, { size: "sm", variant: factsPreview.factCount === 0 ? "secondary" : "default", children: formatCount(factsPreview.factCount) })] })), factsPreview.factCount !== null && factsPreview.factCount > 0 && (_jsxs("div", { className: "space-y-2", children: [_jsxs(Button, { type: "button", variant: "ghost", size: "sm", onClick: () => setShowSamples(!showSamples), icon: showSamples ? ChevronDown : ChevronRight, className: "w-full justify-start", children: ["Sample Inferred Triples", factsPreview.samples && (_jsxs("span", { className: "ml-auto typography-small text-muted-foreground", children: ["(", Math.min(factsPreview.samples.length, sampleLimit), " shown)"] }))] }), showSamples && (_jsx("div", { className: "space-y-2", children: factsPreview.isLoadingSamples ? (_jsxs(_Fragment, { children: [_jsx(Skeleton, { className: "h-12 w-full" }), _jsx(Skeleton, { className: "h-12 w-5/6" }), _jsx(Skeleton, { className: "h-12 w-4/5" })] })) : isPresent(factsPreview.samples) ? (_jsx("div", { className: "space-y-1.5", children: factsPreview.samples.slice(0, sampleLimit).map((triple) => (_jsx("div", { className: "p-2 bg-background border rounded-md hover:bg-muted/20 transition-colors", children: _jsxs("div", { className: "flex items-start gap-2 font-mono typography-small", children: [_jsx("span", { className: "text-primary break-all", children: triple.subject }), _jsx("span", { className: "text-muted-foreground shrink-0", children: "\u2192" }), _jsx("span", { className: "text-success break-all", children: triple.predicate }), _jsx("span", { className: "text-muted-foreground shrink-0", children: "\u2192" }), _jsx("span", { className: "text-primary break-all", children: triple.object })] }) }, `${triple.subject || "unknown"}-${triple.predicate || "unknown"}-${triple.object || "unknown"}`))) })) : (_jsx("p", { className: "typography-small text-muted-foreground p-2", children: "No sample triples available" })) }))] }))] })) })] }));
|
|
43
|
+
});
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DatalogRule } from "@manta-eu/datalog-parser";
|
|
2
|
+
export type PreviewPanelProps = {
|
|
3
|
+
rule: string;
|
|
4
|
+
ast: DatalogRule | null;
|
|
5
|
+
};
|
|
6
|
+
export declare function PreviewPanel(props: PreviewPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
//# sourceMappingURL=PreviewPanel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PreviewPanel.d.ts","sourceRoot":"","sources":["../../../../../src/routes/rules/components/datalog-editor/PreviewPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAG5D,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,WAAW,GAAG,IAAI,CAAC;CACzB,CAAC;AAEF,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,2CAqBpD"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { DatalogAst } from "#ldo-ui";
|
|
3
|
+
export function PreviewPanel(props) {
|
|
4
|
+
const { rule, ast } = props;
|
|
5
|
+
return (_jsxs("div", { className: "rounded-md border overflow-hidden", children: [_jsx("div", { className: "border-b bg-muted/30 px-4 py-2", children: _jsx("h4", { className: "typography-caption text-muted-foreground", children: "Parsed AST" }) }), _jsx("div", { className: "p-4 overflow-auto max-h-150", children: ast ? (_jsx(DatalogAst, { rule: rule })) : (_jsx("p", { className: "typography-small text-muted-foreground", children: rule.trim()
|
|
6
|
+
? "Fix syntax errors to see the AST visualization"
|
|
7
|
+
: "Enter a Datalog rule to see its AST visualization" })) })] }));
|
|
8
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ComponentProps } from "react";
|
|
2
|
+
export type QueryResultsProps = ComponentProps<"div"> & {
|
|
3
|
+
variables: string[];
|
|
4
|
+
bindings: Record<string, string>[];
|
|
5
|
+
isLoading?: boolean;
|
|
6
|
+
error?: string | null;
|
|
7
|
+
};
|
|
8
|
+
export declare const QueryResults: import("react").ForwardRefExoticComponent<Omit<QueryResultsProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
9
|
+
//# sourceMappingURL=QueryResults.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QueryResults.d.ts","sourceRoot":"","sources":["../../../../../src/routes/rules/components/datalog-editor/QueryResults.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAK5C,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IACtD,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;IACnC,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB,CAAC;AAEF,eAAO,MAAM,YAAY,2HAwGvB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { isPresent } from "@manta-eu/lib/present";
|
|
3
|
+
import { AlertCircle, Database, FileText } from "lucide-react";
|
|
4
|
+
import { forwardRef } from "react";
|
|
5
|
+
import { Loader } from "#components/loader/index";
|
|
6
|
+
import { cn } from "#lib/utils";
|
|
7
|
+
export const QueryResults = forwardRef(function QueryResults(props, ref) {
|
|
8
|
+
const { variables, bindings, isLoading, error, className, ...restProps } = props;
|
|
9
|
+
if (isLoading) {
|
|
10
|
+
return (_jsxs("div", { ref: ref, className: cn("flex items-center justify-center p-8 text-muted-foreground", className), ...restProps, children: [_jsx(Loader, { className: "size-4 mr-2" }), _jsx("span", { className: "typography-small", children: "Running query..." })] }));
|
|
11
|
+
}
|
|
12
|
+
if (error) {
|
|
13
|
+
return (_jsx("div", { ref: ref, className: cn("p-4", className), ...restProps, children: _jsxs("div", { className: "flex items-start gap-2 text-error-foreground", children: [_jsx(AlertCircle, { className: "size-4 mt-0.5 flex-shrink-0" }), _jsxs("div", { className: "typography-small", children: [_jsx("p", { className: "typography-small-medium mb-1", children: "Query Error" }), _jsx("p", { className: "text-error-foreground/80 whitespace-pre-wrap", children: error })] })] }) }));
|
|
14
|
+
}
|
|
15
|
+
if (!isPresent(variables) && !isPresent(bindings)) {
|
|
16
|
+
return (_jsxs("div", { ref: ref, className: cn("flex flex-col items-center justify-center p-8 text-muted-foreground", className), ...restProps, children: [_jsx(Database, { className: "size-8 mb-3 text-muted-foreground/50" }), _jsx("p", { className: "typography-small-medium", children: "No results yet" }), _jsx("p", { className: "typography-caption text-muted-foreground/70 mt-1", children: "Run a query to see results" })] }));
|
|
17
|
+
}
|
|
18
|
+
if (!isPresent(bindings)) {
|
|
19
|
+
return (_jsxs("div", { ref: ref, className: cn("flex flex-col items-center justify-center p-8 text-muted-foreground", className), ...restProps, children: [_jsx(FileText, { className: "size-8 mb-3 text-muted-foreground/50" }), _jsx("p", { className: "typography-small-medium", children: "No matching results" }), _jsx("p", { className: "typography-tiny text-muted-foreground/70 mt-1", children: "The query returned 0 rows" })] }));
|
|
20
|
+
}
|
|
21
|
+
return (_jsx("div", { ref: ref, className: cn("overflow-auto", className), ...restProps, children: _jsxs("div", { className: "min-w-full", children: [_jsx("div", { className: "border-b bg-muted/30 px-4 py-2", children: _jsxs("p", { className: "typography-tiny text-muted-foreground", children: [bindings.length, " ", bindings.length === 1 ? "result" : "results"] }) }), _jsxs("table", { className: "w-full", children: [_jsx("thead", { children: _jsx("tr", { className: "border-b bg-muted/50", children: variables.map((variable) => (_jsxs("th", { className: "px-4 py-2 text-left typography-tiny-semibold text-muted-foreground uppercase", children: ["?", variable] }, variable))) }) }), _jsx("tbody", { children: bindings.map((binding, index) => (_jsx("tr", { className: cn("border-b transition-colors", "hover:bg-accent/50", index % 2 === 0 ? "bg-background" : "bg-muted/20"), children: variables.map((variable) => (_jsx("td", { className: "px-4 py-2 typography-small", children: _jsx("span", { className: "font-mono typography-tiny break-all", children: binding[variable] || _jsx("span", { className: "text-muted-foreground/50 italic", children: "null" }) }) }, variable))) }, index))) })] })] }) }));
|
|
22
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SparqlQueryResult } from "../../hooks/useSparqlQueryExecution.js";
|
|
2
|
+
export type SparqlQueryPanelProps = {
|
|
3
|
+
query: string | null;
|
|
4
|
+
isLoading?: boolean;
|
|
5
|
+
error?: string | null;
|
|
6
|
+
results?: SparqlQueryResult | null;
|
|
7
|
+
onExecute?: () => void;
|
|
8
|
+
onReset?: () => void;
|
|
9
|
+
};
|
|
10
|
+
export declare function SparqlQueryPanel(props: SparqlQueryPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
//# sourceMappingURL=SparqlQueryPanel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SparqlQueryPanel.d.ts","sourceRoot":"","sources":["../../../../../src/routes/rules/components/datalog-editor/SparqlQueryPanel.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AAI7E,MAAM,MAAM,qBAAqB,GAAG;IAClC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,OAAO,CAAC,EAAE,iBAAiB,GAAG,IAAI,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB,CAAC;AAMF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,2CAiE5D"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { Copy, Play, RotateCw } from "lucide-react";
|
|
3
|
+
import { useMemo, useState } from "react";
|
|
4
|
+
import { QueryResults } from "./QueryResults.js";
|
|
5
|
+
import { Button } from "#components/button/index";
|
|
6
|
+
function stripPrefixBlock(query) {
|
|
7
|
+
return query.replace(/^(?:PREFIX[^\n]*\n)+\s*/, "");
|
|
8
|
+
}
|
|
9
|
+
export function SparqlQueryPanel(props) {
|
|
10
|
+
const { query, isLoading, error, results, onExecute, onReset } = props;
|
|
11
|
+
const [copied, setCopied] = useState(false);
|
|
12
|
+
const displayQuery = useMemo(() => (query ? stripPrefixBlock(query) : null), [query]);
|
|
13
|
+
function handleCopy() {
|
|
14
|
+
if (displayQuery) {
|
|
15
|
+
void navigator.clipboard.writeText(displayQuery);
|
|
16
|
+
setCopied(true);
|
|
17
|
+
setTimeout(() => setCopied(false), 2000);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return (_jsxs("div", { className: "flex h-full flex-col rounded-md border overflow-hidden", children: [_jsx("div", { className: "border-b bg-muted/30 px-4 py-2", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("h4", { className: "typography-caption text-muted-foreground", children: "Generated SPARQL Query" }), _jsxs("div", { className: "flex items-center gap-2", children: [_jsx(Button, { type: "button", size: "sm", variant: "ghost", onClick: handleCopy, disabled: !query, icon: Copy, children: copied ? "Copied!" : "Copy" }), results && (_jsx(Button, { type: "button", size: "sm", variant: "ghost", onClick: onReset, disabled: isLoading, icon: RotateCw, children: "Reset" })), _jsx(Button, { type: "button", size: "sm", variant: "primary", onClick: onExecute, disabled: isLoading || !query, icon: Play, children: isLoading ? "Running..." : "Run" })] })] }) }), displayQuery ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "p-4 bg-muted/20 border-b", children: _jsx("pre", { className: "typography-caption font-mono whitespace-pre-wrap break-all text-default-foreground/90", children: displayQuery }) }), _jsx("div", { className: "flex-1 overflow-auto", children: _jsx(QueryResults, { variables: results?.variables || [], bindings: results?.bindings || [], isLoading: isLoading, error: error }) })] })) : (_jsx("p", { className: "p-4 typography-small text-muted-foreground", children: "Enter a valid Datalog rule with body formulas to generate a SPARQL query" }))] }));
|
|
21
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { GQLRule } from "@manta-eu/client";
|
|
2
|
+
import { type DatalogTerm } from "@manta-eu/datalog-parser";
|
|
3
|
+
export type RuleProducer = {
|
|
4
|
+
ruleIri: string;
|
|
5
|
+
isStaged: boolean;
|
|
6
|
+
};
|
|
7
|
+
export type ProducerRule = Pick<GQLRule, "ruleIri" | "committedRule" | "stagedRule" | "isStaged">;
|
|
8
|
+
type ProducerEntry = RuleProducer & {
|
|
9
|
+
graphKeys: Set<string>;
|
|
10
|
+
};
|
|
11
|
+
export type RuleProducerIndex = Map<string, ProducerEntry[]>;
|
|
12
|
+
export declare function buildRuleProducerIndex(rules: readonly ProducerRule[], excludeRuleIri?: string): RuleProducerIndex;
|
|
13
|
+
export declare function lookupRuleProducers(index: RuleProducerIndex, term: string, graph: DatalogTerm | undefined): RuleProducer[];
|
|
14
|
+
export {};
|
|
15
|
+
//# sourceMappingURL=rule-producers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rule-producers.d.ts","sourceRoot":"","sources":["../../../../src/routes/rules/components/rule-producers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAIL,KAAK,WAAW,EACjB,MAAM,0BAA0B,CAAC;AAMlC,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,EAAE,SAAS,GAAG,eAAe,GAAG,YAAY,GAAG,UAAU,CAAC,CAAC;AAElG,KAAK,aAAa,GAAG,YAAY,GAAG;IAAE,SAAS,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CAAE,CAAC;AAE/D,MAAM,MAAM,iBAAiB,GAAG,GAAG,CAAC,MAAM,EAAE,aAAa,EAAE,CAAC,CAAC;AAwC7D,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,EAAE,cAAc,CAAC,EAAE,MAAM,GAAG,iBAAiB,CASjH;AAED,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,iBAAiB,EACxB,IAAI,EAAE,MAAM,EACZ,KAAK,EAAE,WAAW,GAAG,SAAS,GAC7B,YAAY,EAAE,CAehB"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { classAssertionFromAtom, propertyAssertionFromAtom, } from "@manta-eu/datalog-parser";
|
|
2
|
+
import { collectBy, groupBy } from "ramda";
|
|
3
|
+
import { match } from "ts-pattern";
|
|
4
|
+
import { getRuleDisplayName, getRuleDisplayText } from "./rules.utils.js";
|
|
5
|
+
import { ontologyTermIri, parseDatalogRuleCached } from "#ldo-ui";
|
|
6
|
+
const defaultGraphKey = "";
|
|
7
|
+
const anyGraphKey = "*";
|
|
8
|
+
function ruleProducerAssertions(rule) {
|
|
9
|
+
const ruleText = getRuleDisplayText(rule);
|
|
10
|
+
if (!ruleText.trim())
|
|
11
|
+
return [];
|
|
12
|
+
const { ast } = parseDatalogRuleCached(ruleText);
|
|
13
|
+
if (!ast)
|
|
14
|
+
return [];
|
|
15
|
+
return ast.head.flatMap((atom) => {
|
|
16
|
+
const assertion = headAssertion(atom);
|
|
17
|
+
if (!assertion)
|
|
18
|
+
return [];
|
|
19
|
+
const termIri = ontologyTermIri(assertion.term);
|
|
20
|
+
if (!termIri)
|
|
21
|
+
return [];
|
|
22
|
+
return [{ ruleIri: rule.ruleIri, isStaged: rule.isStaged, termIri, graphKey: graphTermKey(assertion.graph) }];
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function toProducerEntries(assertions) {
|
|
26
|
+
return collectBy((assertion) => assertion.ruleIri, assertions).flatMap((perRule) => {
|
|
27
|
+
const first = perRule[0];
|
|
28
|
+
if (!first)
|
|
29
|
+
return [];
|
|
30
|
+
return [
|
|
31
|
+
{
|
|
32
|
+
ruleIri: first.ruleIri,
|
|
33
|
+
isStaged: first.isStaged,
|
|
34
|
+
graphKeys: new Set(perRule.map((assertion) => assertion.graphKey)),
|
|
35
|
+
},
|
|
36
|
+
];
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
export function buildRuleProducerIndex(rules, excludeRuleIri) {
|
|
40
|
+
const assertions = rules.filter((rule) => rule.ruleIri !== excludeRuleIri).flatMap(ruleProducerAssertions);
|
|
41
|
+
return new Map(Object.entries(groupBy((assertion) => assertion.termIri, assertions)).map(([termIri, group]) => [
|
|
42
|
+
termIri,
|
|
43
|
+
toProducerEntries(group ?? []),
|
|
44
|
+
]));
|
|
45
|
+
}
|
|
46
|
+
export function lookupRuleProducers(index, term, graph) {
|
|
47
|
+
const termIri = ontologyTermIri(term);
|
|
48
|
+
if (!termIri)
|
|
49
|
+
return [];
|
|
50
|
+
const entries = index.get(termIri);
|
|
51
|
+
if (!entries)
|
|
52
|
+
return [];
|
|
53
|
+
const consumerGraphKey = graphTermKey(graph);
|
|
54
|
+
return entries
|
|
55
|
+
.filter((entry) => consumerGraphKey === anyGraphKey || entry.graphKeys.has(consumerGraphKey) || entry.graphKeys.has(anyGraphKey))
|
|
56
|
+
.map(({ ruleIri, isStaged }) => ({ ruleIri, isStaged }))
|
|
57
|
+
.sort((left, right) => getRuleDisplayName(left.ruleIri).localeCompare(getRuleDisplayName(right.ruleIri)));
|
|
58
|
+
}
|
|
59
|
+
function headAssertion(atom) {
|
|
60
|
+
const classAssertion = classAssertionFromAtom(atom);
|
|
61
|
+
if (classAssertion)
|
|
62
|
+
return { term: classAssertion.className, graph: classAssertion.graph };
|
|
63
|
+
const propertyAssertion = propertyAssertionFromAtom(atom);
|
|
64
|
+
if (propertyAssertion)
|
|
65
|
+
return { term: propertyAssertion.predicate, graph: propertyAssertion.graph };
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
function graphTermKey(graph) {
|
|
69
|
+
return match(graph)
|
|
70
|
+
.with({ type: "variable" }, () => anyGraphKey)
|
|
71
|
+
.with({ type: "iri" }, (g) => ontologyTermIri(g.value) ?? g.value)
|
|
72
|
+
.with({ type: "literal" }, () => defaultGraphKey)
|
|
73
|
+
.with({ type: "blank" }, () => defaultGraphKey)
|
|
74
|
+
.with(undefined, () => defaultGraphKey)
|
|
75
|
+
.exhaustive();
|
|
76
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function buildSampleFactsQuery(ruleText: string, limit?: number): string;
|
|
2
|
+
type HeadConstraintGroup = {
|
|
3
|
+
graph?: string;
|
|
4
|
+
predicates: string[];
|
|
5
|
+
classes: string[];
|
|
6
|
+
};
|
|
7
|
+
export declare function extractHeadConstraints(ruleText: string): HeadConstraintGroup[];
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=sample-facts-query.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sample-facts-query.d.ts","sourceRoot":"","sources":["../../../../src/routes/rules/components/sample-facts-query.ts"],"names":[],"mappings":"AAKA,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,MAAM,EAAE,KAAK,SAAI,GAAG,MAAM,CA2BzE;AAUD,KAAK,mBAAmB,GAAG;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,mBAAmB,EAAE,CA6C9E"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { isIriTerm, termToSparql } from "@manta-eu/datalog-parser";
|
|
2
|
+
import { isPresent } from "@manta-eu/lib/present";
|
|
3
|
+
import { match } from "ts-pattern";
|
|
4
|
+
import { parseDatalogRuleCached } from "#ldo-ui";
|
|
5
|
+
export function buildSampleFactsQuery(ruleText, limit = 5) {
|
|
6
|
+
const groups = extractHeadConstraints(ruleText);
|
|
7
|
+
const blocks = groups.flatMap(({ graph, predicates, classes }) => {
|
|
8
|
+
const groupBlocks = [];
|
|
9
|
+
if (isPresent(predicates)) {
|
|
10
|
+
groupBlocks.push(factBlock([`VALUES ?P { ${predicates.join(" ")} }`], graph));
|
|
11
|
+
}
|
|
12
|
+
if (isPresent(classes)) {
|
|
13
|
+
groupBlocks.push(factBlock([`VALUES ?P { rdf:type }`, `VALUES ?O { ${classes.join(" ")} }`], graph));
|
|
14
|
+
}
|
|
15
|
+
return groupBlocks;
|
|
16
|
+
});
|
|
17
|
+
if (!isPresent(blocks)) {
|
|
18
|
+
throw new Error("Rule has no concrete head predicates or classes to sample");
|
|
19
|
+
}
|
|
20
|
+
const where = blocks.length === 1 ? blocks[0] : blocks.map((block) => `{ ${block} }`).join("\n UNION\n ");
|
|
21
|
+
const projection = groups.some(({ graph }) => isPresent(graph)) ? "?S ?P ?O ?G" : "?S ?P ?O";
|
|
22
|
+
return `SELECT ${projection} WHERE {
|
|
23
|
+
${where}
|
|
24
|
+
} LIMIT ${limit}`;
|
|
25
|
+
}
|
|
26
|
+
function factBlock(constraints, graph) {
|
|
27
|
+
const patterns = ["?S ?P ?O EXPLICIT FALSE .", ...constraints];
|
|
28
|
+
if (!graph)
|
|
29
|
+
return patterns.join("\n ");
|
|
30
|
+
return `GRAPH ${graph} { ${[...patterns, `BIND(${graph} AS ?G)`].join("\n ")} }`;
|
|
31
|
+
}
|
|
32
|
+
export function extractHeadConstraints(ruleText) {
|
|
33
|
+
const { ast, error } = parseDatalogRuleCached(ruleText);
|
|
34
|
+
if (error || !ast) {
|
|
35
|
+
throw new Error(error ?? "Failed to parse rule");
|
|
36
|
+
}
|
|
37
|
+
const groups = new Map();
|
|
38
|
+
const groupFor = (graphTerm) => {
|
|
39
|
+
const graph = graphTerm && isIriTerm(graphTerm) ? termToSparql(graphTerm) : undefined;
|
|
40
|
+
const existing = groups.get(graph ?? "");
|
|
41
|
+
if (existing)
|
|
42
|
+
return existing;
|
|
43
|
+
const created = { graph, predicates: new Set(), classes: new Set() };
|
|
44
|
+
groups.set(graph ?? "", created);
|
|
45
|
+
return created;
|
|
46
|
+
};
|
|
47
|
+
for (const atom of ast.head) {
|
|
48
|
+
match(atom)
|
|
49
|
+
.with({ type: "property" }, (propertyAtom) => groupFor(propertyAtom.graph).predicates.add(propertyAtom.predicate))
|
|
50
|
+
.with({ type: "general" }, (generalAtom) => groupFor().predicates.add(generalAtom.tableName))
|
|
51
|
+
.with({ type: "class" }, (classAtom) => groupFor(classAtom.graph).classes.add(classAtom.className))
|
|
52
|
+
.with({ type: "triple" }, (tripleAtom) => {
|
|
53
|
+
if (!isIriTerm(tripleAtom.predicate))
|
|
54
|
+
return;
|
|
55
|
+
const group = groupFor(tripleAtom.graph);
|
|
56
|
+
const predicate = termToSparql(tripleAtom.predicate);
|
|
57
|
+
if (predicate === "rdf:type" && isIriTerm(tripleAtom.object)) {
|
|
58
|
+
group.classes.add(termToSparql(tripleAtom.object));
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
group.predicates.add(predicate);
|
|
62
|
+
}
|
|
63
|
+
})
|
|
64
|
+
.exhaustive();
|
|
65
|
+
}
|
|
66
|
+
return [...groups.values()].map(({ graph, predicates, classes }) => ({
|
|
67
|
+
graph,
|
|
68
|
+
predicates: [...predicates],
|
|
69
|
+
classes: [...classes],
|
|
70
|
+
}));
|
|
71
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { BindingsPreview, type BindingsPreviewProps } from "./components/datalog-editor/BindingsPreview.js";
|
|
2
|
+
export { FactsPreview, type FactsPreviewProps } from "./components/datalog-editor/FactsPreview.js";
|
|
3
|
+
export { PreviewPanel, type PreviewPanelProps } from "./components/datalog-editor/PreviewPanel.js";
|
|
4
|
+
export { SparqlQueryPanel, type SparqlQueryPanelProps } from "./components/datalog-editor/SparqlQueryPanel.js";
|
|
5
|
+
export { useSparqlQueryExecution, type SparqlQueryResult } from "./hooks/useSparqlQueryExecution.js";
|
|
6
|
+
//# sourceMappingURL=datalog-editor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"datalog-editor.d.ts","sourceRoot":"","sources":["../../../src/routes/rules/datalog-editor.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAE,KAAK,oBAAoB,EAAE,MAAM,6CAA6C,CAAC;AACzG,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAChG,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,0CAA0C,CAAC;AAChG,OAAO,EAAE,gBAAgB,EAAE,KAAK,qBAAqB,EAAE,MAAM,8CAA8C,CAAC;AAC5G,OAAO,EAAE,uBAAuB,EAAE,KAAK,iBAAiB,EAAE,MAAM,iCAAiC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// The panels around the Datalog editor, which hold no CodeMirror of their own. The editor that
|
|
2
|
+
// composes them stays in `agents` with the CodeMirror stack.
|
|
3
|
+
export { BindingsPreview } from "./components/datalog-editor/BindingsPreview.js";
|
|
4
|
+
export { FactsPreview } from "./components/datalog-editor/FactsPreview.js";
|
|
5
|
+
export { PreviewPanel } from "./components/datalog-editor/PreviewPanel.js";
|
|
6
|
+
export { SparqlQueryPanel } from "./components/datalog-editor/SparqlQueryPanel.js";
|
|
7
|
+
export { useSparqlQueryExecution } from "./hooks/useSparqlQueryExecution.js";
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { GraphQLClient } from "graphql-request";
|
|
2
|
+
type Triple = {
|
|
3
|
+
subject: string;
|
|
4
|
+
predicate: string;
|
|
5
|
+
object: string;
|
|
6
|
+
};
|
|
7
|
+
type UseRuleFactsPreviewOptions = {
|
|
8
|
+
rule: string;
|
|
9
|
+
graphqlClient?: GraphQLClient;
|
|
10
|
+
prefixes?: Record<string, string>;
|
|
11
|
+
enabled?: boolean;
|
|
12
|
+
sampleLimit?: number;
|
|
13
|
+
};
|
|
14
|
+
type UseRuleFactsPreviewResult = {
|
|
15
|
+
factCount: number | null;
|
|
16
|
+
samples: Triple[] | null;
|
|
17
|
+
isLoadingCount: boolean;
|
|
18
|
+
isLoadingSamples: boolean;
|
|
19
|
+
error: string | null;
|
|
20
|
+
};
|
|
21
|
+
export declare function useRuleFactsPreview(options: UseRuleFactsPreviewOptions): UseRuleFactsPreviewResult;
|
|
22
|
+
export type PropertyAtom = {
|
|
23
|
+
type: "property";
|
|
24
|
+
predicate: {
|
|
25
|
+
value: string;
|
|
26
|
+
};
|
|
27
|
+
arguments: Array<{
|
|
28
|
+
value: string;
|
|
29
|
+
}>;
|
|
30
|
+
};
|
|
31
|
+
export type ClassAtom = {
|
|
32
|
+
type: "class";
|
|
33
|
+
predicate: {
|
|
34
|
+
value: string;
|
|
35
|
+
};
|
|
36
|
+
arguments: Array<{
|
|
37
|
+
value: string;
|
|
38
|
+
}>;
|
|
39
|
+
};
|
|
40
|
+
export type TripleAtom = {
|
|
41
|
+
type: "triple";
|
|
42
|
+
subject: {
|
|
43
|
+
value: string;
|
|
44
|
+
};
|
|
45
|
+
predicate: {
|
|
46
|
+
value: string;
|
|
47
|
+
};
|
|
48
|
+
object: {
|
|
49
|
+
value: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
export {};
|
|
53
|
+
//# sourceMappingURL=useRuleFactsPreview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useRuleFactsPreview.d.ts","sourceRoot":"","sources":["../../../../src/routes/rules/hooks/useRuleFactsPreview.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAIrD,KAAK,MAAM,GAAG;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,KAAK,0BAA0B,GAAG;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAkBF,KAAK,yBAAyB,GAAG;IAC/B,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACzB,cAAc,EAAE,OAAO,CAAC;IACxB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,0BAA0B,GAAG,yBAAyB,CA+HlG;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,UAAU,CAAC;IACjB,SAAS,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC7B,SAAS,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,IAAI,EAAE,OAAO,CAAC;IACd,SAAS,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC7B,SAAS,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,QAAQ,CAAC;IACf,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC3B,SAAS,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAC7B,MAAM,EAAE;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;CAC3B,CAAC"}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { useSparqlQueryQuery } from "@manta-eu/client";
|
|
2
|
+
import { formatIriForRdfox, compactUri, namespaces } from "@manta-eu/client/shared/rdf-namespaces";
|
|
3
|
+
import { isJsonLdNode } from "@manta-eu/client/types/jsonld";
|
|
4
|
+
import { parseDatalogRule, datalogBodyToSparqlSelect } from "@manta-eu/datalog-parser";
|
|
5
|
+
import { isPresent } from "@manta-eu/lib/present";
|
|
6
|
+
import { useState, useEffect, useMemo } from "react";
|
|
7
|
+
import { match } from "ts-pattern";
|
|
8
|
+
function sparqlConstructQuery(args) {
|
|
9
|
+
const { constructPatterns, sampleLimit, whereClause } = args;
|
|
10
|
+
return `CONSTRUCT { ${constructPatterns} } WHERE { ${whereClause} }} LIMIT ${sampleLimit}`;
|
|
11
|
+
}
|
|
12
|
+
function sparqlCountQuery(args) {
|
|
13
|
+
const { sparql, whereClause } = args;
|
|
14
|
+
return `SELECT (COUNT(*) as ?count)
|
|
15
|
+
WHERE {
|
|
16
|
+
SELECT DISTINCT ${sparql.variables.map((v) => `?${v}`).join(" ")}
|
|
17
|
+
WHERE {
|
|
18
|
+
${whereClause}
|
|
19
|
+
}
|
|
20
|
+
}`;
|
|
21
|
+
}
|
|
22
|
+
export function useRuleFactsPreview(options) {
|
|
23
|
+
const { rule, graphqlClient, prefixes = namespaces, enabled = true, sampleLimit = 10 } = options;
|
|
24
|
+
const [factCount, setFactCount] = useState(null);
|
|
25
|
+
const [samples, setSamples] = useState(null);
|
|
26
|
+
const [isLoadingCount, setIsLoadingCount] = useState(false);
|
|
27
|
+
const [isLoadingSamples, setIsLoadingSamples] = useState(false);
|
|
28
|
+
const [error, setError] = useState(null);
|
|
29
|
+
const [currentCountQuery, setCurrentCountQuery] = useState(null);
|
|
30
|
+
const [currentSampleQuery, setCurrentSampleQuery] = useState(null);
|
|
31
|
+
const { constructQuery, countQuery, parseError } = useMemo(() => {
|
|
32
|
+
if (!rule || !enabled) {
|
|
33
|
+
return { constructQuery: null, countQuery: null, parseError: null };
|
|
34
|
+
}
|
|
35
|
+
try {
|
|
36
|
+
const ast = parseDatalogRule(rule);
|
|
37
|
+
if (!isPresent(ast.head) || !isPresent(ast.body)) {
|
|
38
|
+
return { constructQuery: null, countQuery: null, parseError: null };
|
|
39
|
+
}
|
|
40
|
+
const sparqlSelect = datalogBodyToSparqlSelect(ast.body, prefixes);
|
|
41
|
+
const whereStartIndex = sparqlSelect.query.indexOf("WHERE {");
|
|
42
|
+
const whereEndIndex = sparqlSelect.query.lastIndexOf("}");
|
|
43
|
+
const whereClause = whereStartIndex !== -1 && whereEndIndex > whereStartIndex
|
|
44
|
+
? sparqlSelect.query.substring(whereStartIndex + 7, whereEndIndex).trim()
|
|
45
|
+
: "";
|
|
46
|
+
const constructPatterns = ast.head
|
|
47
|
+
.map((atom) => {
|
|
48
|
+
return generateTriplePattern(atom);
|
|
49
|
+
})
|
|
50
|
+
.filter(Boolean)
|
|
51
|
+
.join(" .\n ");
|
|
52
|
+
const query = sparqlConstructQuery({ constructPatterns, sampleLimit, whereClause });
|
|
53
|
+
const countQuery = sparqlCountQuery({ sparql: sparqlSelect, whereClause });
|
|
54
|
+
return { constructQuery: query, countQuery, parseError: null };
|
|
55
|
+
}
|
|
56
|
+
catch (e) {
|
|
57
|
+
const errorMessage = e instanceof Error ? e.message : "Failed to generate queries";
|
|
58
|
+
return { constructQuery: null, countQuery: null, parseError: errorMessage };
|
|
59
|
+
}
|
|
60
|
+
}, [rule, enabled, prefixes, sampleLimit]);
|
|
61
|
+
useEffect(() => {
|
|
62
|
+
if (parseError) {
|
|
63
|
+
setError(parseError);
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
setError(null);
|
|
67
|
+
}
|
|
68
|
+
}, [parseError]);
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
setCurrentCountQuery(countQuery);
|
|
71
|
+
}, [countQuery]);
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
setCurrentSampleQuery(constructQuery);
|
|
74
|
+
}, [constructQuery]);
|
|
75
|
+
const countQueryResult = useSparqlQueryQuery(graphqlClient, { query: currentCountQuery || "" }, {
|
|
76
|
+
enabled: Boolean(currentCountQuery && graphqlClient && enabled),
|
|
77
|
+
});
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
setIsLoadingCount(countQueryResult.isLoading);
|
|
80
|
+
if (countQueryResult.error) {
|
|
81
|
+
setError(countQueryResult.error instanceof Error ? countQueryResult.error.message : "Failed to count facts");
|
|
82
|
+
setFactCount(null);
|
|
83
|
+
}
|
|
84
|
+
else if (countQueryResult.data?.sparqlQuery) {
|
|
85
|
+
const result = countQueryResult.data.sparqlQuery;
|
|
86
|
+
if (result.error) {
|
|
87
|
+
setError(result.error);
|
|
88
|
+
setFactCount(null);
|
|
89
|
+
}
|
|
90
|
+
else if (result.results) {
|
|
91
|
+
const bindings = result.results.results?.bindings || [];
|
|
92
|
+
const countBinding = bindings[0] && typeof bindings[0] === "object" && "count" in bindings[0]
|
|
93
|
+
? bindings[0].count
|
|
94
|
+
: undefined;
|
|
95
|
+
const count = countBinding ? parseInt(countBinding.value, 10) : 0;
|
|
96
|
+
setFactCount(count);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}, [countQueryResult]);
|
|
100
|
+
const sampleQueryResult = useSparqlQueryQuery(graphqlClient, { query: currentSampleQuery || "" }, {
|
|
101
|
+
enabled: Boolean(currentSampleQuery && graphqlClient && enabled && factCount && factCount > 0),
|
|
102
|
+
});
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
setIsLoadingSamples(sampleQueryResult.isLoading);
|
|
105
|
+
if (!sampleQueryResult.data?.sparqlQuery || factCount === 0 || factCount === null) {
|
|
106
|
+
setSamples(null);
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
const result = sampleQueryResult.data.sparqlQuery;
|
|
110
|
+
if (result.error) {
|
|
111
|
+
setSamples(null);
|
|
112
|
+
}
|
|
113
|
+
else if (result.graph) {
|
|
114
|
+
const triples = parseGraphToTriples(result.graph);
|
|
115
|
+
setSamples(triples);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}, [sampleQueryResult, factCount, prefixes]);
|
|
119
|
+
return {
|
|
120
|
+
factCount,
|
|
121
|
+
samples,
|
|
122
|
+
isLoadingCount,
|
|
123
|
+
isLoadingSamples,
|
|
124
|
+
error,
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
function isPropertyAtom(atom) {
|
|
128
|
+
return (atom.type === "property" &&
|
|
129
|
+
"predicate" in atom &&
|
|
130
|
+
"arguments" in atom &&
|
|
131
|
+
typeof atom.predicate === "object" &&
|
|
132
|
+
atom.predicate !== null &&
|
|
133
|
+
"value" in atom.predicate &&
|
|
134
|
+
Array.isArray(atom.arguments));
|
|
135
|
+
}
|
|
136
|
+
function isClassAtom(atom) {
|
|
137
|
+
return (atom.type === "class" &&
|
|
138
|
+
"predicate" in atom &&
|
|
139
|
+
"arguments" in atom &&
|
|
140
|
+
typeof atom.predicate === "object" &&
|
|
141
|
+
atom.predicate !== null &&
|
|
142
|
+
"value" in atom.predicate &&
|
|
143
|
+
Array.isArray(atom.arguments));
|
|
144
|
+
}
|
|
145
|
+
function isTripleAtom(atom) {
|
|
146
|
+
return (atom.type === "triple" &&
|
|
147
|
+
"subject" in atom &&
|
|
148
|
+
"predicate" in atom &&
|
|
149
|
+
"object" in atom &&
|
|
150
|
+
typeof atom.subject === "object" &&
|
|
151
|
+
atom.subject !== null &&
|
|
152
|
+
"value" in atom.subject &&
|
|
153
|
+
typeof atom.predicate === "object" &&
|
|
154
|
+
atom.predicate !== null &&
|
|
155
|
+
"value" in atom.predicate &&
|
|
156
|
+
typeof atom.object === "object" &&
|
|
157
|
+
atom.object !== null &&
|
|
158
|
+
"value" in atom.object);
|
|
159
|
+
}
|
|
160
|
+
function generateTriplePattern(atom) {
|
|
161
|
+
return match(atom.type)
|
|
162
|
+
.with("property", () => {
|
|
163
|
+
if (!isPropertyAtom(atom))
|
|
164
|
+
return null;
|
|
165
|
+
const subject = atom.arguments[0]?.value || "?s";
|
|
166
|
+
const predicate = formatIriForRdfox(atom.predicate.value || "");
|
|
167
|
+
const object = atom.arguments[1]?.value || "?o";
|
|
168
|
+
return `${subject} ${predicate} ${object}`;
|
|
169
|
+
})
|
|
170
|
+
.with("class", () => {
|
|
171
|
+
if (!isClassAtom(atom))
|
|
172
|
+
return null;
|
|
173
|
+
const subject = atom.arguments[0]?.value || "?s";
|
|
174
|
+
const classIRI = formatIriForRdfox(atom.predicate.value || "");
|
|
175
|
+
return `${subject} a ${classIRI}`;
|
|
176
|
+
})
|
|
177
|
+
.with("triple", () => {
|
|
178
|
+
if (!isTripleAtom(atom))
|
|
179
|
+
return null;
|
|
180
|
+
const subject = atom.subject.value || "?s";
|
|
181
|
+
const predicate = formatIriForRdfox(atom.predicate.value || "");
|
|
182
|
+
const object = atom.object.value || "?o";
|
|
183
|
+
return `${subject} ${predicate} ${object}`;
|
|
184
|
+
})
|
|
185
|
+
.otherwise(() => null);
|
|
186
|
+
}
|
|
187
|
+
function parseGraphToTriples(graph) {
|
|
188
|
+
const triples = [];
|
|
189
|
+
if (!Array.isArray(graph))
|
|
190
|
+
return triples;
|
|
191
|
+
for (const node of graph) {
|
|
192
|
+
if (!isJsonLdNode(node))
|
|
193
|
+
continue;
|
|
194
|
+
const subject = compactUri(String(node["@id"] || ""));
|
|
195
|
+
for (const [key, value] of Object.entries(node)) {
|
|
196
|
+
if (key === "@id")
|
|
197
|
+
continue;
|
|
198
|
+
const predicate = key === "@type" ? "a" : compactUri(key);
|
|
199
|
+
if (Array.isArray(value)) {
|
|
200
|
+
for (const v of value) {
|
|
201
|
+
const object = typeof v === "object" && v !== null && "@id" in v ? compactUri(String(v["@id"])) : String(v);
|
|
202
|
+
triples.push({ subject, predicate, object });
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
else if (value) {
|
|
206
|
+
const object = typeof value === "object" && value !== null && "@id" in value
|
|
207
|
+
? compactUri(String(value["@id"]))
|
|
208
|
+
: String(value);
|
|
209
|
+
triples.push({ subject, predicate, object });
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
return triples;
|
|
214
|
+
}
|