prograph 1.3.3__py3-none-any.whl
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.
- prograph/__init__.py +36 -0
- prograph/__main__.py +5 -0
- prograph/_version.py +375 -0
- prograph/cli/__init__.py +1 -0
- prograph/cli/_iri_utils.py +124 -0
- prograph/cli/emit_genie_space.py +107 -0
- prograph/cli/generate_views.py +140 -0
- prograph/cli/main.py +420 -0
- prograph/cli/schema_inferrer.py +746 -0
- prograph/cli/ttl_loader.py +289 -0
- prograph/cli/upload_genie_space.py +84 -0
- prograph/config/__init__.py +27 -0
- prograph/config/yaml_config.py +848 -0
- prograph/demos/__init__.py +14 -0
- prograph/demos/turbofan/README.md +74 -0
- prograph/demos/turbofan/SCENARIO.md +209 -0
- prograph/demos/turbofan/__init__.py +75 -0
- prograph/demos/turbofan/create_tables.sql +206 -0
- prograph/demos/turbofan/data/engine-instances.ttl +1123 -0
- prograph/demos/turbofan/data/sensor-timeseries.csv +90 -0
- prograph/demos/turbofan/demo.py +162 -0
- prograph/demos/turbofan/genie_qa_notebook.py +434 -0
- prograph/demos/turbofan/graph.yaml +1098 -0
- prograph/demos/turbofan/instance_graph_demo.py +32 -0
- prograph/demos/turbofan/load.py +223 -0
- prograph/demos/turbofan/mapping.r2rml.ttl +991 -0
- prograph/demos/turbofan/ontology/engine-maintenance.ttl +606 -0
- prograph/demos/turbofan/payload-shapes.ttl +33 -0
- prograph/demos/turbofan/queries/example-queries.sparql +215 -0
- prograph/demos/turbofan/shapes.ttl +75 -0
- prograph/demos/turbofan/tables.py +106 -0
- prograph/demos/turbofan/turbofan_schema.py +393 -0
- prograph/demos/turbofan/validation_demo.py +153 -0
- prograph/describe.py +231 -0
- prograph/endpoint/__init__.py +12 -0
- prograph/endpoint/app.py +722 -0
- prograph/endpoint/cli.py +280 -0
- prograph/endpoint/credentials.py +240 -0
- prograph/endpoint/engines.py +418 -0
- prograph/endpoint/negotiate.py +101 -0
- prograph/endpoint/results.py +181 -0
- prograph/endpoint/service.py +31 -0
- prograph/engine.py +2718 -0
- prograph/execution.py +455 -0
- prograph/executors/__init__.py +6 -0
- prograph/executors/base.py +11 -0
- prograph/executors/databricks_sql_executor.py +51 -0
- prograph/executors/duckdb_executor.py +24 -0
- prograph/executors/mysql_executor.py +20 -0
- prograph/executors/oracle_executor.py +24 -0
- prograph/executors/pandas_executor.py +72 -0
- prograph/executors/postgresql_executor.py +35 -0
- prograph/executors/spark_executor.py +88 -0
- prograph/executors/sqlserver_executor.py +35 -0
- prograph/extras/__init__.py +1 -0
- prograph/extras/graphql/__init__.py +33 -0
- prograph/extras/graphql/execute.py +25 -0
- prograph/extras/graphql/schema.py +314 -0
- prograph/extras/instance_graph.py +559 -0
- prograph/genie/__init__.py +83 -0
- prograph/genie/databricks_uploader.py +306 -0
- prograph/genie/deploy.py +393 -0
- prograph/genie/formats.py +414 -0
- prograph/genie/instruction_generator.py +375 -0
- prograph/genie/sample_query_generator.py +256 -0
- prograph/genie/shacl_views.py +318 -0
- prograph/genie/space_emitter.py +329 -0
- prograph/genie/view_generator.py +628 -0
- prograph/genie/view_writer.py +172 -0
- prograph/graph/__init__.py +1 -0
- prograph/graph/ansi_session.py +348 -0
- prograph/graph/databricks_sql_graph.py +300 -0
- prograph/graph/drivers.py +143 -0
- prograph/graph/duckdb_graph.py +68 -0
- prograph/graph/mysql_graph.py +38 -0
- prograph/graph/oracle_graph.py +285 -0
- prograph/graph/pandas_graph.py +343 -0
- prograph/graph/postgresql_graph.py +644 -0
- prograph/graph/spark_graph.py +556 -0
- prograph/graph/sql_graph.py +83 -0
- prograph/graph/sqlserver_graph.py +72 -0
- prograph/hints.py +95 -0
- prograph/logging.py +550 -0
- prograph/mcp/__init__.py +29 -0
- prograph/mcp/__main__.py +180 -0
- prograph/mcp/bootstrap.py +98 -0
- prograph/mcp/server.py +601 -0
- prograph/mcp/sparql.py +397 -0
- prograph/mcp/tools.py +504 -0
- prograph/nlp/__init__.py +79 -0
- prograph/nlp/client.py +305 -0
- prograph/nlp/databricks_tools.py +369 -0
- prograph/nlp/graph_context.py +313 -0
- prograph/nlp/interface.py +652 -0
- prograph/nlp/prompts/__init__.py +19 -0
- prograph/nlp/prompts/examples.py +258 -0
- prograph/nlp/prompts/system.py +239 -0
- prograph/nlp/providers/__init__.py +14 -0
- prograph/nlp/providers/anthropic.py +274 -0
- prograph/nlp/providers/databricks.py +312 -0
- prograph/nlp/providers/openai.py +203 -0
- prograph/nlp/schema_context.py +78 -0
- prograph/ontology/__init__.py +53 -0
- prograph/ontology/alignment.py +542 -0
- prograph/ontology/hierarchy.py +310 -0
- prograph/ontology/imports.py +587 -0
- prograph/ontology/layer.py +991 -0
- prograph/ontology/skos.py +61 -0
- prograph/owl/__init__.py +27 -0
- prograph/owl/defined_classes.py +323 -0
- prograph/parameters.py +242 -0
- prograph/parser/__init__.py +1 -0
- prograph/parser/cypher/CypherLexer.py +836 -0
- prograph/parser/cypher/CypherListener.py +966 -0
- prograph/parser/cypher/CypherParser.py +10854 -0
- prograph/parser/cypher/CypherVisitor.py +543 -0
- prograph/parser/cypher/__init__.py +1 -0
- prograph/parser/sparql/SparqlLexer.py +801 -0
- prograph/parser/sparql/SparqlParser.py +10146 -0
- prograph/parser/sparql/SparqlParserListener.py +1056 -0
- prograph/parser/sparql/SparqlParserVisitor.py +593 -0
- prograph/parser/sparql/__init__.py +8 -0
- prograph/plan/__init__.py +3 -0
- prograph/plan/ir/__init__.py +1 -0
- prograph/plan/ir/casts.py +338 -0
- prograph/plan/ir/consistency.py +397 -0
- prograph/plan/ir/construct.py +90 -0
- prograph/plan/ir/cost.py +234 -0
- prograph/plan/ir/cypher_answer.py +1081 -0
- prograph/plan/ir/cypher_apoc.py +717 -0
- prograph/plan/ir/cypher_apoc_convert.py +505 -0
- prograph/plan/ir/cypher_apoc_date.py +845 -0
- prograph/plan/ir/cypher_apoc_map.py +496 -0
- prograph/plan/ir/cypher_apoc_meta.py +384 -0
- prograph/plan/ir/cypher_apoc_path.py +597 -0
- prograph/plan/ir/cypher_apoc_procedures.py +163 -0
- prograph/plan/ir/cypher_apoc_text.py +785 -0
- prograph/plan/ir/cypher_front.py +5474 -0
- prograph/plan/ir/cypher_functions.py +565 -0
- prograph/plan/ir/cypher_lists.py +935 -0
- prograph/plan/ir/cypher_maps.py +370 -0
- prograph/plan/ir/cypher_mixed.py +604 -0
- prograph/plan/ir/cypher_ontology.py +226 -0
- prograph/plan/ir/cypher_procedures.py +191 -0
- prograph/plan/ir/cypher_runtime_errors.py +107 -0
- prograph/plan/ir/cypher_temporal.py +1357 -0
- prograph/plan/ir/cypher_temporal_arith.py +339 -0
- prograph/plan/ir/cypher_values.py +546 -0
- prograph/plan/ir/cypher_write.py +612 -0
- prograph/plan/ir/dataset.py +643 -0
- prograph/plan/ir/dates.py +102 -0
- prograph/plan/ir/entry.py +992 -0
- prograph/plan/ir/expr.py +260 -0
- prograph/plan/ir/facts.py +1171 -0
- prograph/plan/ir/fresh.py +291 -0
- prograph/plan/ir/freshness.py +625 -0
- prograph/plan/ir/identity.py +797 -0
- prograph/plan/ir/java_datetime.py +265 -0
- prograph/plan/ir/java_regex.py +391 -0
- prograph/plan/ir/join_order.py +39 -0
- prograph/plan/ir/key_checks.py +433 -0
- prograph/plan/ir/keys.py +454 -0
- prograph/plan/ir/lower.py +5323 -0
- prograph/plan/ir/ops.py +619 -0
- prograph/plan/ir/owl_rl.py +1119 -0
- prograph/plan/ir/owl_rl_rules.py +725 -0
- prograph/plan/ir/profiles.py +694 -0
- prograph/plan/ir/ql.py +987 -0
- prograph/plan/ir/rdfs.py +342 -0
- prograph/plan/ir/rewrite.py +1782 -0
- prograph/plan/ir/saturate.py +339 -0
- prograph/plan/ir/semantics.py +103 -0
- prograph/plan/ir/slot.py +509 -0
- prograph/plan/ir/sparql_front.py +3418 -0
- prograph/plan/ir/strings.py +534 -0
- prograph/plan/ir/term_functions.py +274 -0
- prograph/plan/ir/terms.py +84 -0
- prograph/plan/ir/xpath_regex.py +264 -0
- prograph/plan/run_record.py +65 -0
- prograph/plan/sql/__init__.py +21 -0
- prograph/plan/sql/dialect.py +3726 -0
- prograph/plan/sql/mysql_serializer.py +103 -0
- prograph/plan/sql/names.py +65 -0
- prograph/plan/sql/oracle_serializer.py +306 -0
- prograph/plan/sql/pg_serializer.py +501 -0
- prograph/plan/sql/rel_algebra.py +781 -0
- prograph/plan/sql/sql_serializer.py +1419 -0
- prograph/plan/sql/sqlserver_serializer.py +603 -0
- prograph/provenance.py +222 -0
- prograph/r2rml/__init__.py +48 -0
- prograph/r2rml/catalog.py +259 -0
- prograph/r2rml/compile.py +372 -0
- prograph/r2rml/direct.py +140 -0
- prograph/r2rml/export.py +495 -0
- prograph/r2rml/model.py +180 -0
- prograph/r2rml/parser.py +546 -0
- prograph/r2rml/schema.py +120 -0
- prograph/read_only.py +122 -0
- prograph/results.py +157 -0
- prograph/rules/__init__.py +168 -0
- prograph/rules/__main__.py +32 -0
- prograph/schema/__init__.py +60 -0
- prograph/schema/change_set.py +50 -0
- prograph/schema/collations.py +198 -0
- prograph/schema/compile_schema.py +388 -0
- prograph/schema/context.py +845 -0
- prograph/schema/examples.py +234 -0
- prograph/schema/iri.py +817 -0
- prograph/schema/literals.py +94 -0
- prograph/schema/lpg_view.py +617 -0
- prograph/schema/mapping.py +1803 -0
- prograph/schema/maps_schema.py +40 -0
- prograph/schema/naming.py +77 -0
- prograph/schema/query_sources.py +59 -0
- prograph/schema/rows.py +215 -0
- prograph/schema/source_map.py +1103 -0
- prograph/schema/store_view.py +459 -0
- prograph/schema/types.py +569 -0
- prograph/schema/xsd.py +569 -0
- prograph/shacl/__init__.py +30 -0
- prograph/shacl/dqv.py +58 -0
- prograph/shacl/generate.py +255 -0
- prograph/shacl/report.py +138 -0
- prograph/shacl/validator.py +164 -0
- prograph/store.py +1737 -0
- prograph/utils/__init__.py +6 -0
- prograph/utils/exceptions.py +308 -0
- prograph/utils/helpers.py +126 -0
- prograph/warnings.py +46 -0
- prograph/writes.py +369 -0
- prograph-1.3.3.dist-info/METADATA +281 -0
- prograph-1.3.3.dist-info/RECORD +237 -0
- prograph-1.3.3.dist-info/WHEEL +5 -0
- prograph-1.3.3.dist-info/entry_points.txt +3 -0
- prograph-1.3.3.dist-info/licenses/LICENSE +201 -0
- prograph-1.3.3.dist-info/licenses/NOTICE +10 -0
- prograph-1.3.3.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
engine_serial,sensor_id,sensor_type,timestamp,value,unit,nominal_min,nominal_max,caution_threshold,warning_threshold,critical_threshold
|
|
2
|
+
ESN-1001,EGT-1001,temperature,2025-11-20T08:00:00Z,598.0,°C,400.0,620.0,645.0,670.0,700.0
|
|
3
|
+
ESN-1001,EGT-1001,temperature,2025-11-27T08:00:00Z,600.0,°C,400.0,620.0,645.0,670.0,700.0
|
|
4
|
+
ESN-1001,EGT-1001,temperature,2025-12-04T08:00:00Z,603.0,°C,400.0,620.0,645.0,670.0,700.0
|
|
5
|
+
ESN-1001,EGT-1001,temperature,2025-12-11T08:00:00Z,607.0,°C,400.0,620.0,645.0,670.0,700.0
|
|
6
|
+
ESN-1001,EGT-1001,temperature,2025-12-18T08:00:00Z,610.0,°C,400.0,620.0,645.0,670.0,700.0
|
|
7
|
+
ESN-1001,EGT-1001,temperature,2025-12-25T08:00:00Z,612.0,°C,400.0,620.0,645.0,670.0,700.0
|
|
8
|
+
ESN-1001,EGT-1001,temperature,2026-01-01T08:00:00Z,615.0,°C,400.0,620.0,645.0,670.0,700.0
|
|
9
|
+
ESN-1001,EGT-1001,temperature,2026-01-08T08:00:00Z,616.0,°C,400.0,620.0,645.0,670.0,700.0
|
|
10
|
+
ESN-1001,EGT-1001,temperature,2026-01-15T08:00:00Z,618.0,°C,400.0,620.0,645.0,670.0,700.0
|
|
11
|
+
ESN-1001,EGT-1001,temperature,2026-01-22T08:00:00Z,625.0,°C,400.0,620.0,645.0,670.0,700.0
|
|
12
|
+
ESN-1001,EGT-1001,temperature,2026-01-29T08:00:00Z,634.0,°C,400.0,620.0,645.0,670.0,700.0
|
|
13
|
+
ESN-1001,EGT-1001,temperature,2026-02-05T08:00:00Z,641.0,°C,400.0,620.0,645.0,670.0,700.0
|
|
14
|
+
ESN-1001,EGT-1001,temperature,2026-02-12T08:00:00Z,649.0,°C,400.0,620.0,645.0,670.0,700.0
|
|
15
|
+
ESN-1001,VIB-BRG3-1001,vibration,2025-11-20T08:00:00Z,1.2,mm/s,0.0,1.5,2.5,4.0,5.5
|
|
16
|
+
ESN-1001,VIB-BRG3-1001,vibration,2025-11-27T08:00:00Z,1.2,mm/s,0.0,1.5,2.5,4.0,5.5
|
|
17
|
+
ESN-1001,VIB-BRG3-1001,vibration,2025-12-04T08:00:00Z,1.3,mm/s,0.0,1.5,2.5,4.0,5.5
|
|
18
|
+
ESN-1001,VIB-BRG3-1001,vibration,2025-12-11T08:00:00Z,1.4,mm/s,0.0,1.5,2.5,4.0,5.5
|
|
19
|
+
ESN-1001,VIB-BRG3-1001,vibration,2025-12-18T08:00:00Z,1.5,mm/s,0.0,1.5,2.5,4.0,5.5
|
|
20
|
+
ESN-1001,VIB-BRG3-1001,vibration,2025-12-25T08:00:00Z,1.6,mm/s,0.0,1.5,2.5,4.0,5.5
|
|
21
|
+
ESN-1001,VIB-BRG3-1001,vibration,2026-01-01T08:00:00Z,1.7,mm/s,0.0,1.5,2.5,4.0,5.5
|
|
22
|
+
ESN-1001,VIB-BRG3-1001,vibration,2026-01-08T08:00:00Z,1.8,mm/s,0.0,1.5,2.5,4.0,5.5
|
|
23
|
+
ESN-1001,VIB-BRG3-1001,vibration,2026-01-15T08:00:00Z,1.8,mm/s,0.0,1.5,2.5,4.0,5.5
|
|
24
|
+
ESN-1001,VIB-BRG3-1001,vibration,2026-01-22T08:00:00Z,2.1,mm/s,0.0,1.5,2.5,4.0,5.5
|
|
25
|
+
ESN-1001,VIB-BRG3-1001,vibration,2026-01-29T08:00:00Z,2.6,mm/s,0.0,1.5,2.5,4.0,5.5
|
|
26
|
+
ESN-1001,VIB-BRG3-1001,vibration,2026-02-05T08:00:00Z,3.2,mm/s,0.0,1.5,2.5,4.0,5.5
|
|
27
|
+
ESN-1001,VIB-BRG3-1001,vibration,2026-02-12T08:00:00Z,3.8,mm/s,0.0,1.5,2.5,4.0,5.5
|
|
28
|
+
ESN-1001,ODM-1001,oil_debris,2025-11-20T08:00:00Z,2.0,ppm,0.0,5.0,12.0,25.0,50.0
|
|
29
|
+
ESN-1001,ODM-1001,oil_debris,2025-11-27T08:00:00Z,2.0,ppm,0.0,5.0,12.0,25.0,50.0
|
|
30
|
+
ESN-1001,ODM-1001,oil_debris,2025-12-04T08:00:00Z,2.5,ppm,0.0,5.0,12.0,25.0,50.0
|
|
31
|
+
ESN-1001,ODM-1001,oil_debris,2025-12-11T08:00:00Z,3.0,ppm,0.0,5.0,12.0,25.0,50.0
|
|
32
|
+
ESN-1001,ODM-1001,oil_debris,2025-12-18T08:00:00Z,3.0,ppm,0.0,5.0,12.0,25.0,50.0
|
|
33
|
+
ESN-1001,ODM-1001,oil_debris,2025-12-25T08:00:00Z,3.5,ppm,0.0,5.0,12.0,25.0,50.0
|
|
34
|
+
ESN-1001,ODM-1001,oil_debris,2026-01-01T08:00:00Z,4.0,ppm,0.0,5.0,12.0,25.0,50.0
|
|
35
|
+
ESN-1001,ODM-1001,oil_debris,2026-01-08T08:00:00Z,4.0,ppm,0.0,5.0,12.0,25.0,50.0
|
|
36
|
+
ESN-1001,ODM-1001,oil_debris,2026-01-15T08:00:00Z,4.0,ppm,0.0,5.0,12.0,25.0,50.0
|
|
37
|
+
ESN-1001,ODM-1001,oil_debris,2026-01-22T08:00:00Z,7.0,ppm,0.0,5.0,12.0,25.0,50.0
|
|
38
|
+
ESN-1001,ODM-1001,oil_debris,2026-01-29T08:00:00Z,11.0,ppm,0.0,5.0,12.0,25.0,50.0
|
|
39
|
+
ESN-1001,ODM-1001,oil_debris,2026-02-05T08:00:00Z,18.0,ppm,0.0,5.0,12.0,25.0,50.0
|
|
40
|
+
ESN-1001,ODM-1001,oil_debris,2026-02-12T08:00:00Z,28.0,ppm,0.0,5.0,12.0,25.0,50.0
|
|
41
|
+
ESN-1001,PR-HPC-1001,pressure_ratio,2025-11-20T08:00:00Z,25.8,ratio,22.0,28.0,20.5,19.0,17.0
|
|
42
|
+
ESN-1001,PR-HPC-1001,pressure_ratio,2025-11-27T08:00:00Z,25.7,ratio,22.0,28.0,20.5,19.0,17.0
|
|
43
|
+
ESN-1001,PR-HPC-1001,pressure_ratio,2025-12-04T08:00:00Z,25.5,ratio,22.0,28.0,20.5,19.0,17.0
|
|
44
|
+
ESN-1001,PR-HPC-1001,pressure_ratio,2025-12-11T08:00:00Z,25.3,ratio,22.0,28.0,20.5,19.0,17.0
|
|
45
|
+
ESN-1001,PR-HPC-1001,pressure_ratio,2025-12-18T08:00:00Z,25.1,ratio,22.0,28.0,20.5,19.0,17.0
|
|
46
|
+
ESN-1001,PR-HPC-1001,pressure_ratio,2025-12-25T08:00:00Z,24.8,ratio,22.0,28.0,20.5,19.0,17.0
|
|
47
|
+
ESN-1001,PR-HPC-1001,pressure_ratio,2026-01-01T08:00:00Z,24.5,ratio,22.0,28.0,20.5,19.0,17.0
|
|
48
|
+
ESN-1001,PR-HPC-1001,pressure_ratio,2026-01-08T08:00:00Z,24.3,ratio,22.0,28.0,20.5,19.0,17.0
|
|
49
|
+
ESN-1001,PR-HPC-1001,pressure_ratio,2026-01-15T08:00:00Z,24.1,ratio,22.0,28.0,20.5,19.0,17.0
|
|
50
|
+
ESN-1001,PR-HPC-1001,pressure_ratio,2026-01-22T08:00:00Z,23.6,ratio,22.0,28.0,20.5,19.0,17.0
|
|
51
|
+
ESN-1001,PR-HPC-1001,pressure_ratio,2026-01-29T08:00:00Z,23.0,ratio,22.0,28.0,20.5,19.0,17.0
|
|
52
|
+
ESN-1001,PR-HPC-1001,pressure_ratio,2026-02-05T08:00:00Z,22.2,ratio,22.0,28.0,20.5,19.0,17.0
|
|
53
|
+
ESN-1001,PR-HPC-1001,pressure_ratio,2026-02-12T08:00:00Z,21.3,ratio,22.0,28.0,20.5,19.0,17.0
|
|
54
|
+
ESN-1001,OILT-1001,temperature,2025-11-20T08:00:00Z,115.0,°C,60.0,130.0,145.0,160.0,175.0
|
|
55
|
+
ESN-1001,OILT-1001,temperature,2025-12-04T08:00:00Z,116.0,°C,60.0,130.0,145.0,160.0,175.0
|
|
56
|
+
ESN-1001,OILT-1001,temperature,2025-12-18T08:00:00Z,118.0,°C,60.0,130.0,145.0,160.0,175.0
|
|
57
|
+
ESN-1001,OILT-1001,temperature,2026-01-01T08:00:00Z,120.0,°C,60.0,130.0,145.0,160.0,175.0
|
|
58
|
+
ESN-1001,OILT-1001,temperature,2026-01-15T08:00:00Z,122.0,°C,60.0,130.0,145.0,160.0,175.0
|
|
59
|
+
ESN-1001,OILT-1001,temperature,2026-01-29T08:00:00Z,128.0,°C,60.0,130.0,145.0,160.0,175.0
|
|
60
|
+
ESN-1001,OILT-1001,temperature,2026-02-12T08:00:00Z,138.0,°C,60.0,130.0,145.0,160.0,175.0
|
|
61
|
+
ESN-1001,VIB-HPC-1001,vibration,2025-11-20T08:00:00Z,2.2,mm/s,0.0,3.0,4.0,6.0,8.0
|
|
62
|
+
ESN-1001,VIB-HPC-1001,vibration,2025-12-04T08:00:00Z,2.3,mm/s,0.0,3.0,4.0,6.0,8.0
|
|
63
|
+
ESN-1001,VIB-HPC-1001,vibration,2025-12-18T08:00:00Z,2.5,mm/s,0.0,3.0,4.0,6.0,8.0
|
|
64
|
+
ESN-1001,VIB-HPC-1001,vibration,2026-01-01T08:00:00Z,2.7,mm/s,0.0,3.0,4.0,6.0,8.0
|
|
65
|
+
ESN-1001,VIB-HPC-1001,vibration,2026-01-15T08:00:00Z,2.8,mm/s,0.0,3.0,4.0,6.0,8.0
|
|
66
|
+
ESN-1001,VIB-HPC-1001,vibration,2026-01-29T08:00:00Z,3.5,mm/s,0.0,3.0,4.0,6.0,8.0
|
|
67
|
+
ESN-1001,VIB-HPC-1001,vibration,2026-02-12T08:00:00Z,4.2,mm/s,0.0,3.0,4.0,6.0,8.0
|
|
68
|
+
ESN-1001,VIB-HPT-1001,vibration,2025-11-20T08:00:00Z,2.0,mm/s,0.0,3.0,4.5,6.5,8.5
|
|
69
|
+
ESN-1001,VIB-HPT-1001,vibration,2025-12-18T08:00:00Z,2.2,mm/s,0.0,3.0,4.5,6.5,8.5
|
|
70
|
+
ESN-1001,VIB-HPT-1001,vibration,2026-01-15T08:00:00Z,2.5,mm/s,0.0,3.0,4.5,6.5,8.5
|
|
71
|
+
ESN-1001,VIB-HPT-1001,vibration,2026-02-05T08:00:00Z,3.0,mm/s,0.0,3.0,4.5,6.5,8.5
|
|
72
|
+
ESN-1001,VIB-HPT-1001,vibration,2026-02-12T08:00:00Z,3.3,mm/s,0.0,3.0,4.5,6.5,8.5
|
|
73
|
+
ESN-1001,FF-1001,fuel_flow,2025-11-20T08:00:00Z,1850.0,kg/h,800.0,2400.0,,,
|
|
74
|
+
ESN-1001,FF-1001,fuel_flow,2025-12-18T08:00:00Z,1870.0,kg/h,800.0,2400.0,,,
|
|
75
|
+
ESN-1001,FF-1001,fuel_flow,2026-01-15T08:00:00Z,1910.0,kg/h,800.0,2400.0,,,
|
|
76
|
+
ESN-1001,FF-1001,fuel_flow,2026-02-12T08:00:00Z,1965.0,kg/h,800.0,2400.0,,,
|
|
77
|
+
ESN-1001,VIB-FAN-1001,vibration,2025-11-20T08:00:00Z,1.1,mm/s,0.0,2.5,3.5,5.0,7.0
|
|
78
|
+
ESN-1001,VIB-FAN-1001,vibration,2025-12-18T08:00:00Z,1.1,mm/s,0.0,2.5,3.5,5.0,7.0
|
|
79
|
+
ESN-1001,VIB-FAN-1001,vibration,2026-01-15T08:00:00Z,1.2,mm/s,0.0,2.5,3.5,5.0,7.0
|
|
80
|
+
ESN-1001,VIB-FAN-1001,vibration,2026-02-12T08:00:00Z,1.2,mm/s,0.0,2.5,3.5,5.0,7.0
|
|
81
|
+
ESN-2001,EGT-2001,temperature,2025-11-20T08:00:00Z,580.0,°C,400.0,620.0,645.0,670.0,700.0
|
|
82
|
+
ESN-2001,EGT-2001,temperature,2025-12-18T08:00:00Z,581.0,°C,400.0,620.0,645.0,670.0,700.0
|
|
83
|
+
ESN-2001,EGT-2001,temperature,2026-01-15T08:00:00Z,582.0,°C,400.0,620.0,645.0,670.0,700.0
|
|
84
|
+
ESN-2001,EGT-2001,temperature,2026-02-12T08:00:00Z,583.0,°C,400.0,620.0,645.0,670.0,700.0
|
|
85
|
+
ESN-2001,VIB-BRG3-2001,vibration,2025-11-20T08:00:00Z,0.8,mm/s,0.0,1.5,2.5,4.0,5.5
|
|
86
|
+
ESN-2001,VIB-BRG3-2001,vibration,2026-01-15T08:00:00Z,0.8,mm/s,0.0,1.5,2.5,4.0,5.5
|
|
87
|
+
ESN-2001,VIB-BRG3-2001,vibration,2026-02-12T08:00:00Z,0.9,mm/s,0.0,1.5,2.5,4.0,5.5
|
|
88
|
+
ESN-2001,ODM-2001,oil_debris,2025-11-20T08:00:00Z,1.5,ppm,0.0,5.0,12.0,25.0,50.0
|
|
89
|
+
ESN-2001,ODM-2001,oil_debris,2026-01-15T08:00:00Z,1.5,ppm,0.0,5.0,12.0,25.0,50.0
|
|
90
|
+
ESN-2001,ODM-2001,oil_debris,2026-02-12T08:00:00Z,1.8,ppm,0.0,5.0,12.0,25.0,50.0
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"""Turbofan demo: a small schema and data of the scenario.
|
|
2
|
+
|
|
3
|
+
``build_schema()`` and ``build_dataframes()`` give a six-component excerpt
|
|
4
|
+
of the :doc:`SCENARIO </prograph/demos/turbofan/SCENARIO>` narrative over a
|
|
5
|
+
few tables; the SHACL demo (:mod:`prograph.demos.turbofan.validation_demo`)
|
|
6
|
+
and the natural-language tests build their engines from them::
|
|
7
|
+
|
|
8
|
+
from prograph.demos.turbofan.demo import rl_engine
|
|
9
|
+
engine = rl_engine()
|
|
10
|
+
|
|
11
|
+
``HighWearComponent`` and ``CriticalPathComponent`` are a query's rows (a
|
|
12
|
+
wear index of 0.7 or more; degradation propagating to two things or more),
|
|
13
|
+
which SQL answers; ``MonitoredComponent`` has a table of its own, empty,
|
|
14
|
+
and its members are OWL 2 RL's (``rl_engine``: ``profile="rl"`` with an
|
|
15
|
+
owned store). The full instance data in ``data/engine-instances.ttl`` loads
|
|
16
|
+
into the 53-label schema through :mod:`prograph.demos.turbofan.load`. See
|
|
17
|
+
``docs/demos/turbofan.md``.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
from __future__ import annotations
|
|
21
|
+
|
|
22
|
+
from typing import Any, Dict, Optional
|
|
23
|
+
|
|
24
|
+
import pandas as pd
|
|
25
|
+
|
|
26
|
+
from prograph.schema import (
|
|
27
|
+
GraphSchema,
|
|
28
|
+
NodeMapping,
|
|
29
|
+
RelationshipMapping,
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
# ──────────────────────────────────────────────────────────────────────────
|
|
34
|
+
# Schema + instance data
|
|
35
|
+
#
|
|
36
|
+
# A small schema of the scenario. ``HighWearComponent`` and
|
|
37
|
+
# ``CriticalPathComponent`` are a query's rows; ``MonitoredComponent``'s
|
|
38
|
+
# members come from OWL RL materialization (``profile="rl"`` with a store).
|
|
39
|
+
# The full mapping lives in turbofan_schema.py (10 tables, 53 labels).
|
|
40
|
+
# ──────────────────────────────────────────────────────────────────────────
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def build_schema() -> GraphSchema:
|
|
44
|
+
from prograph.demos.turbofan import TURBOFAN_BASE_IRI
|
|
45
|
+
schema = GraphSchema(base_iri=TURBOFAN_BASE_IRI)
|
|
46
|
+
schema.add_node_mapping(NodeMapping(
|
|
47
|
+
source_table="components",
|
|
48
|
+
label="Component",
|
|
49
|
+
id_column="id",
|
|
50
|
+
property_columns={"wearIndex": "wear_index"},
|
|
51
|
+
))
|
|
52
|
+
schema.add_node_mapping(NodeMapping(
|
|
53
|
+
source_table="sensors",
|
|
54
|
+
label="Sensor",
|
|
55
|
+
id_column="id",
|
|
56
|
+
))
|
|
57
|
+
# The classes the ontology defines by values, which no OWL profile applies, are a query's rows: a wear
|
|
58
|
+
# index of 0.7 or more, degradation propagating to two things or more.
|
|
59
|
+
schema.add_node_mapping(NodeMapping(
|
|
60
|
+
source_table="high_wear_components", label="HighWearComponent", id_column="id",
|
|
61
|
+
source_query="SELECT id FROM components WHERE wear_index >= 0.7",
|
|
62
|
+
))
|
|
63
|
+
schema.add_node_mapping(NodeMapping(
|
|
64
|
+
source_table="critical_path_components", label="CriticalPathComponent", id_column="id",
|
|
65
|
+
source_query="SELECT src AS id FROM propagates_to GROUP BY src HAVING COUNT(DISTINCT dst) >= 2",
|
|
66
|
+
))
|
|
67
|
+
# MonitoredComponent: a table of its own, empty; OWL 2 RL derives its members into the owned store.
|
|
68
|
+
schema.add_node_mapping(NodeMapping(
|
|
69
|
+
source_table="monitoredcomponent", label="MonitoredComponent", id_column="id", mutable=True,
|
|
70
|
+
))
|
|
71
|
+
schema.add_relationship_mapping(RelationshipMapping(
|
|
72
|
+
source_table="propagates_to", rel_type="PROPAGATES_TO",
|
|
73
|
+
start_node_label="Component", start_id_column="src",
|
|
74
|
+
end_node_label="Component", end_id_column="dst",
|
|
75
|
+
))
|
|
76
|
+
schema.add_relationship_mapping(RelationshipMapping(
|
|
77
|
+
source_table="monitors", rel_type="MONITORS",
|
|
78
|
+
start_node_label="Sensor", start_id_column="src",
|
|
79
|
+
end_node_label="Component", end_id_column="dst",
|
|
80
|
+
))
|
|
81
|
+
return schema
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
def _empty_id_frame() -> pd.DataFrame:
|
|
85
|
+
return pd.DataFrame({"id": pd.Series([], dtype=object)})
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def build_dataframes() -> Dict[str, pd.DataFrame]:
|
|
89
|
+
"""Synthetic data reflecting the SCENARIO.md narrative."""
|
|
90
|
+
return {
|
|
91
|
+
"components": pd.DataFrame({
|
|
92
|
+
"id": [
|
|
93
|
+
"bearing-1001-mid", # wear 0.82, High + Critical (2 prop.) + Monitored
|
|
94
|
+
"hpt-blade-1001-stg1", # wear 0.78, High + Monitored
|
|
95
|
+
"hpc-blade-1001-stg5", # wear 0.72, High
|
|
96
|
+
"hp-shaft-1001", # wear 0.30, none
|
|
97
|
+
"mid-bearing-seal-1001", # wear 0.55, none
|
|
98
|
+
"low-wear-component", # wear 0.10, none (asserted but unmonitored)
|
|
99
|
+
],
|
|
100
|
+
"wear_index": [0.82, 0.78, 0.72, 0.30, 0.55, 0.10],
|
|
101
|
+
}),
|
|
102
|
+
"sensors": pd.DataFrame({
|
|
103
|
+
"id": [
|
|
104
|
+
"vib-sensor-1001-bearing",
|
|
105
|
+
"temp-sensor-1001-hpt",
|
|
106
|
+
],
|
|
107
|
+
}),
|
|
108
|
+
# MonitoredComponent's table, empty: OWL 2 RL derives its members into the owned store.
|
|
109
|
+
# The id column is typed as text like the other ids: an empty
|
|
110
|
+
# pd.DataFrame({"id": []}) is float64, and the SQL path then
|
|
111
|
+
# treats `c.id = d.id` across the two tables as a cross-type
|
|
112
|
+
# comparison that is never true.
|
|
113
|
+
"monitoredcomponent": _empty_id_frame(),
|
|
114
|
+
# Propagation: bearing-1001-mid propagates to 2 targets.
|
|
115
|
+
"propagates_to": pd.DataFrame({
|
|
116
|
+
"src": [
|
|
117
|
+
"bearing-1001-mid", # to hp-shaft-1001
|
|
118
|
+
"bearing-1001-mid", # to mid-bearing-seal-1001
|
|
119
|
+
"hpt-blade-1001-stg1", # only 1 target, not Critical
|
|
120
|
+
],
|
|
121
|
+
"dst": [
|
|
122
|
+
"hp-shaft-1001",
|
|
123
|
+
"mid-bearing-seal-1001",
|
|
124
|
+
"hp-shaft-1001",
|
|
125
|
+
],
|
|
126
|
+
}),
|
|
127
|
+
# Sensor monitoring.
|
|
128
|
+
"monitors": pd.DataFrame({
|
|
129
|
+
"src": [
|
|
130
|
+
"vib-sensor-1001-bearing",
|
|
131
|
+
"temp-sensor-1001-hpt",
|
|
132
|
+
],
|
|
133
|
+
"dst": [
|
|
134
|
+
"bearing-1001-mid",
|
|
135
|
+
"hpt-blade-1001-stg1",
|
|
136
|
+
],
|
|
137
|
+
}),
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
def rl_engine(dataframes: Optional[Dict[str, pd.DataFrame]] = None, connection: Any = None) -> Any:
|
|
142
|
+
"""``build_schema()`` over ``dataframes`` (``build_dataframes()`` when None), written as tables of a DuckDB
|
|
143
|
+
`connection` (a new one in memory when None), with the ontology, an OWL 2 RL ontology, under
|
|
144
|
+
``profile="rl"`` and an owned store on that connection: ``MonitoredComponent``'s members are materialized
|
|
145
|
+
when the engine is built."""
|
|
146
|
+
import duckdb
|
|
147
|
+
from prograph import ProGraph
|
|
148
|
+
from prograph.demos.turbofan import ONTOLOGY_PATH
|
|
149
|
+
from prograph.demos.turbofan.load import add_rdf_mappings
|
|
150
|
+
from prograph.ontology import OntologyLayer
|
|
151
|
+
from prograph.store import Store
|
|
152
|
+
connection = connection if connection is not None else duckdb.connect()
|
|
153
|
+
for name, frame in (dataframes if dataframes is not None else build_dataframes()).items():
|
|
154
|
+
connection.register("_frame", frame)
|
|
155
|
+
# The ontology ranges wearIndex over xsd:decimal: the table holds decimals, not the frame's doubles
|
|
156
|
+
# (a double is outside the decimals' value space), and a missing value (NaN) is NULL.
|
|
157
|
+
decimal = (" REPLACE (TRY_CAST(CASE WHEN isnan(wear_index) THEN NULL ELSE wear_index END AS DECIMAL(4, 2))"
|
|
158
|
+
" AS wear_index)" if "wear_index" in frame.columns else "")
|
|
159
|
+
connection.execute(f'CREATE TABLE "{name}" AS SELECT *{decimal} FROM _frame')
|
|
160
|
+
connection.unregister("_frame")
|
|
161
|
+
return ProGraph(schema=add_rdf_mappings(build_schema()), connection=connection, backend="duckdb",
|
|
162
|
+
store=Store(connection), ontology=OntologyLayer.from_owl(str(ONTOLOGY_PATH)), profile="rl")
|