cli
benchmark(profile_name=typer.Option(..., '--profile', '-p', help='Profile name or path to YAML file'), golden=typer.Option(..., '--golden', help='Path to the golden corpus directory (must contain ground_truth.yaml)'), fail_below_f1=typer.Option(0.85, '--fail-below-f1', help='Exit non-zero when F1 drops below this threshold (0.0–1.0)'))
¶
Re-extract a golden corpus and compare against ground truth for quality regression.
Loads ground truth triples from <golden>/ground_truth.yaml, re-extracts
the corpus using the current pipeline, and computes precision, recall, and F1.
Exits with code 1 when F1 < --fail-below-f1. Designed for use in CI.
Example::
riverbank benchmark \
--profile docs-policy-v1 \
--golden tests/golden/docs-policy-v1 \
--fail-below-f1 0.85
Source code in src/riverbank/cli.py
3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 | |
build_knowledge_context(profile_name=typer.Option(..., '--profile', '-p', help='Profile name or path to profile YAML file'), fragment=typer.Option(..., '--fragment', help='Fragment text to build the knowledge context for'), graph=typer.Option('http://riverbank.example/graph/trusted', '--graph', help='Named graph IRI to query for context'))
¶
Preview the KNOWN GRAPH CONTEXT block that would be injected for a fragment.
Queries the graph for entities mentioned in the fragment text and renders the structured context block that would be prepended to the extraction prompt. Useful for diagnosing knowledge-prefix adapter behaviour.
Example::
riverbank build-knowledge-context \
--profile docs-policy-v1 \
--fragment "The Sesam pipe connects to the Salesforce source."
Source code in src/riverbank/cli.py
3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 | |
clear_graph(graph=typer.Option(None, '--graph', '-g', help='Named graph IRI to clear (e.g. http://riverbank.example/graph/trusted). Omit to clear ALL graphs.'), yes=typer.Option(False, '--yes', '-y', help='Skip confirmation prompt.'))
¶
Delete all triples from a named graph (or every graph).
Source code in src/riverbank/cli.py
config()
¶
Show the current configuration (resolved from env and config.toml).
Source code in src/riverbank/cli.py
deduplicate_entities(named_graph=typer.Option('http://riverbank.example/graph/trusted', '--graph', '-g', help='Named graph IRI to deduplicate'), threshold=typer.Option(0.92, '--threshold', '-t', help='Cosine-similarity threshold for merging entities (0.0–1.0)'), model=typer.Option('all-MiniLM-L6-v2', '--model', '-m', help='sentence-transformers model name for embedding entity labels'), dry_run=typer.Option(False, '--dry-run', help='Compute clusters but do not write owl:sameAs triples'))
¶
Post-1: Embed entity labels and write owl:sameAs links for duplicates.
Queries the named graph for all unique entity IRIs, embeds their labels
using sentence-transformers, clusters by cosine similarity, and promotes
the shortest IRI in each cluster as canonical. Alias IRIs are written
back to the graph as owl:sameAs links.
Use --dry-run to inspect clusters without modifying the graph.
Requires sentence-transformers (pip install 'riverbank[ingest]').
Source code in src/riverbank/cli.py
2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 | |
detect_contradictions(profile_name=typer.Argument(..., help='Profile name or path to YAML file'), named_graph=typer.Option('http://riverbank.example/graph/trusted', '--graph', '-g', help='Named graph to inspect for contradictions'), tentative_graph=typer.Option('http://riverbank.example/graph/tentative', '--tentative-graph', help='Tentative graph where demoted triples are moved'), dry_run=typer.Option(False, '--dry-run', help='Detect conflicts but do not apply penalties or move triples'))
¶
Detect and demote contradicting triples for functional predicates.
For each predicate annotated with max_cardinality: 1 in the profile's
predicate_constraints block, finds subjects with more than one distinct
object value. Reduces confidence of conflicting triples by 30%; demotes
below-threshold triples to the tentative graph. Writes pgc:ConflictRecord
provenance records.
Example::
riverbank detect-contradictions docs-policy-v1 --dry-run
Source code in src/riverbank/cli.py
2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 | |
download_models(models=typer.Argument(None, help='Model names to download (e.g. all-MiniLM-L6-v2). Defaults to all built-in models.'), cache_dir=typer.Option(None, '--cache-dir', help='Override the Hugging Face cache directory (default: ~/.cache/huggingface/hub/).'), quiet=typer.Option(False, '--quiet', '-q', help='Suppress progress output.'))
¶
Pre-download sentence-transformer embedding models to the local cache.
Running this once prevents the HF Hub rate-limit warning and makes subsequent 'riverbank ingest' calls fully offline (no network needed).
By default downloads every model riverbank uses internally:
• all-MiniLM-L6-v2 — semantic chunking (SemanticFragmenter)
The models are stored under ~/.cache/huggingface/hub/ (or $HF_HOME if set). Set --cache-dir to override the location.
Source code in src/riverbank/cli.py
entities_list(named_graph=typer.Option('http://riverbank.example/graph/trusted', '--graph', '-g', help='Named graph to list entities from'), limit=typer.Option(50, '--limit', '-n', help='Maximum number of entities to show'))
¶
List entities in the registry with their synonym rings.
Displays all entity IRIs, labels, types, and known surface-form variants
(skos:altLabel synonym rings).
Example::
riverbank entities list --graph http://riverbank.example/graph/trusted
Source code in src/riverbank/cli.py
2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 | |
entities_merge(entity=typer.Option(..., '--entity', help='IRI of the entity to merge FROM'), into=typer.Option(..., '--into', help='IRI of the canonical entity to merge INTO'), named_graph=typer.Option('http://riverbank.example/graph/trusted', '--graph', '-g', help='Named graph to operate on'), dry_run=typer.Option(False, '--dry-run', help='Preview the merge without writing changes'))
¶
Merge one entity into another, writing a skos:altLabel for the alias.
Rewrites all triples that reference the FROM entity to use the INTO entity
IRI, and writes a skos:altLabel for the old label.
Example::
riverbank entities merge \
--entity ex:dataset \
--into ex:Dataset \
--graph http://riverbank.example/graph/trusted
Source code in src/riverbank/cli.py
2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 | |
evaluate_wikidata(article=typer.Option(None, '--article', '-a', help='Evaluate a single Wikipedia article. Accepts an article title, Wikipedia URL, or Wikidata Q-id.'), dataset=typer.Option(None, '--dataset', '-d', help='Path to a benchmark dataset YAML file (batch mode).'), profile_name=typer.Option('wikidata-eval-v1', '--profile', '-p', help='Compiler profile name or path to YAML file.'), output=typer.Option('eval/results/latest.json', '--output', '-o', help='Path to write the JSON evaluation report.'), no_cache=typer.Option(False, '--no-cache', help='Bypass local article cache; always fetch fresh from Wikipedia API.'), cache_only=typer.Option(False, '--cache-only', help='Use only cached articles; raise an error if the article is not cached.'), sample=typer.Option(None, '--sample', help='Evaluate only the first N articles from a dataset (useful for smoke tests).'), parallel=typer.Option(4, '--parallel', help='Number of articles to evaluate in parallel (batch mode only).'), verbose=typer.Option(False, '--verbose', '-v', help='Print per-article results as they are computed.'), set_overrides=typer.Option([], '--set', help='Override a config key at runtime, e.g. --set llm.provider=ollama (repeatable)'))
¶
Evaluate riverbank extraction quality against Wikidata ground truth.
Single article: riverbank evaluate-wikidata --article "Marie Curie" riverbank evaluate-wikidata --article "https://en.wikipedia.org/wiki/Marie_Curie" riverbank evaluate-wikidata --article Q7186
Batch over benchmark dataset: riverbank evaluate-wikidata \ --dataset eval/wikidata-benchmark-1k.yaml \ --profile wikidata-eval-v1 \ --output eval/results/v0.15.0-baseline.json \ --parallel 8
The evaluation pipeline: 1. Fetch Wikipedia article as Markdown (hybrid cache: ~/.riverbank/article_cache/) 2. Ingest the article via riverbank's extraction pipeline 3. Fetch the corresponding Wikidata item via SPARQL 4. Score extracted triples against Wikidata statements (precision/recall/F1) 5. Compute confidence calibration (Pearson ρ) and novel discovery rate 6. Write a JSON report to --output
Results are stored locally in eval/results/ and never committed to the repo.
Use --no-cache to always fetch fresh from Wikipedia. Use --cache-only for fully offline evaluation (all articles must be cached).
Source code in src/riverbank/cli.py
3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 | |
expand_few_shot(profile_name=typer.Option(..., '--profile', '-p', help='Profile name or path to profile YAML file'), graph=typer.Option('http://riverbank.example/graph/trusted', '--graph', help='Named graph IRI to sample high-confidence triples from'), cq_coverage=typer.Option(0.75, '--cq-coverage', help='CQ coverage fraction from the last ingest run (0.0–1.0)'), dry_run=typer.Option(False, '--dry-run', help='Compute candidates but do not write to the bank file'))
¶
Auto-expand the few-shot example bank with high-confidence triples.
Samples high-confidence triples from the named graph that satisfy competency questions, then appends diverse examples to the profile's auto-expansion JSONL bank. Capped at 15 examples per run to prevent the bank from growing monotonically.
Only runs when --cq-coverage meets or exceeds the profile's
few_shot.auto_expand_cq_threshold (default 0.70).
Example::
riverbank expand-few-shot --profile docs-policy-v1 --cq-coverage 0.82
Source code in src/riverbank/cli.py
3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 | |
explain(artifact_iri=typer.Argument(..., help='IRI of the compiled artifact to inspect'))
¶
Dump the dependency tree of a compiled artifact.
Shows which fragments, profile version, and rule set contributed to the
named artifact. The artifact IRI is typically the subject of a triple in
the knowledge graph (e.g. entity:Acme).
Example::
riverbank explain entity:Acme
Source code in src/riverbank/cli.py
explain_conflict(iri=typer.Argument(..., help='IRI of the entity or fact to explain conflicts for'), named_graph=typer.Option('http://riverbank.example/graph/trusted', '--graph', '-g', help='Named graph IRI to search for contradictions'))
¶
Explain contradictions for an entity or fact.
A CLI wrapper around pg_ripple.explain_contradiction() — the
minimal-cause reasoning engine (SAT-style hitting-set over the inference
dependency graph) lives in pg-ripple and requires no Python implementation
in riverbank.
Falls back gracefully when pg_ripple.explain_contradiction() is not
yet available (deferred per roadmap mitigation policy).
Example::
riverbank explain-conflict entity:Acme
Source code in src/riverbank/cli.py
explain_rejections(profile=typer.Option(None, '--profile', '-p', help='Filter by profile name'), since=typer.Option('1h', '--since', '-s', help='Show rejections from the last duration (e.g. 1h, 30m, 7d)'), limit=typer.Option(100, '--limit', '-n', help='Maximum rejections to display'))
¶
Show triples discarded in recent extraction runs, grouped by rejection reason.
Reports triples that were silently discarded during extraction — evidence span not found, confidence below noise floor, ontology mismatch, or safety cap. Use this to diagnose which implied facts the pipeline is losing and to improve your extraction profile.
Example::
riverbank explain-rejections --profile docs-policy-v1 --since 1h
Source code in src/riverbank/cli.py
1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 | |
federation_compile(name=typer.Argument(..., help='Name of the federation endpoint to pull from'), local_graph=typer.Option('http://riverbank.example/graph/trusted', '--local-graph', help='Local named graph to write triples into'), limit=typer.Option(1000, '--limit', '-n', help='Maximum triples to fetch'))
¶
Pull triples from a remote pg_ripple endpoint and write them locally.
Example::
riverbank federation compile peer-alpha --limit 500
Source code in src/riverbank/cli.py
federation_register(name=typer.Argument(..., help='Logical name for this endpoint'), sparql_url=typer.Argument(..., help='Remote SPARQL endpoint URL'), remote_graph=typer.Option('http://riverbank.example/graph/trusted', '--remote-graph', help='Remote named graph IRI'), weight=typer.Option(0.8, '--weight', '-w', help='Confidence weight [0.0–1.0]'), timeout=typer.Option(30, '--timeout', help='Query timeout in seconds'))
¶
Register a remote pg_ripple SPARQL endpoint for federated compilation.
Example::
riverbank federation register peer-alpha https://peer.example.com/sparql
Source code in src/riverbank/cli.py
gc_tentative(tentative_graph=typer.Option('http://riverbank.example/graph/tentative', '--graph', '-g', help='IRI of the tentative graph to clean up'), older_than=typer.Option('30d', '--older-than', help='Archive triples older than this duration (e.g. 30d, 7d, 48h)'), dry_run=typer.Option(False, '--dry-run', help='Identify stale triples but do not archive them'), limit=typer.Option(1000, '--limit', '-n', help='Maximum number of triples to process per run'))
¶
Archive stale tentative triples that were never promoted.
Tentative triples that were extracted but never promoted to the trusted
graph and whose pgc:firstSeen timestamp is older than --older-than
are moved to the _riverbank.log archive table.
Run periodically (or automatically after each ingest) to prevent the tentative graph from growing indefinitely.
Example::
# Preview what would be archived
riverbank gc-tentative --older-than 30d --dry-run
# Archive stale triples
riverbank gc-tentative --older-than 30d
Source code in src/riverbank/cli.py
3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 | |
health()
¶
Run health checks against the full extension stack.
Calls pgtrickle.preflight() (7 system checks) and pg_ripple.pg_tide_available() to verify pg-tide is wired correctly.
Source code in src/riverbank/cli.py
induce_schema(named_graph=typer.Option('http://riverbank.example/graph/trusted', '--graph', '-g', help='Named graph to analyse for schema induction'), output=typer.Option('ontology/induced.ttl', '--output', '-o', help='Output path for the induced Turtle ontology'), profile_name=typer.Option('', '--profile', '-p', help='Profile name or YAML path (optional; updates allowed_predicates/classes if given)'), top_predicates=typer.Option(20, '--top-predicates', help='Maximum number of predicates to include in the LLM prompt'), top_types=typer.Option(10, '--top-types', help='Maximum number of entity types to include in the LLM prompt'))
¶
Cold-start schema induction: propose an OWL ontology from graph statistics.
Collects unique predicates and entity types from the graph, asks the LLM
to propose a minimal OWL ontology, and writes it to --output for human
review.
After reviewing and editing ontology/induced.ttl, run a second ingest
pass with the induced ontology loaded into the profile's
allowed_predicates and allowed_classes blocks.
Example::
riverbank induce-schema \
--graph http://riverbank.example/graph/trusted \
--output ontology/induced.ttl
Source code in src/riverbank/cli.py
2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 | |
ingest(corpus=typer.Argument(..., help='Path to a corpus directory or file'), profile_name=typer.Option('default', '--profile', '-p', help='Compiler profile name or YAML file path'), dry_run=typer.Option(False, '--dry-run', help='Parse and fragment only; skip extraction and graph writes'), mode=typer.Option('full', '--mode', '-m', help='Extraction mode: full | vocabulary'), set_overrides=typer.Option([], '--set', help='Override a config key at runtime, e.g. --set llm.provider=ollama (repeatable)'), force=typer.Option(False, '--force', '-f', help='Force re-extraction of fragments even if unchanged (skips hash-based deduplication)'))
¶
Ingest a document corpus into the knowledge graph.
Discovers Markdown files under CORPUS, fragments each file at heading boundaries, applies the editorial policy gate, extracts triples (using the extractor declared in the profile), and writes them to pg_ripple with confidence scores and provenance edges.
Unchanged fragments (same xxh3_128 hash) are skipped automatically — re-ingesting an unchanged corpus produces zero LLM calls.
Use --mode vocabulary to run the vocabulary pass only (extracts
skos:Concept triples into the <vocab> named graph). The profile
field run_mode_sequence: ['vocabulary', 'full'] runs both passes
automatically.
Source code in src/riverbank/cli.py
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 | |
init()
¶
Initialise the _riverbank schema by running Alembic migrations.
Also activates the built-in pg:skos-integrity shape bundle via
pg_ripple.load_shape_bundle('skos-integrity') (pg-ripple ≥ 0.98.0).
The six SKOS structural shapes are defined in pg-ripple; riverbank ships
no Turtle files for them.
Source code in src/riverbank/cli.py
lint(named_graph=typer.Option('http://riverbank.example/graph/trusted', '--graph', '-g', help='Named graph IRI to validate'), shacl_only=typer.Option(False, '--shacl-only', help='Run SHACL quality report only (no other lint checks)'), threshold=typer.Option(0.7, '--threshold', '-t', help='Minimum acceptable SHACL score [0.0–1.0]'), layer=typer.Option('', '--layer', '-l', help="Lint layer: '' (default SHACL) | 'vocab' (SKOS integrity on <vocab> graph)"))
¶
Run a SHACL quality report against a named graph.
With --shacl-only (the standard v0.3.0 invocation) this is a thin
wrapper around pg_ripple.shacl_score(). Exits non-zero if the score
falls below the profile threshold.
With --layer vocab this runs the pg:skos-integrity shape bundle
against the <vocab> named graph and reports any violations.
Example::
riverbank lint --shacl-only --graph http://riverbank.example/graph/trusted
riverbank lint --layer vocab
Source code in src/riverbank/cli.py
875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 | |
normalize_predicates(named_graph=typer.Option('http://riverbank.example/graph/trusted', '--graph', '-g', help='Named graph to normalize predicates in'), threshold=typer.Option(0.88, '--threshold', help='Cosine-similarity threshold for predicate clustering (0.0–1.0)'), rewrite=typer.Option(False, '--rewrite', help='Rewrite existing triples to use canonical predicate IRIs (in addition to equivalentProperty)'), dry_run=typer.Option(False, '--dry-run', help='Show clusters without writing owl:equivalentProperty triples'))
¶
Cluster near-duplicate predicates and write owl:equivalentProperty links.
Embeds predicate labels using sentence-transformers and clusters predicates
by cosine similarity. Within each cluster the most-frequent predicate is
promoted as canonical; non-canonical predicates receive
owl:equivalentProperty links.
Use --rewrite to also rewrite existing triples to the canonical form.
Example::
riverbank normalize-predicates --graph http://riverbank.example/graph/trusted --dry-run
Source code in src/riverbank/cli.py
2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 | |
profile_register(yaml_path=typer.Argument(..., help='Path to the profile YAML file'))
¶
Register a compiler profile from a YAML file into the catalog.
The profile is upserted by (name, version). If the same name+version already exists the existing row is left unchanged.
Source code in src/riverbank/cli.py
promote_tentative(tentative_graph=typer.Option('http://riverbank.example/graph/tentative', '--tentative-graph', '-t', help='IRI of the tentative named graph to read from'), trusted_graph=typer.Option('http://riverbank.example/graph/trusted', '--trusted-graph', '-g', help='IRI of the trusted named graph to promote into'), threshold=typer.Option(0.75, '--threshold', help='Consolidated confidence threshold for promotion (0.0–1.0)'), dry_run=typer.Option(False, '--dry-run', help='Show triples that would be promoted without modifying the graph'), limit=typer.Option(500, '--limit', '-n', help='Maximum tentative triples to consider per run'))
¶
Promote tentative triples whose consolidated confidence crosses the trusted threshold.
Reads all triples from the tentative graph and applies noisy-OR confidence consolidation with source diversity scoring. Triples whose consolidated confidence reaches --threshold are promoted to the trusted graph and a pgc:PromotionEvent provenance record is written.
Promotion is NEVER automatic — always review with --dry-run first.
Example::
# Preview promotions
riverbank promote-tentative --dry-run
# Apply promotions
riverbank promote-tentative
Source code in src/riverbank/cli.py
1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 | |
query(sparql=typer.Argument(..., help='SPARQL SELECT or ASK query string'), named_graph=typer.Option(None, '--graph', '-g', help='Restrict query to this named graph IRI'), output_format=typer.Option('table', '--format', '-f', help='Output format: table | json | csv'), expand=typer.Option(None, '--expand', '-e', help='Comma-separated seed terms to expand via the <thesaurus> named graph before querying'), include_tentative=typer.Option(False, '--include-tentative', help='Union trusted + tentative graphs; results ordered by confidence descending'))
¶
Execute a SPARQL SELECT or ASK query against the compiled knowledge graph.
Routes the query through pg_ripple.sparql(). Falls back with a warning when pg_ripple is not installed.
With --expand term1,term2 the terms are looked up in the
<thesaurus> named graph (skos:altLabel, skos:related,
skos:exactMatch, skos:closeMatch) and the expanded synonym set is
logged before the query is dispatched.
With --include-tentative the trusted and tentative graphs are unioned
and results are ordered by confidence descending. Use this for discovery.
Source code in src/riverbank/cli.py
567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 | |
recall_gap_analysis(results=typer.Option(..., '--results', '-r', help='Path to a DatasetResult JSON file.'), threshold=typer.Option(0.5, '--threshold', '-t', help='Recall threshold below which a property is flagged.'), output=typer.Option('', '--output', '-o', help='Path for the JSON output report. Defaults to eval/results/recall-gaps.json.'))
¶
Identify Wikidata properties with recall below --threshold and generate extraction examples.
Reads a DatasetResult JSON file produced by riverbank evaluate-wikidata
and outputs a recall gap report with targeted extraction examples for each
low-recall property.
Examples::
riverbank recall-gap-analysis --results eval/results/latest.json
riverbank recall-gap-analysis --results eval/results/latest.json \
--threshold 0.40 --output eval/results/recall-gaps.json
Source code in src/riverbank/cli.py
4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 | |
recompile(profile=typer.Option(..., '--profile', '-p', help='Profile name to recompile all sources for'), version=typer.Option(1, '--version', '-v', help='Profile version'), dry_run=typer.Option(False, '--dry-run', help='Queue sources without re-extracting; print the semantic diff report only'), limit=typer.Option(0, '--limit', '-n', help='Maximum sources to recompile (0 = all)'))
¶
Bulk reprocess all sources compiled by an older profile version.
Queues all sources that were compiled by profile/version for
recompilation, re-runs extraction, and produces a semantic diff report
showing which triples were added, removed, or unchanged.
Example::
riverbank recompile --profile docs-policy-v1 --version 2
Source code in src/riverbank/cli.py
1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 | |
render(entity_iri=typer.Argument(..., help='IRI of the entity or topic to render'), output_format=typer.Option('markdown', '--format', '-f', help='Output format: markdown | jsonld | html'), target_dir=typer.Option('docs/', '--target', '-t', help='Directory to write rendered pages into'), named_graph=typer.Option('http://riverbank.example/graph/trusted', '--graph', '-g', help='Source named graph IRI'), persist=typer.Option(True, '--persist/--no-persist', help='Write pgc:RenderedPage artifact back to the graph'))
¶
Render an entity page from the compiled knowledge graph.
Fetches all facts about ENTITY_IRI from the named graph and renders them as Markdown (Obsidian/MkDocs), JSON-LD, or HTML. The output file is written to TARGET_DIR.
Rendered pages are stored as pgc:RenderedPage artifacts with
dependency edges to their source facts so that stale pages can be
detected when facts change.
Example::
riverbank render http://example.org/entity/Acme --format markdown --target docs/
riverbank render http://example.org/topic/HA --format jsonld
Source code in src/riverbank/cli.py
1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 | |
reset_database(yes=typer.Option(False, '--yes', '-y', help='Skip confirmation prompt.'))
¶
Reset the entire database: clear all graphs and fragment metadata.
Use this to force a complete re-ingest from scratch (all fragments will be processed again, LLM called for each).
Deletes: - All named graphs and triples - All fragment metadata (hashes, content) - All source metadata
Source code in src/riverbank/cli.py
review_collect(profile_name=typer.Option('default', '--profile', '-p', help='Profile name (used to resolve the example bank path)'), label_studio_url=typer.Option('http://localhost:8080', '--ls-url', help='Label Studio URL'), label_studio_key=typer.Option('', '--ls-key', help='Label Studio API key'), project_id=typer.Option(0, '--ls-project', help='Label Studio project ID'), write_to_graph=typer.Option(True, '--write/--no-write', help='Write accepted/corrected decisions to the <human-review> named graph'))
¶
Collect completed review decisions from Label Studio.
Fetches annotated tasks, writes corrections into the <human-review>
named graph, and exports each accepted/corrected decision to the profile's
few-shot example bank.
Example::
riverbank review collect --profile docs-policy-v1
Source code in src/riverbank/cli.py
2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 | |
review_queue(named_graph=typer.Option('http://riverbank.example/graph/trusted', '--graph', '-g', help='Named graph to scan for low-confidence extractions'), limit=typer.Option(50, '--limit', '-n', help='Maximum number of items to add to the review queue'), dry_run=typer.Option(False, '--dry-run', help='Print candidate items without submitting to Label Studio'), label_studio_url=typer.Option('http://localhost:8080', '--ls-url', help='Label Studio URL'), label_studio_key=typer.Option('', '--ls-key', help='Label Studio API key'), project_id=typer.Option(0, '--ls-project', help='Label Studio project ID (0 = auto-create)'))
¶
Run the active-learning review queue.
Queries the knowledge graph for the limit extractions with the lowest confidence scores (centrality × uncertainty ranking), submits each as a Label Studio task, and refreshes task priorities.
Use --dry-run to inspect candidates without touching Label Studio.
Example::
riverbank review queue --graph http://riverbank.example/graph/trusted --limit 20
Source code in src/riverbank/cli.py
1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 | |
run_construct_rules(profile_name=typer.Option(..., '--profile', '-p', help='Profile name or path to YAML file'), graph=typer.Option('http://riverbank.example/graph/trusted', '--graph', help='Named graph IRI to run rules against'), dry_run=typer.Option(False, '--dry-run', help='Execute queries but do not write inferred triples'))
¶
Execute SPARQL CONSTRUCT rules and write inferred triples to graph/inferred.
Reads CONSTRUCT rules from the profile's construct_rules list and runs
each query against the named graph, writing results to
<http://riverbank.example/graph/inferred>.
Example::
riverbank run-construct-rules --profile docs-policy-v1
Source code in src/riverbank/cli.py
3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 | |
run_owl_rl(profile_name=typer.Option(..., '--profile', '-p', help='Profile name or path to YAML file'), graph=typer.Option('http://riverbank.example/graph/trusted', '--graph', help='Named graph IRI to reason over'), max_triples=typer.Option(5000, '--max-triples', help='Cap on inferred triples (0 = unlimited)'), dry_run=typer.Option(False, '--dry-run', help='Compute the closure but do not write inferred triples'))
¶
Apply OWL 2 RL forward-chaining rules and write inferred triples.
Loads the named graph into an in-memory rdflib Graph, applies owlrl OWL 2
RL deductive closure (owl:inverseOf, rdfs:subClassOf transitivity,
domain/range type assertions, owl:TransitiveProperty), then writes newly
derived triples to <http://riverbank.example/graph/inferred>.
Requires: pip install 'riverbank[reasoning]'
Example::
riverbank run-owl-rl --profile docs-policy-v1 --graph http://riverbank.example/graph/trusted
Source code in src/riverbank/cli.py
3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 | |
runs(since=typer.Option('24h', '--since', '-s', help='Show runs since this duration (e.g. 1h, 30m, 7d)'), profile=typer.Option(None, '--profile', '-p', help='Filter by profile name'), limit=typer.Option(50, '--limit', '-n', help='Maximum rows to return'))
¶
Inspect recent compiler runs with outcome, token counts, and Langfuse links.
Shows one row per run with: source IRI, fragment key, profile, outcome, prompt/completion tokens, cost (USD), and Langfuse trace deep-link.
Source code in src/riverbank/cli.py
663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 | |
sbom(output=typer.Option('riverbank-sbom.json', '--output', '-o', help='Path to write the SBOM file'), output_format=typer.Option('json', '--format', '-f', help='Output format: json (default) | xml'), no_audit=typer.Option(False, '--no-audit', help='Skip the pip-audit CVE scan (produce SBOM only)'))
¶
Generate a CycloneDX SBOM for the installed riverbank package.
Uses cyclonedx-py (installed via pip install riverbank[sbom]) to
produce a machine-readable Software Bill of Materials. After generating
the SBOM, pip-audit is run to check all dependencies for known CVEs;
the command exits non-zero if any vulnerability is found.
Output formats:
json(default) — CycloneDX JSON 1.6xml— CycloneDX XML 1.6
Example::
riverbank sbom
riverbank sbom --output sbom.xml --format xml
riverbank sbom --no-audit
Source code in src/riverbank/cli.py
2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 | |
source_set_profile(source_iri=typer.Argument(..., help='Source IRI to update'), profile_name=typer.Argument(..., help='Profile name to associate'), profile_version=typer.Option(1, '--version', '-v', help='Profile version'))
¶
Associate a registered source with a compiler profile.
Updates the profile_id column in _riverbank.sources for the given
source IRI. The profile must already be registered (use
riverbank profile register).
Source code in src/riverbank/cli.py
tenant_activate_rls()
¶
Enable Row-Level Security on all _riverbank catalog tables.
Activates the tenant_id RLS policies scaffolded in v0.4.0 (migration
0002). Safe to call multiple times — idempotent.
Example::
riverbank tenant activate-rls
Source code in src/riverbank/cli.py
tenant_create(tenant_id=typer.Argument(..., help='Unique tenant slug (alphanumeric, hyphens, underscores)'), display_name=typer.Option('', '--name', '-n', help='Human-readable name'), label_studio_org=typer.Option(0, '--ls-org', help='Label Studio organisation ID'))
¶
Create a new tenant.
Example::
riverbank tenant create acme --name "Acme Corp" --ls-org 42
Source code in src/riverbank/cli.py
tenant_delete(tenant_id=typer.Argument(..., help='Tenant slug to delete'), gdpr=typer.Option(False, '--gdpr', help='GDPR erasure: also delete all tenant data rows'))
¶
Delete a tenant (soft-delete by default; --gdpr erases all data rows).
Example::
riverbank tenant delete acme
riverbank tenant delete acme --gdpr
Source code in src/riverbank/cli.py
tenant_list()
¶
List all registered tenants.
Example::
riverbank tenant list
Source code in src/riverbank/cli.py
tenant_suspend(tenant_id=typer.Argument(..., help='Tenant slug to suspend'))
¶
Suspend a tenant (all tenant-scoped operations will be blocked by RLS).
Example::
riverbank tenant suspend acme
Source code in src/riverbank/cli.py
tune_extraction_prompts(results=typer.Option(..., '--results', '-r', help='Path to a DatasetResult JSON file.'), output=typer.Option('', '--output', '-o', help='Path for the JSON tuning report. Defaults to eval/results/tuning-report.json.'), fp_min_frequency=typer.Option(2, '--fp-min', help='Minimum FP frequency to report a pattern.'), fn_min_frequency=typer.Option(2, '--fn-min', help='Minimum FN frequency to flag a property.'))
¶
Analyse evaluation failures and generate targeted extraction prompt patches.
Reads a DatasetResult JSON report and identifies:
- False-positive patterns — predicates systematically over-extracted
- False-negative patterns — Wikidata properties consistently missed
- Prompt patches — concrete instructions and few-shot examples to add
Examples::
riverbank tune-extraction-prompts --results eval/results/latest.json
riverbank tune-extraction-prompts --results eval/results/latest.json \
--output eval/results/tuning-report.json --fn-min 3
Source code in src/riverbank/cli.py
4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 | |
validate_graph(profile_name=typer.Option('default', '--profile', '-p', help='Compiler profile name or YAML file path'), named_graph=typer.Option(None, '--graph', '-g', help='Named graph IRI to validate against (defaults to profile named_graph)'), fail_below=typer.Option(0.0, '--fail-below', help='Exit with code 1 if coverage fraction is below this threshold (0.0–1.0)'))
¶
Run the profile's competency questions against the compiled graph and report coverage.
Reads the competency_questions list from the compiler profile (SPARQL ASK
queries) and executes each one. Prints a results table and a coverage score.
Use --fail-below 1.0 to fail CI unless all questions pass.
Source code in src/riverbank/cli.py
2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 | |
validate_shapes(profile_name=typer.Option(..., '--profile', '-p', help='Profile name or path to YAML file'), graph=typer.Option('http://riverbank.example/graph/trusted', '--graph', help='Named graph IRI to validate'), shapes=typer.Option('', '--shapes', help='Path to SHACL shapes Turtle file (default: ontology/pgc-shapes.ttl)'), dry_run=typer.Option(False, '--dry-run', help='Report violations but do not write confidence updates'))
¶
Validate a named graph against SHACL shapes and report violations.
Loads the named graph from pg_ripple, validates it against the shapes
graph, and prints a violation report. Optionally reduces the confidence
of violating triples when shacl_validation.reduce_confidence: true is
set in the profile.
Requires: pip install 'riverbank[reasoning]'
Example::
riverbank validate-shapes --profile docs-policy-v1 --graph http://riverbank.example/graph/trusted
Source code in src/riverbank/cli.py
3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 | |
verify_triples(profile_name=typer.Option('default', '--profile', '-p', help='Compiler profile name or YAML file path'), named_graph=typer.Option(None, '--graph', '-g', help='Named graph IRI to verify (defaults to profile named_graph)'), dry_run=typer.Option(False, '--dry-run', help='Compute verification outcomes but do not modify the graph'))
¶
Post-2: Re-evaluate low-confidence triples with a self-critique LLM call.
Reads verification: config from the compiler profile. For each triple
below confidence_threshold, asks the LLM whether the claim is supported
by the stored evidence excerpt. Confirmed triples with high verifier
confidence are boosted; rejected triples are moved to the quarantine
(<draft>) named graph for human review.
Verification must be enabled in the profile::
verification:
enabled: true
confidence_threshold: 0.75
drop_below: 0.4
boost_above: 0.8
Use --dry-run to inspect outcomes without modifying the graph.
Requires instructor + openai (pip install 'riverbank[ingest]').
Source code in src/riverbank/cli.py
2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 | |