maplib 0.18.18__tar.gz → 0.19.3__tar.gz
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.
- {maplib-0.18.18 → maplib-0.19.3}/Cargo.lock +1 -1
- {maplib-0.18.18 → maplib-0.19.3}/Cargo.toml +1 -1
- {maplib-0.18.18 → maplib-0.19.3}/PKG-INFO +2 -2
- {maplib-0.18.18 → maplib-0.19.3}/README.md +1 -1
- {maplib-0.18.18 → maplib-0.19.3}/lib/maplib/src/model/expansion.rs +2 -1
- {maplib-0.18.18 → maplib-0.19.3}/lib/maplib/src/model.rs +38 -2
- {maplib-0.18.18 → maplib-0.19.3}/lib/query_processing/src/cats.rs +45 -42
- {maplib-0.18.18 → maplib-0.19.3}/lib/query_processing/src/expressions.rs +51 -13
- {maplib-0.18.18 → maplib-0.19.3}/lib/representation/src/cats/decode.rs +8 -15
- {maplib-0.18.18 → maplib-0.19.3}/lib/representation/src/cats/encode.rs +35 -39
- {maplib-0.18.18 → maplib-0.19.3}/lib/representation/src/cats/globalize.rs +16 -8
- {maplib-0.18.18 → maplib-0.19.3}/lib/representation/src/cats/image.rs +10 -27
- maplib-0.19.3/lib/representation/src/cats/maps/in_memory.rs +185 -0
- maplib-0.19.3/lib/representation/src/cats/maps/on_disk.rs +70 -0
- maplib-0.19.3/lib/representation/src/cats/maps.rs +167 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/representation/src/cats/re_encode.rs +12 -69
- {maplib-0.18.18 → maplib-0.19.3}/lib/representation/src/cats.rs +37 -37
- {maplib-0.18.18 → maplib-0.19.3}/lib/representation/src/dataset.rs +15 -1
- {maplib-0.18.18 → maplib-0.19.3}/lib/representation/src/python.rs +11 -3
- {maplib-0.18.18 → maplib-0.19.3}/lib/shacl/src/lib.rs +1 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/spargebra/src/lib.rs +1 -1
- {maplib-0.18.18 → maplib-0.19.3}/lib/spargebra/src/parser.rs +18 -24
- maplib-0.19.3/lib/templates/src/python/owl.rs +413 -0
- maplib-0.19.3/lib/templates/src/python/rdf.rs +105 -0
- maplib-0.19.3/lib/templates/src/python/rdfs.rs +95 -0
- maplib-0.19.3/lib/templates/src/python/xsd.rs +219 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/templates/src/python.rs +7 -102
- {maplib-0.18.18 → maplib-0.19.3}/lib/triplestore/src/cats.rs +8 -2
- {maplib-0.18.18 → maplib-0.19.3}/lib/triplestore/src/dblf.rs +2 -3
- {maplib-0.18.18 → maplib-0.19.3}/lib/triplestore/src/lib.rs +173 -25
- {maplib-0.18.18 → maplib-0.19.3}/lib/triplestore/src/query_solutions.rs +45 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/triplestore/src/sparql/delete.rs +14 -3
- {maplib-0.18.18 → maplib-0.19.3}/lib/triplestore/src/sparql/insert.rs +5 -2
- {maplib-0.18.18 → maplib-0.19.3}/lib/triplestore/src/sparql/lazy_expressions.rs +1 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/triplestore/src/sparql/lazy_graph_patterns/extend.rs +1 -0
- maplib-0.19.3/lib/triplestore/src/sparql/lazy_graph_patterns/graph.rs +45 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/triplestore/src/sparql/lazy_graph_patterns/join.rs +1 -3
- {maplib-0.18.18 → maplib-0.19.3}/lib/triplestore/src/sparql/lazy_graph_patterns/path.rs +189 -213
- {maplib-0.18.18 → maplib-0.19.3}/lib/triplestore/src/sparql/lazy_graph_patterns/pvalues.rs +2 -1
- {maplib-0.18.18 → maplib-0.19.3}/lib/triplestore/src/sparql/lazy_graph_patterns/values.rs +2 -1
- {maplib-0.18.18 → maplib-0.19.3}/lib/triplestore/src/sparql/lazy_graph_patterns.rs +15 -7
- {maplib-0.18.18 → maplib-0.19.3}/lib/triplestore/src/sparql.rs +3 -2
- maplib-0.19.3/lib/triplestore/src/storage/deduplication.rs +138 -0
- maplib-0.19.3/lib/triplestore/src/storage/so_index.rs +91 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/triplestore/src/storage.rs +167 -187
- {maplib-0.18.18 → maplib-0.19.3}/lib/triplestore/src/triples_read.rs +41 -16
- maplib-0.19.3/lib/triplestore/src/triples_write/pretty_turtle.rs +161 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/triplestore/src/triples_write.rs +1 -0
- {maplib-0.18.18 → maplib-0.19.3}/maplib/__init__.py +9 -1
- {maplib-0.18.18 → maplib-0.19.3}/maplib/__init__.pyi +184 -71
- {maplib-0.18.18/py_maplib → maplib-0.19.3}/maplib/template_generator/generate.py +4 -5
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/Cargo.toml +1 -1
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/README.md +1 -1
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/maplib/__init__.py +9 -1
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/maplib/__init__.pyi +184 -71
- {maplib-0.18.18 → maplib-0.19.3/py_maplib}/maplib/template_generator/generate.py +4 -5
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/src/lib.rs +56 -170
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/test_basics.py +11 -9
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/test_blank_nodes_multi.py +3 -3
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/test_data_validation.py +29 -30
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/test_integration.py +18 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/test_multi_expressions.py +14 -14
- maplib-0.19.3/py_maplib/tests/test_named_graphs.py +134 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/test_pizza_example.py +2 -2
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/test_programmatic_pizza_example.py +4 -4
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/test_validate_iris.py +1 -1
- {maplib-0.18.18 → maplib-0.19.3}/LICENSE +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/cimxml/Cargo.toml +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/cimxml/src/export.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/cimxml/src/lib.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/datalog/Cargo.toml +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/datalog/src/ast.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/datalog/src/inference.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/datalog/src/lib.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/datalog/src/parser.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/datalog/src/python.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/file_io/Cargo.toml +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/file_io/src/lib.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/fts/Cargo.toml +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/fts/src/lib.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/maplib/Cargo.toml +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/maplib/src/errors.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/maplib/src/lib.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/maplib/src/model/constant_terms.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/maplib/src/model/default.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/maplib/src/model/errors.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/maplib/src/model/expansion/validation.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/maplib/src/prefixes.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/pydf_io/Cargo.toml +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/pydf_io/LICENSE +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/pydf_io/README.md +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/pydf_io/licensing/POLARS_LICENSE +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/pydf_io/src/lib.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/pydf_io/src/to_python.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/pydf_io/src/to_rust.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/query_processing/Cargo.toml +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/query_processing/LICENSE +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/query_processing/README.md +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/query_processing/src/aggregates.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/query_processing/src/constants.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/query_processing/src/errors.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/query_processing/src/exists_helper.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/query_processing/src/expressions/comparisons.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/query_processing/src/expressions/functions.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/query_processing/src/expressions/operations.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/query_processing/src/find_query_variables.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/query_processing/src/graph_patterns/cats.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/query_processing/src/graph_patterns/group.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/query_processing/src/graph_patterns/join.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/query_processing/src/graph_patterns/order.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/query_processing/src/graph_patterns/union.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/query_processing/src/graph_patterns/values.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/query_processing/src/graph_patterns.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/query_processing/src/lib.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/query_processing/src/pushdowns.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/query_processing/src/type_constraints.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/report_mapping/Cargo.toml +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/report_mapping/src/lib.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/representation/Cargo.toml +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/representation/LICENSE +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/representation/README.md +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/representation/src/base_rdf_type.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/representation/src/debug.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/representation/src/errors.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/representation/src/formatting.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/representation/src/lib.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/representation/src/literals.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/representation/src/multitype.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/representation/src/polars_to_rdf.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/representation/src/query_context.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/representation/src/rdf_state.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/representation/src/rdf_to_polars.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/representation/src/rdf_type.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/representation/src/solution_mapping.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/representation/src/subtypes.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/shacl/Cargo.toml +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/shacl/src/errors.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/shacl/src/storage.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/spargebra/Cargo.toml +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/spargebra/LICENSE +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/spargebra/README.md +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/spargebra/src/algebra.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/spargebra/src/query.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/spargebra/src/query_context.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/spargebra/src/remove_sugar.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/spargebra/src/term.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/spargebra/src/treehouse.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/spargebra/src/update.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/templates/Cargo.toml +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/templates/src/ast.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/templates/src/compatible.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/templates/src/constants.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/templates/src/dataset/errors.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/templates/src/dataset.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/templates/src/document.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/templates/src/lib.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/templates/src/parsing.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/templates/src/subtypes_ext.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/triplestore/Cargo.toml +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/triplestore/src/errors.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/triplestore/src/io_funcs.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/triplestore/src/native_parquet_write.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/triplestore/src/rdfs_inferencing.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/triplestore/src/sparql/debug.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/triplestore/src/sparql/errors.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/triplestore/src/sparql/lazy_aggregate.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/triplestore/src/sparql/lazy_graph_patterns/distinct.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/triplestore/src/sparql/lazy_graph_patterns/filter.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/triplestore/src/sparql/lazy_graph_patterns/group.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/triplestore/src/sparql/lazy_graph_patterns/left_join.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/triplestore/src/sparql/lazy_graph_patterns/minus.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/triplestore/src/sparql/lazy_graph_patterns/order_by.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/triplestore/src/sparql/lazy_graph_patterns/project.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/triplestore/src/sparql/lazy_graph_patterns/triple.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/triplestore/src/sparql/lazy_graph_patterns/triples_ordering.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/triplestore/src/sparql/lazy_graph_patterns/union.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/triplestore/src/sparql/lazy_order.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/triplestore/src/sparql/rewrite/rewrite_cse.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/triplestore/src/sparql/rewrite/rewrite_pushdown.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/triplestore/src/sparql/rewrite.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/triplestore/src/triples_write/fast_ntriples.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/triplestore/src/triples_write/serializers.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/utils/Cargo.toml +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/utils/src/lib.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/lib/utils/src/polars.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/maplib/adding_triples.py +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/maplib/py.typed +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/maplib/template_generator/__init__.py +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/maplib/template_generator/ordering.py +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/LICENSE +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/maplib/.gitignore +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/maplib/adding_triples.py +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/maplib/py.typed +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/maplib/template_generator/__init__.py +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/maplib/template_generator/ordering.py +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/src/error.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/src/shacl.rs +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/.gitignore +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/__init__.py +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/out.ttl +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/requirements.txt +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/test_exceptions.py +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/test_rdf_parser.py +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/test_read_write.py +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/test_stottr.py +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/testdata/expected_easy_case.ttl +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/testdata/iterated_property_path_constant_object_query.csv +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/testdata/iterated_property_path_constant_subject_query.csv +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/testdata/iterated_property_path_query.csv +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/testdata/iterated_property_path_query_with_bug.csv +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/testdata/larger_ordered_query.csv +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/testdata/larger_query.csv +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/testdata/multi_concat.csv +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/testdata/multi_datatype_join_query.csv +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/testdata/multi_datatype_join_query_two_vars.csv +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/testdata/multi_datatype_leftjoin_query.csv +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/testdata/multi_datatype_query.csv +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/testdata/multi_datatype_query_sorting.csv +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/testdata/multi_datatype_union_query.csv +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/testdata/multi_datatype_union_query_native_df.parquet +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/testdata/multi_datatype_union_sort_desc1_query.csv +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/testdata/multi_datatype_union_sort_query.csv +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/testdata/multi_many_comp.csv +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/testdata/property_path_query.csv +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/testdata/rdf_parser/date_panic.nt +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/testdata/read_ntriples.csv +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/testdata/read_ntriples.nt +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/testdata/read_ntriples2.csv +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/testdata/simple_construct_query_nothing.csv +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/testdata/simple_construct_query_something.csv +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/testdata/simple_insert_query_nothing.csv +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/testdata/simple_insert_query_something.csv +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/testdata/simple_property_path_query.csv +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/testdata/simple_query.csv +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/testdata/stringfuncs.csv +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/py_maplib/tests/testdata/templates.ttl +0 -0
- {maplib-0.18.18 → maplib-0.19.3}/pyproject.toml +0 -0
|
@@ -12,7 +12,7 @@ polars = { version = "0.52.0", features = ["simd", "nightly", "new_streaming", "
|
|
|
12
12
|
polars-core = { version = "0.52.0" }
|
|
13
13
|
rayon = "1.10.0"
|
|
14
14
|
regex = "1.11.1"
|
|
15
|
-
oxrdf = { version="0.2.4" }
|
|
15
|
+
oxrdf = { version = "0.2.4" }
|
|
16
16
|
oxrdfio = { version = "0.1.7" }
|
|
17
17
|
oxttl = { version="0.1.7" }
|
|
18
18
|
oxiri = "0.2.11"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: maplib
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.19.3
|
|
4
4
|
Classifier: Development Status :: 4 - Beta
|
|
5
5
|
Classifier: License :: OSI Approved :: Apache Software License
|
|
6
6
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
@@ -81,7 +81,7 @@ template = Template(
|
|
|
81
81
|
Parameter(variable=ings_var, rdf_type=RDFType.Nested(RDFType.IRI()))
|
|
82
82
|
],
|
|
83
83
|
instances= [
|
|
84
|
-
Triple(p_var, a
|
|
84
|
+
Triple(p_var, a, pi.suf("Pizza")),
|
|
85
85
|
Triple(p_var, pi.suf("fromCountry"), c_var),
|
|
86
86
|
Triple(
|
|
87
87
|
p_var,
|
|
@@ -55,7 +55,7 @@ template = Template(
|
|
|
55
55
|
Parameter(variable=ings_var, rdf_type=RDFType.Nested(RDFType.IRI()))
|
|
56
56
|
],
|
|
57
57
|
instances= [
|
|
58
|
-
Triple(p_var, a
|
|
58
|
+
Triple(p_var, a, pi.suf("Pizza")),
|
|
59
59
|
Triple(p_var, pi.suf("fromCountry"), c_var),
|
|
60
60
|
Triple(
|
|
61
61
|
p_var,
|
|
@@ -302,6 +302,7 @@ impl Model {
|
|
|
302
302
|
subject_type: subject_type,
|
|
303
303
|
object_type: object_type,
|
|
304
304
|
predicate: predicate.clone(),
|
|
305
|
+
graph: graph.clone(),
|
|
305
306
|
subject_cat_state: subject_state,
|
|
306
307
|
object_cat_state: object_state,
|
|
307
308
|
predicate_cat_state: predicate_state,
|
|
@@ -310,7 +311,7 @@ impl Model {
|
|
|
310
311
|
}
|
|
311
312
|
|
|
312
313
|
self.triplestore
|
|
313
|
-
.add_triples_vec(all_triples_to_add, false
|
|
314
|
+
.add_triples_vec(all_triples_to_add, false)
|
|
314
315
|
.map_err(MappingError::TriplestoreError)?;
|
|
315
316
|
|
|
316
317
|
self.blank_node_counter = new_blank_node_counter;
|
|
@@ -184,7 +184,16 @@ impl Model {
|
|
|
184
184
|
self.truncate_graph(&graph)
|
|
185
185
|
}
|
|
186
186
|
self.triplestore
|
|
187
|
-
.read_triples_from_path(
|
|
187
|
+
.read_triples_from_path(
|
|
188
|
+
p,
|
|
189
|
+
rdf_format,
|
|
190
|
+
base_iri,
|
|
191
|
+
transient,
|
|
192
|
+
parallel,
|
|
193
|
+
checked,
|
|
194
|
+
graph,
|
|
195
|
+
&self.prefixes,
|
|
196
|
+
)
|
|
188
197
|
.map_err(MaplibError::TriplestoreError)
|
|
189
198
|
}
|
|
190
199
|
|
|
@@ -217,7 +226,16 @@ impl Model {
|
|
|
217
226
|
self.truncate_graph(&graph)
|
|
218
227
|
}
|
|
219
228
|
self.triplestore
|
|
220
|
-
.read_triples_from_string(
|
|
229
|
+
.read_triples_from_string(
|
|
230
|
+
s,
|
|
231
|
+
rdf_format,
|
|
232
|
+
base_iri,
|
|
233
|
+
transient,
|
|
234
|
+
parallel,
|
|
235
|
+
checked,
|
|
236
|
+
graph,
|
|
237
|
+
&self.prefixes,
|
|
238
|
+
)
|
|
221
239
|
.map_err(MaplibError::TriplestoreError)
|
|
222
240
|
}
|
|
223
241
|
|
|
@@ -369,6 +387,7 @@ impl Model {
|
|
|
369
387
|
only_shapes: Option<Vec<NamedNode>>,
|
|
370
388
|
deactivate_shapes: Vec<NamedNode>,
|
|
371
389
|
dry_run: bool,
|
|
390
|
+
serial: bool,
|
|
372
391
|
) -> Result<ValidationReport, MaplibError> {
|
|
373
392
|
let res = validate(
|
|
374
393
|
&mut self.triplestore,
|
|
@@ -384,6 +403,7 @@ impl Model {
|
|
|
384
403
|
deactivate_shapes,
|
|
385
404
|
dry_run,
|
|
386
405
|
Some(self.prefixes.clone()),
|
|
406
|
+
serial,
|
|
387
407
|
);
|
|
388
408
|
res.map_err(|x| x.into())
|
|
389
409
|
}
|
|
@@ -465,4 +485,20 @@ impl Model {
|
|
|
465
485
|
);
|
|
466
486
|
Ok(res.map_err(|x| MaplibError::DatalogError(x))?)
|
|
467
487
|
}
|
|
488
|
+
|
|
489
|
+
pub fn detach_graph(
|
|
490
|
+
&mut self,
|
|
491
|
+
graph: &NamedGraph,
|
|
492
|
+
preserve_name: bool,
|
|
493
|
+
) -> Result<Model, MaplibError> {
|
|
494
|
+
let triplestore = self.triplestore.detach_graph(graph, preserve_name)?;
|
|
495
|
+
Ok(Model {
|
|
496
|
+
template_dataset: self.template_dataset.clone(),
|
|
497
|
+
triplestore,
|
|
498
|
+
blank_node_counter: self.blank_node_counter,
|
|
499
|
+
default_template_counter: self.default_template_counter,
|
|
500
|
+
indexing: self.indexing.clone(),
|
|
501
|
+
prefixes: self.prefixes.clone(),
|
|
502
|
+
})
|
|
503
|
+
}
|
|
468
504
|
}
|
|
@@ -25,52 +25,55 @@ pub fn create_compatible_cats(
|
|
|
25
25
|
let mut string_cast = HashSet::new();
|
|
26
26
|
|
|
27
27
|
for t in base_types {
|
|
28
|
-
let need_native_cat_cast = check_need_native_cat_cast(&t, &states);
|
|
29
|
-
if need_native_cat_cast {
|
|
30
|
-
let locals = find_all_locals(&t, &states);
|
|
31
|
-
let mut cats = Cats::new_empty(Some(global_cats.read().unwrap().deref()));
|
|
32
|
-
let renc_local = cats.merge(locals);
|
|
33
|
-
let renc_local: HashMap<_, _> = renc_local
|
|
34
|
-
.into_iter()
|
|
35
|
-
.map(|(uu, map)| {
|
|
36
|
-
let mut blank_renc = None;
|
|
37
|
-
let mut iri_renc = vec![];
|
|
38
|
-
let mut literal_renc_map = HashMap::new();
|
|
39
|
-
for (p, renc) in map {
|
|
40
|
-
match p {
|
|
41
|
-
CatType::IRI => {
|
|
42
|
-
iri_renc.push(renc);
|
|
43
|
-
}
|
|
44
|
-
CatType::Blank => {
|
|
45
|
-
blank_renc = Some(renc);
|
|
46
|
-
}
|
|
47
|
-
CatType::Literal(l) => {
|
|
48
|
-
literal_renc_map.insert(l, renc);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
let iri_renc = if iri_renc.is_empty() {
|
|
53
|
-
None
|
|
54
|
-
} else {
|
|
55
|
-
let mut renc_map =
|
|
56
|
-
HashMap::with_capacity_and_hasher(2, BuildHasherDefault::default());
|
|
57
|
-
for renc in iri_renc {
|
|
58
|
-
renc_map.extend(renc.cat_map.iter().map(|(x, y)| (*x, *y)))
|
|
59
|
-
}
|
|
60
|
-
Some(CatReEnc {
|
|
61
|
-
cat_map: Arc::new(renc_map),
|
|
62
|
-
})
|
|
63
|
-
};
|
|
64
|
-
(uu, (blank_renc, iri_renc, literal_renc_map))
|
|
65
|
-
})
|
|
66
|
-
.collect();
|
|
67
|
-
let state = BaseCatState::CategoricalNative(false, Some(LockedCats::new(cats)));
|
|
68
|
-
native_cat_map.insert(t.clone(), (renc_local, state));
|
|
69
|
-
}
|
|
70
28
|
let need_string_cast = check_need_string_cast(&t, &states);
|
|
71
29
|
if need_string_cast {
|
|
72
30
|
string_cast.insert(t.clone());
|
|
73
31
|
}
|
|
32
|
+
if !need_string_cast {
|
|
33
|
+
let need_native_cat_cast = check_need_native_cat_cast(&t, &states);
|
|
34
|
+
if need_native_cat_cast {
|
|
35
|
+
let locals = find_all_locals(&t, &states);
|
|
36
|
+
let mut cats = Cats::new_empty(Some(global_cats.read().unwrap().deref()));
|
|
37
|
+
// We do not store local cats to disk
|
|
38
|
+
let renc_local = cats.merge(locals, None);
|
|
39
|
+
let renc_local: HashMap<_, _> = renc_local
|
|
40
|
+
.into_iter()
|
|
41
|
+
.map(|(uu, map)| {
|
|
42
|
+
let mut blank_renc = None;
|
|
43
|
+
let mut iri_renc = vec![];
|
|
44
|
+
let mut literal_renc_map = HashMap::new();
|
|
45
|
+
for (p, renc) in map {
|
|
46
|
+
match p {
|
|
47
|
+
CatType::IRI => {
|
|
48
|
+
iri_renc.push(renc);
|
|
49
|
+
}
|
|
50
|
+
CatType::Blank => {
|
|
51
|
+
blank_renc = Some(renc);
|
|
52
|
+
}
|
|
53
|
+
CatType::Literal(l) => {
|
|
54
|
+
literal_renc_map.insert(l, renc);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
let iri_renc = if iri_renc.is_empty() {
|
|
59
|
+
None
|
|
60
|
+
} else {
|
|
61
|
+
let mut renc_map =
|
|
62
|
+
HashMap::with_capacity_and_hasher(2, BuildHasherDefault::default());
|
|
63
|
+
for renc in iri_renc {
|
|
64
|
+
renc_map.extend(renc.cat_map.iter().map(|(x, y)| (*x, *y)))
|
|
65
|
+
}
|
|
66
|
+
Some(CatReEnc {
|
|
67
|
+
cat_map: Arc::new(renc_map),
|
|
68
|
+
})
|
|
69
|
+
};
|
|
70
|
+
(uu, (blank_renc, iri_renc, literal_renc_map))
|
|
71
|
+
})
|
|
72
|
+
.collect();
|
|
73
|
+
let state = BaseCatState::CategoricalNative(false, Some(LockedCats::new(cats)));
|
|
74
|
+
native_cat_map.insert(t.clone(), (renc_local, state));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
74
77
|
}
|
|
75
78
|
|
|
76
79
|
let mut exploded: Vec<_> = expressions
|
|
@@ -32,7 +32,8 @@ pub fn named_node_local_enc(nn: &NamedNode, global_cats: &Cats) -> (Expr, Option
|
|
|
32
32
|
if let Some(enc) = global_cats.encode_iri_slice(&[nn.as_str()]).pop().unwrap() {
|
|
33
33
|
(lit(enc).cast(DataType::UInt32), None)
|
|
34
34
|
} else {
|
|
35
|
-
|
|
35
|
+
// We do not store these local cats to disk
|
|
36
|
+
let (enc, local) = Cats::new_singular_iri(nn.as_str(), global_cats.get_iri_counter(), None);
|
|
36
37
|
(lit(enc).cast(DataType::UInt32), Some(local))
|
|
37
38
|
}
|
|
38
39
|
}
|
|
@@ -46,12 +47,14 @@ pub fn blank_node_local_enc(bl: &BlankNode, global_cats: &Cats) -> (Expr, Option
|
|
|
46
47
|
if let Some(enc) = global_cats.encode_blanks(&[bl.as_str()]).pop().unwrap() {
|
|
47
48
|
(lit(enc).cast(DataType::UInt32), None)
|
|
48
49
|
} else {
|
|
49
|
-
|
|
50
|
+
// Local cats not stored to disk, hence None path
|
|
51
|
+
let (enc, local) =
|
|
52
|
+
Cats::new_singular_blank(bl.as_str(), global_cats.get_iri_counter(), None);
|
|
50
53
|
(lit(enc).cast(DataType::UInt32), Some(local))
|
|
51
54
|
}
|
|
52
55
|
}
|
|
53
56
|
|
|
54
|
-
pub fn
|
|
57
|
+
pub fn literal_enc(l: &Literal, global_cats: &Cats) -> (Expr, BaseRDFNodeType, BaseCatState) {
|
|
55
58
|
let bt = BaseRDFNodeType::Literal(l.datatype().into_owned());
|
|
56
59
|
if literal_is_cat(l.datatype()) {
|
|
57
60
|
if let Some(enc) = global_cats
|
|
@@ -67,7 +70,8 @@ pub fn maybe_literal_enc(l: &Literal, global_cats: &Cats) -> (Expr, BaseRDFNodeT
|
|
|
67
70
|
} else {
|
|
68
71
|
let dt = l.datatype().into_owned();
|
|
69
72
|
let offset = global_cats.get_literal_counter(&dt);
|
|
70
|
-
|
|
73
|
+
// Local cats are not stored to disk, hence None
|
|
74
|
+
let (enc, local) = Cats::new_singular_literal(l.value(), dt, offset, None);
|
|
71
75
|
(
|
|
72
76
|
lit(enc).cast(DataType::UInt32),
|
|
73
77
|
bt,
|
|
@@ -106,7 +110,7 @@ pub fn literal(
|
|
|
106
110
|
context: &Context,
|
|
107
111
|
global_cats: &Cats,
|
|
108
112
|
) -> Result<SolutionMappings, QueryProcessingError> {
|
|
109
|
-
let (e, bt, bs) =
|
|
113
|
+
let (e, bt, bs) = literal_enc(lit, global_cats);
|
|
110
114
|
solution_mappings.mappings = solution_mappings
|
|
111
115
|
.mappings
|
|
112
116
|
.with_column(e.alias(context.as_str()));
|
|
@@ -361,23 +365,57 @@ pub fn if_expression(
|
|
|
361
365
|
middle_context: &Context,
|
|
362
366
|
right_context: &Context,
|
|
363
367
|
outer_context: &Context,
|
|
368
|
+
global_cats: LockedCats,
|
|
364
369
|
) -> Result<SolutionMappings, QueryProcessingError> {
|
|
370
|
+
//
|
|
371
|
+
let mut exploded: Vec<_> = create_compatible_cats(
|
|
372
|
+
vec![Some(col(middle_context.as_str())), Some(col(right_context.as_str()))],
|
|
373
|
+
vec![Some(solution_mappings.rdf_node_types.get(middle_context.as_str()).unwrap().clone()),
|
|
374
|
+
Some(solution_mappings.rdf_node_types.get(right_context.as_str()).unwrap().clone())],
|
|
375
|
+
global_cats,
|
|
376
|
+
)
|
|
377
|
+
.into_iter()
|
|
378
|
+
.map(|x| x.unwrap())
|
|
379
|
+
.collect();
|
|
380
|
+
assert_eq!(exploded.len(), 2);
|
|
381
|
+
|
|
382
|
+
let right_exploded = exploded.pop().unwrap();
|
|
383
|
+
let mid_exploded = exploded.pop().unwrap();
|
|
384
|
+
|
|
385
|
+
let mut mid_exprs = vec![];
|
|
386
|
+
let mut right_exprs = vec![];
|
|
387
|
+
|
|
388
|
+
let mut base_type_map = HashMap::new();
|
|
389
|
+
for (t, (exprs, base_state)) in right_exploded {
|
|
390
|
+
base_type_map.insert(t, base_state);
|
|
391
|
+
right_exprs.extend(exprs);
|
|
392
|
+
}
|
|
393
|
+
for (_, (exprs, _)) in mid_exploded {
|
|
394
|
+
mid_exprs.extend(exprs);
|
|
395
|
+
}
|
|
396
|
+
let mid_expr = if mid_exprs.len() > 1 {
|
|
397
|
+
as_struct(mid_exprs)
|
|
398
|
+
} else {
|
|
399
|
+
mid_exprs.pop().unwrap()
|
|
400
|
+
};
|
|
401
|
+
|
|
402
|
+
let right_expr = if right_exprs.len() > 1 {
|
|
403
|
+
as_struct(right_exprs)
|
|
404
|
+
} else {
|
|
405
|
+
right_exprs.pop().unwrap()
|
|
406
|
+
};
|
|
407
|
+
|
|
365
408
|
solution_mappings.mappings = solution_mappings.mappings.with_column(
|
|
366
409
|
(Expr::Ternary {
|
|
367
410
|
predicate: Arc::new(col(left_context.as_str())),
|
|
368
|
-
truthy: Arc::new(
|
|
369
|
-
falsy: Arc::new(
|
|
411
|
+
truthy: Arc::new(mid_expr),
|
|
412
|
+
falsy: Arc::new(right_expr),
|
|
370
413
|
})
|
|
371
414
|
.alias(outer_context.as_str()),
|
|
372
415
|
);
|
|
373
|
-
//Todo: generalize..
|
|
374
|
-
let existing_type = solution_mappings
|
|
375
|
-
.rdf_node_types
|
|
376
|
-
.get(middle_context.as_str())
|
|
377
|
-
.unwrap();
|
|
378
416
|
solution_mappings
|
|
379
417
|
.rdf_node_types
|
|
380
|
-
.insert(outer_context.as_str().to_string(),
|
|
418
|
+
.insert(outer_context.as_str().to_string(), RDFNodeState::from_map(base_type_map));
|
|
381
419
|
solution_mappings = drop_inner_contexts(
|
|
382
420
|
solution_mappings,
|
|
383
421
|
&vec![left_context, middle_context, right_context],
|
|
@@ -8,30 +8,20 @@ use polars::frame::column::ScalarColumn;
|
|
|
8
8
|
use polars::frame::DataFrame;
|
|
9
9
|
use polars::prelude::{col, Column, Expr, IntoColumn, IntoLazy, NamedFrom, SeriesSealed};
|
|
10
10
|
use polars::series::Series;
|
|
11
|
-
use rayon::iter::{
|
|
11
|
+
use rayon::iter::{IntoParallelRefIterator, ParallelIterator};
|
|
12
12
|
use std::borrow::Cow;
|
|
13
13
|
|
|
14
14
|
impl CatEncs {
|
|
15
|
-
pub fn
|
|
15
|
+
pub fn decode_series(&self, ser: &Series) -> Series {
|
|
16
16
|
let original_name = ser.name().clone();
|
|
17
17
|
let uch: Vec<_> = ser.u32().unwrap().iter().collect();
|
|
18
|
-
let
|
|
19
|
-
.into_par_iter()
|
|
20
|
-
.map(|x| x.map(|x| self.rev_map.get(&x).unwrap()));
|
|
21
|
-
|
|
22
|
-
let decoded_vec: Vec<_> = decoded_vec_iter.map(|x| x.map(|x| x.as_str())).collect();
|
|
18
|
+
let decoded_vec = self.maps.decode_batch(uch.as_ref());
|
|
23
19
|
let new_ser = Series::new(original_name, decoded_vec);
|
|
24
|
-
//
|
|
25
|
-
// let mut new_ser = if let CatType::Prefix(pre) = cat_type {
|
|
26
|
-
// Series::from_iter(decoded_ser.map(|x| x.map(|x| format!("{}{}", pre.as_str(), x))))
|
|
27
|
-
// } else {
|
|
28
|
-
// Series::from_iter(decoded_ser.map(|x| x.map(|x| x.as_str())))
|
|
29
|
-
// };
|
|
30
20
|
new_ser
|
|
31
21
|
}
|
|
32
22
|
|
|
33
23
|
pub fn maybe_decode_string(&self, u: &u32) -> Option<&str> {
|
|
34
|
-
self.
|
|
24
|
+
self.maps.maybe_decode(u)
|
|
35
25
|
}
|
|
36
26
|
}
|
|
37
27
|
|
|
@@ -68,7 +58,7 @@ impl Cats {
|
|
|
68
58
|
pub fn decode_of_type(&self, ser: &Series, bt: &BaseRDFNodeType) -> Series {
|
|
69
59
|
let ct = CatType::from_base_rdf_node_type(bt);
|
|
70
60
|
if let Some(enc) = self.cat_map.get(&ct) {
|
|
71
|
-
enc.
|
|
61
|
+
enc.decode_series(ser)
|
|
72
62
|
} else {
|
|
73
63
|
unreachable!("Should never be called when type does not exist")
|
|
74
64
|
}
|
|
@@ -120,6 +110,9 @@ impl Cats {
|
|
|
120
110
|
local_cats: Option<LockedCats>,
|
|
121
111
|
) -> Series {
|
|
122
112
|
let local = local_cats.as_ref().map(|x| x.read().unwrap());
|
|
113
|
+
if ser.dtype() != &DataType::UInt32 {
|
|
114
|
+
panic!("Series should have datatype UInt32 {:?}", ser);
|
|
115
|
+
}
|
|
123
116
|
let u32s = ser.u32().unwrap();
|
|
124
117
|
let us: Vec<_> = u32s.iter().collect();
|
|
125
118
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
use super::{CatEncs, CatType, Cats, EncodedTriples};
|
|
2
|
+
use crate::cats::maps::CatMaps;
|
|
2
3
|
use crate::cats::LockedCats;
|
|
3
4
|
use crate::solution_mapping::{BaseCatState, EagerSolutionMappings};
|
|
4
5
|
use crate::{BaseRDFNodeType, RDFNodeState, OBJECT_COL_NAME, SUBJECT_COL_NAME};
|
|
@@ -6,34 +7,22 @@ use oxrdf::NamedNode;
|
|
|
6
7
|
use polars::frame::DataFrame;
|
|
7
8
|
use polars::prelude::{col, lit, IntoLazy, Series};
|
|
8
9
|
use std::collections::HashMap;
|
|
9
|
-
use std::
|
|
10
|
-
use std::sync::Arc;
|
|
10
|
+
use std::path::Path;
|
|
11
11
|
|
|
12
12
|
impl CatEncs {
|
|
13
|
-
pub fn new_empty() -> CatEncs {
|
|
14
|
-
let rev_map = HashMap::with_capacity_and_hasher(2, BuildHasherDefault::default());
|
|
13
|
+
pub fn new_empty(path: Option<&Path>) -> CatEncs {
|
|
15
14
|
CatEncs {
|
|
16
|
-
|
|
17
|
-
rev_map,
|
|
15
|
+
maps: CatMaps::new_empty(path),
|
|
18
16
|
}
|
|
19
17
|
}
|
|
20
18
|
|
|
21
|
-
pub fn
|
|
22
|
-
let
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
pub fn new_singular(value: &str, u: u32) -> CatEncs {
|
|
27
|
-
let mut sing = Self::new_empty();
|
|
28
|
-
let s = Arc::new(value.to_string());
|
|
29
|
-
sing.map.insert(s.clone(), u);
|
|
30
|
-
sing.rev_map.insert(u, s);
|
|
31
|
-
sing
|
|
19
|
+
pub fn new_singular(value: &str, u: u32, path: Option<&Path>) -> CatEncs {
|
|
20
|
+
let maps = CatMaps::new_singular(value, u, path);
|
|
21
|
+
CatEncs { maps }
|
|
32
22
|
}
|
|
33
23
|
|
|
34
24
|
pub fn maybe_encode_str(&self, s: &str) -> Option<&u32> {
|
|
35
|
-
|
|
36
|
-
self.map.get(&s)
|
|
25
|
+
self.maps.maybe_encode_str(s)
|
|
37
26
|
}
|
|
38
27
|
|
|
39
28
|
pub fn encode_new_str(&mut self, s: &str, u: u32) {
|
|
@@ -41,23 +30,20 @@ impl CatEncs {
|
|
|
41
30
|
}
|
|
42
31
|
|
|
43
32
|
pub fn encode_new_string(&mut self, s: String, u: u32) {
|
|
44
|
-
|
|
45
|
-
self.map.insert(s.clone(), u);
|
|
46
|
-
self.rev_map.insert(u, s);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
pub fn encode_new_arc_string(&mut self, s: Arc<String>, u: u32) {
|
|
50
|
-
self.map.insert(s.clone(), u);
|
|
51
|
-
self.rev_map.insert(u, s);
|
|
33
|
+
self.maps.encode_new_string(s, u);
|
|
52
34
|
}
|
|
53
35
|
|
|
54
|
-
pub fn
|
|
55
|
-
self.
|
|
36
|
+
pub fn counter(&self) -> u32 {
|
|
37
|
+
self.maps.counter()
|
|
56
38
|
}
|
|
57
39
|
}
|
|
58
40
|
|
|
59
41
|
impl Cats {
|
|
60
|
-
pub fn encode_solution_mappings(
|
|
42
|
+
pub fn encode_solution_mappings(
|
|
43
|
+
&self,
|
|
44
|
+
sm: EagerSolutionMappings,
|
|
45
|
+
path: Option<&Path>,
|
|
46
|
+
) -> EagerSolutionMappings {
|
|
61
47
|
let EagerSolutionMappings {
|
|
62
48
|
mappings,
|
|
63
49
|
mut rdf_node_types,
|
|
@@ -87,7 +73,7 @@ impl Cats {
|
|
|
87
73
|
let encoded: Vec<_> = to_encode
|
|
88
74
|
.into_iter()
|
|
89
75
|
.map(|(c, t, ser)| {
|
|
90
|
-
let (enc, local) = self.encode_series(&ser, &t);
|
|
76
|
+
let (enc, local) = self.encode_series(&ser, &t, path);
|
|
91
77
|
(c, t, enc, local)
|
|
92
78
|
})
|
|
93
79
|
.collect();
|
|
@@ -109,7 +95,12 @@ impl Cats {
|
|
|
109
95
|
EagerSolutionMappings::new(mappings.collect().unwrap(), rdf_node_types)
|
|
110
96
|
}
|
|
111
97
|
|
|
112
|
-
pub fn encode_series(
|
|
98
|
+
pub fn encode_series(
|
|
99
|
+
&self,
|
|
100
|
+
series: &Series,
|
|
101
|
+
t: &BaseRDFNodeType,
|
|
102
|
+
path: Option<&Path>,
|
|
103
|
+
) -> (Series, Option<Cats>) {
|
|
113
104
|
let original_name = series.name().clone();
|
|
114
105
|
let mut use_height = match t {
|
|
115
106
|
BaseRDFNodeType::IRI => self.iri_counter,
|
|
@@ -121,7 +112,7 @@ impl Cats {
|
|
|
121
112
|
};
|
|
122
113
|
|
|
123
114
|
let enc = self.get_encs(t).pop();
|
|
124
|
-
let mut new_enc = CatEncs::new_empty();
|
|
115
|
+
let mut new_enc = CatEncs::new_empty(path);
|
|
125
116
|
let strch = series.str().unwrap();
|
|
126
117
|
let encoded_global: Vec<_> = strch
|
|
127
118
|
.iter()
|
|
@@ -158,7 +149,7 @@ impl Cats {
|
|
|
158
149
|
};
|
|
159
150
|
encoded_global_local.push(encoded);
|
|
160
151
|
}
|
|
161
|
-
let local = if !new_enc.
|
|
152
|
+
let local = if !new_enc.maps.is_empty() {
|
|
162
153
|
let cat_type = CatType::from_base_rdf_node_type(t);
|
|
163
154
|
let mut map = HashMap::new();
|
|
164
155
|
map.insert(cat_type, new_enc);
|
|
@@ -212,7 +203,7 @@ impl Cats {
|
|
|
212
203
|
u32s
|
|
213
204
|
}
|
|
214
205
|
|
|
215
|
-
pub fn encode_iri_or_local_cat(&self, iri: &str) -> (u32, RDFNodeState) {
|
|
206
|
+
pub fn encode_iri_or_local_cat(&self, iri: &str, path: Option<&Path>) -> (u32, RDFNodeState) {
|
|
216
207
|
let mut v = self.encode_iri_slice(&[iri]);
|
|
217
208
|
if let Some(u) = v.pop().unwrap() {
|
|
218
209
|
(
|
|
@@ -223,7 +214,7 @@ impl Cats {
|
|
|
223
214
|
),
|
|
224
215
|
)
|
|
225
216
|
} else {
|
|
226
|
-
let (u, l) = Cats::new_singular_iri(iri, self.iri_counter);
|
|
217
|
+
let (u, l) = Cats::new_singular_iri(iri, self.iri_counter, path);
|
|
227
218
|
(
|
|
228
219
|
u,
|
|
229
220
|
RDFNodeState::from_bases(
|
|
@@ -234,7 +225,11 @@ impl Cats {
|
|
|
234
225
|
}
|
|
235
226
|
}
|
|
236
227
|
|
|
237
|
-
pub fn encode_blank_or_local_cat(
|
|
228
|
+
pub fn encode_blank_or_local_cat(
|
|
229
|
+
&self,
|
|
230
|
+
blank: &str,
|
|
231
|
+
path: Option<&Path>,
|
|
232
|
+
) -> (u32, RDFNodeState) {
|
|
238
233
|
let mut v = self.encode_blanks(&[blank]);
|
|
239
234
|
if let Some(u) = v.pop().unwrap() {
|
|
240
235
|
(
|
|
@@ -245,7 +240,7 @@ impl Cats {
|
|
|
245
240
|
),
|
|
246
241
|
)
|
|
247
242
|
} else {
|
|
248
|
-
let (u, l) = Cats::new_singular_blank(blank, self.blank_counter);
|
|
243
|
+
let (u, l) = Cats::new_singular_blank(blank, self.blank_counter, path);
|
|
249
244
|
(
|
|
250
245
|
u,
|
|
251
246
|
RDFNodeState::from_bases(
|
|
@@ -264,6 +259,7 @@ pub fn encode_triples(
|
|
|
264
259
|
subject_cat_state: BaseCatState,
|
|
265
260
|
object_cat_state: BaseCatState,
|
|
266
261
|
global_cats: &Cats,
|
|
262
|
+
path: Option<&Path>,
|
|
267
263
|
) -> (Vec<LockedCats>, EncodedTriples) {
|
|
268
264
|
let mut map = HashMap::new();
|
|
269
265
|
map.insert(
|
|
@@ -274,7 +270,7 @@ pub fn encode_triples(
|
|
|
274
270
|
OBJECT_COL_NAME.to_string(),
|
|
275
271
|
RDFNodeState::from_bases(object_type.clone(), object_cat_state),
|
|
276
272
|
);
|
|
277
|
-
let mut sm = global_cats.encode_solution_mappings(EagerSolutionMappings::new(df, map));
|
|
273
|
+
let mut sm = global_cats.encode_solution_mappings(EagerSolutionMappings::new(df, map), path);
|
|
278
274
|
|
|
279
275
|
let mut subject_state = sm.rdf_node_types.remove(SUBJECT_COL_NAME).unwrap();
|
|
280
276
|
let mut object_state = sm.rdf_node_types.remove(OBJECT_COL_NAME).unwrap();
|
|
@@ -1,34 +1,38 @@
|
|
|
1
1
|
use super::{encode_triples, re_encode, CatEncs, CatTriples, CatType, Cats};
|
|
2
|
+
use crate::dataset::NamedGraph;
|
|
2
3
|
use crate::solution_mapping::BaseCatState;
|
|
3
4
|
use crate::BaseRDFNodeType;
|
|
4
5
|
use oxrdf::NamedNode;
|
|
5
6
|
use polars::frame::DataFrame;
|
|
6
|
-
use std::
|
|
7
|
+
use std::path::Path;
|
|
7
8
|
use tracing::instrument;
|
|
8
9
|
|
|
9
10
|
impl Cats {
|
|
10
|
-
pub fn globalize(
|
|
11
|
+
pub fn globalize(
|
|
12
|
+
&mut self,
|
|
13
|
+
mut cat_triples: Vec<CatTriples>,
|
|
14
|
+
path: Option<&Path>,
|
|
15
|
+
) -> Vec<CatTriples> {
|
|
11
16
|
let local_cats: Vec<_> = cat_triples
|
|
12
17
|
.iter_mut()
|
|
13
18
|
.map(|x| x.local_cats.drain(..))
|
|
14
19
|
.flatten()
|
|
15
20
|
.collect();
|
|
16
|
-
let re_enc_map = self.merge(local_cats);
|
|
21
|
+
let re_enc_map = self.merge(local_cats, path);
|
|
17
22
|
let global_cat_triples = re_encode(cat_triples, re_enc_map);
|
|
18
23
|
global_cat_triples
|
|
19
24
|
}
|
|
20
25
|
|
|
21
|
-
pub fn encode_predicates(&mut self, cat_triples: &Vec<CatTriples>) {
|
|
26
|
+
pub fn encode_predicates(&mut self, cat_triples: &Vec<CatTriples>, path: Option<&Path>) {
|
|
22
27
|
for ct in cat_triples {
|
|
23
28
|
let t = CatType::IRI;
|
|
24
29
|
if !self.cat_map.contains_key(&t) {
|
|
25
|
-
self.cat_map.insert(t.clone(), CatEncs::new_empty());
|
|
30
|
+
self.cat_map.insert(t.clone(), CatEncs::new_empty(path));
|
|
26
31
|
}
|
|
27
32
|
let enc = self.cat_map.get_mut(&t).unwrap();
|
|
28
33
|
let pred = ct.predicate.as_str().to_string();
|
|
29
|
-
if !enc.
|
|
30
|
-
|
|
31
|
-
enc.encode_new_arc_string(arc_pred.clone(), self.iri_counter);
|
|
34
|
+
if !enc.maps.contains_str(&pred) {
|
|
35
|
+
enc.encode_new_string(pred, self.iri_counter);
|
|
32
36
|
self.iri_counter += 1;
|
|
33
37
|
}
|
|
34
38
|
}
|
|
@@ -41,9 +45,11 @@ pub fn cat_encode_triples(
|
|
|
41
45
|
subject_type: BaseRDFNodeType,
|
|
42
46
|
object_type: BaseRDFNodeType,
|
|
43
47
|
predicate: NamedNode,
|
|
48
|
+
graph: NamedGraph,
|
|
44
49
|
subject_cat_state: BaseCatState,
|
|
45
50
|
object_cat_state: BaseCatState,
|
|
46
51
|
global_cats: &Cats,
|
|
52
|
+
path: Option<&Path>,
|
|
47
53
|
) -> CatTriples {
|
|
48
54
|
let (local_cats, encoded_triples) = encode_triples(
|
|
49
55
|
df,
|
|
@@ -52,11 +58,13 @@ pub fn cat_encode_triples(
|
|
|
52
58
|
subject_cat_state,
|
|
53
59
|
object_cat_state,
|
|
54
60
|
global_cats,
|
|
61
|
+
path,
|
|
55
62
|
);
|
|
56
63
|
|
|
57
64
|
CatTriples {
|
|
58
65
|
encoded_triples,
|
|
59
66
|
predicate,
|
|
67
|
+
graph,
|
|
60
68
|
subject_type,
|
|
61
69
|
object_type,
|
|
62
70
|
local_cats,
|