1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 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 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 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 661 662 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 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 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
|
Description: avoid not-in-Debian crates rustemo rustemo-compiler
Author: Jonas Smedegaard <dr@jones.dk>
Forwarded: not-needed
Last-Update: 2025-11-08
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -4,7 +4,6 @@
"dctap",
"iri_s",
"mie",
- "pgschema",
"prefixmap",
"python",
"rbe",
@@ -288,7 +287,6 @@
oxsdatatypes = "0.2.2"
oxttl = { version = "0.2.0", features = ["rdf-12"] }
paste = "1.0.15"
-pgschema = { version = "0.1.5", path = "./pgschema" }
petgraph = { version = ">= 0.6.4, <= 0.8" }
prefixmap = { version = "0.2.3", path = "./prefixmap" }
pretty = { version = "0.12" }
--- a/rudof_cli/Cargo.toml
+++ b/rudof_cli/Cargo.toml
@@ -21,7 +21,6 @@
iri_s.workspace = true
is_ci.workspace = true
oxrdf.workspace = true
-pgschema.workspace = true
prefixmap.workspace = true
rudof_rdf.workspace = true
rdf_config.workspace = true
--- a/rudof_cli/src/cli/parser.rs
+++ b/rudof_cli/src/cli/parser.rs
@@ -1,7 +1,7 @@
use crate::cli::wrappers::{
DCTapFormatCli, DCTapResultFormatCli, DataFormatCli, GenerateSchemaFormatCli, InputCompareFormatCli,
InputCompareModeCli, InputConvertFormatCli, InputConvertModeCli, OutputConvertFormatCli, OutputConvertModeCli,
- PgSchemaFormatCli, PgSchemaResultFormatCli, QueryTypeCli, RDFReaderModeCli, RdfConfigFormatCli,
+ QueryTypeCli, RDFReaderModeCli, RdfConfigFormatCli,
RdfConfigResultFormatCli, ResultCompareFormatCli, ResultDataFormatCli, ResultQueryFormatCli,
ResultServiceFormatCli, ResultShExValidationFormatCli, ResultShaclValidationFormatCli, ResultValidationFormatCli,
ShExFormatCli, ShaclFormatCli, ShaclValidationModeCli, ShapeMapFormatCli, ShowNodeModeCli, SortByResultShapeMapCli,
@@ -39,8 +39,6 @@
Shapemap(ShapemapArgs),
/// Show information about ShEx schemas
Shex(ShexArgs),
- /// Show information about Property Graph Schemas
- Pgschema(PgschemaArgs),
/// Validate RDF data using ShEx or SHACL
Validate(ValidateArgs),
/// Validate RDF using ShEx schemas
@@ -70,8 +68,6 @@
Query(QueryArgs),
/// Generate synthetic RDF data from ShEx or SHACL schemas
Generate(GenerateArgs),
- /// Validate Property Graph data using PGSchema
- PgSchemaValidate(PgSchemaValidateArgs),
/// Generates a shell completion script for the specified shell
Completion(CompletionArgs),
}
@@ -293,49 +289,6 @@
pub common: CommonArgsAll,
}
-/// Arguments for the `pgschema` command
-#[derive(Debug, Clone, Args)]
-pub struct PgschemaArgs {
- #[arg(
- short = 's',
- long = "schema",
- value_name = "INPUT",
- help = "Schema, FILE, URI or - for stdin"
- )]
- pub schema: InputSpec,
-
- #[arg(
- short = 'f',
- long = "format",
- value_name = "FORMAT",
- ignore_case = true,
- help = "PGSchema format",
- default_value_t = PgSchemaFormatCli::PgSchemaC,
- value_enum
- )]
- pub schema_format: PgSchemaFormatCli,
-
- #[arg(
- short = 'r',
- long = "result-format",
- ignore_case = true,
- value_name = "FORMAT",
- help = "Result schema format",
- default_value_t = PgSchemaFormatCli::PgSchemaC,
- value_enum
- )]
- pub result_schema_format: PgSchemaFormatCli,
-
- #[arg(short = 't', value_name = "BOOL", help = "Show processing time", long = "show-time")]
- pub show_time: Option<bool>,
-
- #[arg(long = "show-schema", value_name = "BOOL", help = "Show schema")]
- pub show_schema: Option<bool>,
-
- #[command(flatten)]
- pub common: CommonArgsAll,
-}
-
/// Arguments for the `validate` command
#[derive(Debug, Clone, Args)]
pub struct ValidateArgs {
@@ -1282,61 +1235,6 @@
pub common: CommonArgsAll,
}
-/// Arguments for the `pgschema-validate` command
-#[derive(Debug, Clone, Args)]
-pub struct PgSchemaValidateArgs {
- #[arg(
- short = 's',
- long = "schema",
- value_name = "INPUT",
- help = "PGSchema file, URI or - (for stdin)"
- )]
- pub schema: Option<InputSpec>,
-
- #[clap(value_parser = clap::value_parser!(InputSpec))]
- pub data: Vec<InputSpec>,
-
- #[arg(
- short = 't',
- long = "data-format",
- value_name = "FORMAT",
- ignore_case = true,
- help = "Property Graph data format",
- default_value_t = DataFormatCli::Pg
- )]
- pub data_format: DataFormatCli,
-
- #[arg(
- short = 'm',
- long = "shapemap",
- value_name = "INPUT",
- help = "ShapeMap used for validation, FILE, URI or - for stdin"
- )]
- pub shapemap: Option<InputSpec>,
-
- #[arg(
- long = "shapemap-format",
- value_name = "FORMAT",
- ignore_case = true,
- help = "ShapeMap format",
- default_value_t = ShapeMapFormatCli::Compact,
- )]
- pub shapemap_format: ShapeMapFormatCli,
-
- #[arg(
- short = 'r',
- long = "result-format",
- ignore_case = true,
- value_name = "FORMAT",
- help = "Output result format",
- default_value_t = PgSchemaResultFormatCli::Compact
- )]
- pub result_validation_format: PgSchemaResultFormatCli,
-
- #[command(flatten)]
- pub common: CommonArgsOutputForceOverWrite,
-}
-
/// Arguments for the `completion` command
#[derive(Debug, Clone, Args)]
pub struct CompletionArgs {
--- a/rudof_cli/src/cli/wrappers.rs
+++ b/rudof_cli/src/cli/wrappers.rs
@@ -9,7 +9,6 @@
dctap_format::DCTapFormat,
dctap_result_format::DCTapResultFormat,
generate_schema_format::GenerateSchemaFormat,
- pgschema_format::{PgSchemaFormat, PgSchemaResultFormat},
query_result_format::ResultQueryFormat,
query_type::QueryType,
rdf_config::{RdfConfigFormat, RdfConfigResultFormat},
@@ -170,12 +169,6 @@
}
);
-// CLI wrapper for rudof_lib::pgschema_format::PgSchemaFormat.
-cli_wrapper!(PgSchemaFormatCli, PgSchemaFormat, { PgSchemaC });
-
-// CLI wrapper for rudof_lib::pgschema_format::PgSchemaResultFormat.
-cli_wrapper!(PgSchemaResultFormatCli, PgSchemaResultFormat, { Compact, Details, Json, Csv });
-
// CLI wrapper for rudof_lib::validation_mode::ValidationMode.
cli_wrapper!(
ValidationModeCli,
@@ -183,7 +176,6 @@
{
ShEx,
Shacl,
- PGSchema
}
);
@@ -209,7 +201,6 @@
N3,
NQuads,
JsonLd,
- Pg
},
with_mime_type
);
@@ -601,26 +592,6 @@
}
}
}
-
-// Convert ResultValidationFormatCli -> PgSchemaResultFormatCli
-impl TryFrom<ResultValidationFormatCli> for PgSchemaResultFormatCli {
- type Error = anyhow::Error;
-
- fn try_from(val: ResultValidationFormatCli) -> AnyhowResult<Self, Self::Error> {
- match val {
- ResultValidationFormatCli::Compact => Ok(PgSchemaResultFormatCli::Compact),
- ResultValidationFormatCli::Details => Ok(PgSchemaResultFormatCli::Details),
- ResultValidationFormatCli::Json => Ok(PgSchemaResultFormatCli::Json),
- ResultValidationFormatCli::Csv => Ok(PgSchemaResultFormatCli::Csv),
- ResultValidationFormatCli::Turtle => todo!("PGSchema validation doesn't support Turtle result format"),
- ResultValidationFormatCli::NTriples => todo!("PGSchema validation doesn't support NTriples result format"),
- ResultValidationFormatCli::RdfXml => todo!("PGSchema validation doesn't support RDF/XML result format"),
- ResultValidationFormatCli::TriG => todo!("PGSchema validation doesn't support TriG result format"),
- ResultValidationFormatCli::N3 => todo!("PGSchema validation doesn't support N3 result format"),
- ResultValidationFormatCli::NQuads => todo!("PGSchema validation doesn't support NQuads result format"),
- }
- }
-}
// Convert InputConvertFormatCli -> ShexFormatCli
impl TryFrom<InputConvertFormatCli> for ShExFormatCli {
--- a/rudof_cli/src/commands/base.rs
+++ b/rudof_cli/src/commands/base.rs
@@ -1,7 +1,7 @@
use crate::cli::parser::{Command as CliCommand, CommonArgs, CommonArgsAll, CommonArgsOutputForceOverWrite};
use crate::commands::{
CompareCommand, CompletionCommand, ConvertCommand, DataCommand, DctapCommand, GenerateCommand,
- NodeCommand, PgSchemaValidateCommand, PgschemaCommand, QueryCommand, RdfConfigCommand, ServiceCommand,
+ NodeCommand, QueryCommand, RdfConfigCommand, ServiceCommand,
ShaclCommand, ShaclValidateCommand, ShapemapCommand, ShexCommand, ShexValidateCommand, ValidateCommand,
};
use crate::output::{ColorSupport, get_writer};
@@ -102,7 +102,6 @@
match cli_command {
CliCommand::Shapemap(args) => Ok(Box::new(ShapemapCommand::new(args))),
CliCommand::Shex(args) => Ok(Box::new(ShexCommand::new(args))),
- CliCommand::Pgschema(args) => Ok(Box::new(PgschemaCommand::new(args))),
CliCommand::Validate(args) => Ok(Box::new(ValidateCommand::new(args))),
CliCommand::ShexValidate(args) => Ok(Box::new(ShexValidateCommand::new(args))),
CliCommand::ShaclValidate(args) => Ok(Box::new(ShaclValidateCommand::new(args))),
@@ -116,7 +115,6 @@
CliCommand::Service(args) => Ok(Box::new(ServiceCommand::new(args))),
CliCommand::Query(args) => Ok(Box::new(QueryCommand::new(args))),
CliCommand::Generate(args) => Ok(Box::new(GenerateCommand::new(args))),
- CliCommand::PgSchemaValidate(args) => Ok(Box::new(PgSchemaValidateCommand::new(args))),
CliCommand::Completion(args) => Ok(Box::new(CompletionCommand::new(args))),
}
}
@@ -138,11 +136,6 @@
output: a.common.output.clone(),
force_overwrite: a.common.force_overwrite,
}),
- CliCommand::Pgschema(a) => CommonArgs::All(CommonArgsAll {
- config: a.common.config.clone(),
- output: a.common.output.clone(),
- force_overwrite: a.common.force_overwrite,
- }),
CliCommand::Validate(a) => CommonArgs::All(CommonArgsAll {
config: a.common.config.clone(),
output: a.common.output.clone(),
@@ -208,10 +201,6 @@
output: a.common.output.clone(),
force_overwrite: a.common.force_overwrite,
}),
- CliCommand::PgSchemaValidate(a) => CommonArgs::OutputForceOverWrite(CommonArgsOutputForceOverWrite {
- output: a.common.output.clone(),
- force_overwrite: a.common.force_overwrite,
- }),
CliCommand::Completion(a) => CommonArgs::OutputForceOverWrite(CommonArgsOutputForceOverWrite {
output: a.common.output.clone(),
force_overwrite: a.common.force_overwrite,
--- a/rudof_cli/src/commands/mod.rs
+++ b/rudof_cli/src/commands/mod.rs
@@ -6,8 +6,6 @@
mod dctap;
mod generate;
mod node;
-mod pgschema;
-mod pgschema_validate;
mod query;
mod rdf_config;
mod service;
@@ -26,8 +24,6 @@
pub use dctap::DctapCommand;
pub use generate::GenerateCommand;
pub use node::NodeCommand;
-pub use pgschema::PgschemaCommand;
-pub use pgschema_validate::PgSchemaValidateCommand;
pub use query::QueryCommand;
pub use rdf_config::RdfConfigCommand;
pub use service::ServiceCommand;
--- a/rudof_cli/src/commands/pgschema.rs
+++ /dev/null
@@ -1,36 +0,0 @@
-use crate::cli::parser::PgschemaArgs;
-use crate::commands::base::{Command, CommandContext};
-use anyhow::Result;
-
-/// Implementation of the `pgschema` command.
-///
-/// This struct holds the specific arguments parsed by `clap` and
-/// implements the [Command] trait to execute Property Graph Schema logic.
-pub struct PgschemaCommand {
- /// Arguments specific to Property Graph Schema command.
- args: PgschemaArgs,
-}
-
-impl PgschemaCommand {
- pub fn new(args: PgschemaArgs) -> Self {
- Self { args }
- }
-}
-
-impl Command for PgschemaCommand {
- /// Returns the unique identifier for this command.
- fn name(&self) -> &'static str {
- "pgschema"
- }
-
- /// Executes the Property Graph Schema command logic.
- fn execute(&self, ctx: &mut CommandContext) -> Result<()> {
- let mut reader = self.args.schema.open_read(None, "PGSchema")?;
-
- let schema = ctx.rudof.get_schema(&mut reader)?;
-
- write!(ctx.writer, "{schema}")?;
-
- Ok(())
- }
-}
--- a/rudof_cli/src/commands/pgschema_validate.rs
+++ /dev/null
@@ -1,73 +0,0 @@
-use crate::cli::parser::PgSchemaValidateArgs;
-use crate::commands::base::{Command, CommandContext};
-use anyhow::Result;
-use rudof_lib::{data_format::DataFormat, pgschema_format::PgSchemaResultFormat};
-
-/// Implementation of the `pgschema-validate` command.
-///
-/// This struct holds the specific arguments parsed by `clap` and
-/// implements the [Command] trait to execute PgSchema Validate command logic.
-pub struct PgSchemaValidateCommand {
- /// Arguments specific to PgSchema Validate command.
- args: PgSchemaValidateArgs,
-}
-
-impl PgSchemaValidateCommand {
- pub fn new(args: PgSchemaValidateArgs) -> Self {
- Self { args }
- }
-}
-
-impl Command for PgSchemaValidateCommand {
- /// Returns the unique identifier for this command.
- fn name(&self) -> &'static str {
- "pgschema-validate"
- }
-
- /// Executes the PgSchema Validate command logic.
- fn execute(&self, ctx: &mut CommandContext) -> Result<()> {
- // Convert CLI types to library types
- let data_format: DataFormat = (&self.args.data_format).into();
- let result_format: PgSchemaResultFormat = (&self.args.result_validation_format).into();
-
- // Load PG data from all sources and merge them
- let graph = ctx.rudof.load_pg_data(&self.args.data, &data_format)?;
-
- // Load schema (required)
- let schema_input = self
- .args
- .schema
- .as_ref()
- .ok_or_else(|| anyhow::anyhow!("Schema must be provided for PGSchema validation"))?;
- let schema = ctx.rudof.load_pg_schema(schema_input)?;
-
- // Load type map (required)
- let map_input = self
- .args
- .shapemap
- .as_ref()
- .ok_or_else(|| anyhow::anyhow!("Type map must be provided for PGSchema validation"))?;
- let type_map = ctx.rudof.load_pg_typemap(map_input)?;
-
- // Perform validation
- let result = ctx.rudof.validate_pgschema(&schema, &graph, &type_map)?;
-
- // Output results based on format
- match result_format {
- PgSchemaResultFormat::Compact => {
- write!(ctx.writer, "{}", result)?;
- },
- PgSchemaResultFormat::Json => {
- result.as_json(&mut ctx.writer)?;
- },
- PgSchemaResultFormat::Csv => {
- result.as_csv(&mut ctx.writer, true)?;
- },
- PgSchemaResultFormat::Details => {
- anyhow::bail!("Details format not yet implemented for PGSchema validation");
- },
- }
-
- Ok(())
- }
-}
--- a/rudof_cli/src/commands/validate.rs
+++ b/rudof_cli/src/commands/validate.rs
@@ -1,9 +1,9 @@
use crate::cli::parser::{
- CommonArgsOutputForceOverWrite, PgSchemaValidateArgs, ShaclValidateArgs, ShexValidateArgs, ValidateArgs,
+ CommonArgsOutputForceOverWrite, ShaclValidateArgs, ShexValidateArgs, ValidateArgs,
};
use crate::cli::wrappers::ValidationModeCli;
use crate::commands::{
- PgSchemaValidateCommand, ShaclValidateCommand, ShexValidateCommand,
+ ShaclValidateCommand, ShexValidateCommand,
base::{Command, CommandContext},
};
use anyhow::Result;
@@ -60,22 +60,6 @@
common: self.args.common.clone(),
}
}
-
- /// Convert ValidateArgs to PgSchemaValidateArgs
- fn to_pgschema_args(&self) -> PgSchemaValidateArgs {
- PgSchemaValidateArgs {
- schema: self.args.schema.clone(),
- data: self.args.data.clone(),
- data_format: self.args.data_format.clone(),
- shapemap: self.args.shapemap.clone(),
- shapemap_format: self.args.shapemap_format.clone(),
- result_validation_format: self.args.result_format.clone().try_into().unwrap(),
- common: CommonArgsOutputForceOverWrite {
- output: self.args.common.output.clone(),
- force_overwrite: self.args.common.force_overwrite,
- },
- }
- }
}
impl Command for ValidateCommand {
@@ -97,11 +81,6 @@
let cmd = ShaclValidateCommand::new(shacl_args);
cmd.execute(ctx)
},
- ValidationModeCli::PGSchema => {
- let pgschema_args = self.to_pgschema_args();
- let cmd = PgSchemaValidateCommand::new(pgschema_args);
- cmd.execute(ctx)
- },
}
}
}
--- a/rudof_lib/Cargo.toml
+++ b/rudof_lib/Cargo.toml
@@ -27,7 +27,6 @@
mie.workspace = true
oxrdf = { workspace = true, features = ["oxsdatatypes"] }
prefixmap.workspace = true
-pgschema.workspace = true
rdf_config.workspace = true
reqwest.workspace = true
serde.workspace = true
--- a/rudof_lib/src/data.rs
+++ b/rudof_lib/src/data.rs
@@ -26,9 +26,6 @@
DataFormat::TriG => Ok(RDFFormat::TriG),
DataFormat::Turtle => Ok(RDFFormat::Turtle),
DataFormat::JsonLd => Ok(RDFFormat::JsonLd),
- DataFormat::Pg => Err(DataFormatError::NonRdfFormat {
- format: data_format.to_string(),
- }),
}
}
--- a/rudof_lib/src/data_format.rs
+++ b/rudof_lib/src/data_format.rs
@@ -15,7 +15,6 @@
N3,
NQuads,
JsonLd,
- Pg,
}
#[derive(Error, Clone, Debug)]
@@ -39,9 +38,6 @@
DataFormat::N3 => Ok(RDFFormat::N3),
DataFormat::NQuads => Ok(RDFFormat::NQuads),
DataFormat::JsonLd => Ok(RDFFormat::JsonLd),
- DataFormat::Pg => Err(DataFormatError::NonRdfFormat {
- format: value.to_string(),
- }),
}
}
}
@@ -78,7 +74,6 @@
DataFormat::N3 => write!(dest, "n3"),
DataFormat::NQuads => write!(dest, "nquads"),
DataFormat::JsonLd => write!(dest, "jsonld"),
- DataFormat::Pg => write!(dest, "pg"),
}
}
}
@@ -95,7 +90,6 @@
"n3" => Ok(DataFormat::N3),
"nquads" => Ok(DataFormat::NQuads),
"jsonld" => Ok(DataFormat::JsonLd),
- "pg" => Ok(DataFormat::Pg),
other => Err(DataFormatError::UnknownFormat {
format: other.to_string(),
}),
@@ -113,7 +107,6 @@
DataFormat::N3 => "text/n3",
DataFormat::NQuads => "application/n-quads",
DataFormat::JsonLd => "application/ld+json",
- DataFormat::Pg => "application/pg",
}
}
}
--- a/rudof_lib/src/lib.rs
+++ b/rudof_lib/src/lib.rs
@@ -11,7 +11,6 @@
pub mod generate_schema_format;
pub mod input_spec;
pub mod node_info;
-pub mod pgschema_format;
pub mod query;
pub mod query_result_format;
pub mod query_type;
--- a/rudof_lib/src/pgschema_format.rs
+++ /dev/null
@@ -1,65 +0,0 @@
-use clap::ValueEnum;
-use std::{
- fmt::{Display, Formatter},
- str::FromStr,
-};
-
-#[derive(Clone, Copy, Debug, PartialEq, Eq, Default)]
-pub enum PgSchemaFormat {
- #[default]
- PgSchemaC,
-}
-
-impl Display for PgSchemaFormat {
- fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
- match self {
- PgSchemaFormat::PgSchemaC => write!(f, "compact"),
- }
- }
-}
-
-impl FromStr for PgSchemaFormat {
- type Err = String;
-
- fn from_str(s: &str) -> Result<Self, Self::Err> {
- match s.to_lowercase().as_str() {
- "compact" | "pgschemac" => Ok(PgSchemaFormat::PgSchemaC),
- other => Err(format!("Unknown PgSchema format: {}", other)),
- }
- }
-}
-
-#[derive(Clone, Copy, Debug, PartialEq, Eq, ValueEnum, Default)]
-pub enum PgSchemaResultFormat {
- #[default]
- Compact,
- Details,
- Json,
- Csv,
-}
-
-impl Display for PgSchemaResultFormat {
- fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
- let s = match self {
- PgSchemaResultFormat::Compact => "compact",
- PgSchemaResultFormat::Details => "details",
- PgSchemaResultFormat::Json => "json",
- PgSchemaResultFormat::Csv => "csv",
- };
- write!(f, "{}", s)
- }
-}
-
-impl FromStr for PgSchemaResultFormat {
- type Err = String;
-
- fn from_str(s: &str) -> Result<Self, Self::Err> {
- match s.to_lowercase().as_str() {
- "compact" => Ok(PgSchemaResultFormat::Compact),
- "details" => Ok(PgSchemaResultFormat::Details),
- "json" => Ok(PgSchemaResultFormat::Json),
- "csv" => Ok(PgSchemaResultFormat::Csv),
- _ => Err(format!("Unknown PgSchemaResultFormat: {}", s)),
- }
- }
-}
--- a/rudof_lib/src/result_validation_format.rs
+++ b/rudof_lib/src/result_validation_format.rs
@@ -5,7 +5,7 @@
use thiserror::Error;
use crate::{
- pgschema_format::PgSchemaResultFormat, result_shacl_validation_format::ResultShaclValidationFormat,
+ result_shacl_validation_format::ResultShaclValidationFormat,
result_shex_validation_format::ResultShExValidationFormat,
};
@@ -25,9 +25,6 @@
#[derive(Error, Clone, Debug)]
pub enum ResultFormatError {
- #[error("Format '{format}' is not supported for Property Graph validation. Use: compact, details, json, or csv")]
- UnsupportedForPgSchema { format: String },
-
#[error("Unknown result format: {format}")]
UnknownFormat { format: String },
}
@@ -63,18 +60,6 @@
}
}
- pub fn to_pgschema_result_format(self) -> Result<PgSchemaResultFormat, ResultFormatError> {
- match self {
- ResultValidationFormat::Compact => Ok(PgSchemaResultFormat::Compact),
- ResultValidationFormat::Details => Ok(PgSchemaResultFormat::Details),
- ResultValidationFormat::Json => Ok(PgSchemaResultFormat::Json),
- ResultValidationFormat::Csv => Ok(PgSchemaResultFormat::Csv),
- other => Err(ResultFormatError::UnsupportedForPgSchema {
- format: other.to_string(),
- }),
- }
- }
-
pub fn is_rdf_format(&self) -> bool {
matches!(
self,
@@ -86,16 +71,6 @@
| ResultValidationFormat::NQuads
)
}
-
- pub fn is_pg_format(&self) -> bool {
- matches!(
- self,
- ResultValidationFormat::Compact
- | ResultValidationFormat::Details
- | ResultValidationFormat::Json
- | ResultValidationFormat::Csv
- )
- }
}
impl Display for ResultValidationFormat {
--- a/rudof_lib/src/rudof.rs
+++ b/rudof_lib/src/rudof.rs
@@ -46,13 +46,6 @@
use iri_s::{IriS, MimeType};
use rdf_config::RdfConfigModel;
// use shex_validation::SchemaWithoutImports;
-use pgschema::{
- parser::{map_builder::MapBuilder, pg_builder::PgBuilder, pgs_builder::PgsBuilder},
- pg::PropertyGraph,
- pgs::PropertyGraphSchema,
- type_map::TypeMap,
- validation_result::ValidationResult,
-};
use rudof_generate::{DataGenerator, GeneratorConfig, config::OutputFormat};
use rudof_rdf::rdf_core::{FocusRDF, Rdf, query::QueryRDF, visualizer::VisualRDFGraph};
use rudof_rdf::rdf_impl::SparqlEndpoint;
@@ -1691,196 +1684,6 @@
Ok(())
}
- /// Reads Property Graph data from a reader.
- ///
- /// # Arguments
- /// * `reader` - The reader to read PG data from
- /// * `_data_format` - The format of the PG data (currently unused, assumes PG format)
- ///
- /// # Returns
- /// A PropertyGraph parsed from the reader
- pub fn get_pg_data<R: io::Read>(&self, reader: &mut R, _data_format: &DataFormat) -> Result<PropertyGraph> {
- let mut data_content = String::new();
- reader.read_to_string(&mut data_content)?;
- let graph = match PgBuilder::new().parse_pg(data_content.as_str()) {
- Ok(graph) => graph,
- Err(e) => {
- return Err(RudofError::PGDataParseError {
- source_name: "reader".to_string(),
- error: format!("Failed to parse graph: {}", e),
- });
- },
- };
- Ok(graph)
- }
-
- /// Loads Property Graph data from multiple input sources.
- ///
- /// This is a high-level method that handles opening and merging multiple PG data sources.
- ///
- /// # Arguments
- /// * `data` - Slice of input specifications for PG data
- /// * `data_format` - Format of the PG data
- ///
- /// # Returns
- /// A merged PropertyGraph containing all data
- pub fn load_pg_data(&self, data: &[InputSpec], data_format: &DataFormat) -> Result<PropertyGraph> {
- let mut graph = PropertyGraph::new();
-
- for data_input in data {
- let mut data_reader =
- data_input
- .open_read(None, "PG data")
- .map_err(|e| RudofError::ReadingPathContext {
- path: data_input.source_name().to_string(),
- error: e.to_string(),
- context: "PG Data".to_string(),
- })?;
-
- let new_graph = self.get_pg_data(&mut data_reader, data_format)?;
- graph.merge(&new_graph);
- }
-
- Ok(graph)
- }
-
- /// Loads a PGSchema from an input source.
- ///
- /// # Arguments
- /// * `schema_input` - The input specification for the schema
- ///
- /// # Returns
- /// The parsed PgSchema
- pub fn load_pg_schema(&self, schema_input: &InputSpec) -> Result<PropertyGraphSchema> {
- let mut schema_reader =
- schema_input
- .open_read(None, "PGSchema")
- .map_err(|e| RudofError::ReadingPathContext {
- path: schema_input.source_name().to_string(),
- error: e.to_string(),
- context: "PGSchema".to_string(),
- })?;
-
- self.read_pg_schema(&mut schema_reader)
- .map_err(|e| RudofError::PGSchemaParseError {
- source_name: schema_input.source_name(),
- error: format!("{e}"),
- })
- }
-
- /// Reads a Property Graph schema from a reader
- ///
- /// # Arguments
- /// * `reader` - The reader to read PG schema from
- ///
- /// # Returns
- /// The parsed PropertyGraphSchema
- pub fn get_schema<R: io::Read>(&self, reader: &mut R) -> Result<PropertyGraphSchema> {
- let mut schema_content = String::new();
- reader
- .read_to_string(&mut schema_content)
- .map_err(|e| RudofError::ReadError { error: format!("{e}") })?;
- let schema = match PgsBuilder::new().parse_pgs(schema_content.as_str()) {
- Ok(schema) => schema,
- Err(e) => {
- return Err(RudofError::PGSchemaParseError {
- source_name: "reader".to_string(),
- error: format!("Failed to parse schema: {}", e),
- });
- },
- };
- Ok(schema)
- }
-
- /// Reads a Property Graph type map from a reader
- ///
- /// # Arguments
- /// * `reader` - The reader to read type map from
- ///
- /// # Returns
- /// The parsed TypeMap
- pub fn get_map<R: io::Read>(&self, reader: &mut R) -> Result<TypeMap> {
- let mut map_content = String::new();
- reader
- .read_to_string(&mut map_content)
- .map_err(|e| RudofError::ReadError { error: format!("{e}") })?;
- let map = match MapBuilder::new().parse_map(map_content.as_str()) {
- Ok(map) => map,
- Err(e) => {
- return Err(RudofError::PGTypeMapParseError {
- source_name: "reader".to_string(),
- error: format!("Failed to parse type map: {}", e),
- });
- },
- };
- Ok(map)
- }
-
- /// Reads a PGSchema from a reader.
- fn read_pg_schema<R: io::Read>(&self, reader: &mut R) -> Result<PropertyGraphSchema> {
- // Delegate to existing get_schema logic from pgschema crate
- // Assuming get_schema is available from pgschema crate
- self.get_schema(reader).map_err(|e| RudofError::PGSchemaParseError {
- source_name: "reader".to_string(),
- error: format!("{e}"),
- })
- }
-
- /// Loads a TypeMap from an input source.
- ///
- /// # Arguments
- /// * `map_input` - The input specification for the type map
- ///
- /// # Returns
- /// The parsed TypeMap
- pub fn load_pg_typemap(&self, map_input: &InputSpec) -> Result<TypeMap> {
- let mut map_reader = map_input
- .open_read(None, "type map")
- .map_err(|e| RudofError::ReadingPathContext {
- path: map_input.source_name().to_string(),
- error: e.to_string(),
- context: "PG TypeMap".to_string(),
- })?;
-
- self.read_pg_typemap(&mut map_reader)
- .map_err(|e| RudofError::PGTypeMapParseError {
- source_name: map_input.source_name(),
- error: format!("{e}"),
- })
- }
-
- /// Reads a TypeMap from a reader.
- fn read_pg_typemap<R: io::Read>(&self, reader: &mut R) -> Result<TypeMap> {
- // Delegate to existing get_map logic from pgschema crate
- // Assuming get_map is available from pgschema crate
- self.get_map(reader).map_err(|e| RudofError::PGTypeMapParseError {
- source_name: "reader".to_string(),
- error: format!("{e}"),
- })
- }
-
- /// Validates Property Graph data against a PGSchema using a TypeMap.
- ///
- /// This is a high-level method that performs the complete validation workflow.
- ///
- /// # Arguments
- /// * `schema` - The PGSchema to validate against
- /// * `graph` - The PropertyGraph data to validate
- /// * `type_map` - The TypeMap defining the mapping
- ///
- /// # Returns
- /// The validation result
- pub fn validate_pgschema(
- &self,
- schema: &PropertyGraphSchema,
- graph: &PropertyGraph,
- type_map: &TypeMap,
- ) -> Result<ValidationResult> {
- type_map
- .validate(schema, graph)
- .map_err(|e| RudofError::PGSchemaValidationError { error: format!("{e}") })
- }
-
/// Parses a node selector string into a NodeSelector.
pub fn parse_node_selector(&self, node_str: &str) -> Result<NodeSelector> {
parse_node_selector(node_str)
--- a/rudof_lib/src/rudof_error.rs
+++ b/rudof_lib/src/rudof_error.rs
@@ -438,24 +438,6 @@
#[error("No RDF Config to serialize")]
NoRdfConfigToSerialize,
- #[error("Error parsing PG data from {source_name}: {error}")]
- PGDataParseError { source_name: String, error: String },
-
- #[error("Error parsing PGSchema from {source_name}: {error}")]
- PGSchemaParseError { source_name: String, error: String },
-
- #[error("Error parsing PG TypeMap from {source_name}: {error}")]
- PGTypeMapParseError { source_name: String, error: String },
-
- #[error("PGSchema validation error: {error}")]
- PGSchemaValidationError { error: String },
-
- #[error("Missing required PGSchema for validation")]
- MissingPGSchema,
-
- #[error("Missing required TypeMap for PGSchema validation")]
- MissingPGTypeMap,
-
#[error("Error getting node info: {error}")]
NodeInfoError { error: String },
--- a/rudof_lib/src/validation_mode.rs
+++ b/rudof_lib/src/validation_mode.rs
@@ -9,7 +9,6 @@
pub enum ValidationMode {
ShEx,
Shacl,
- PGSchema,
}
impl Display for ValidationMode {
@@ -17,7 +16,6 @@
match self {
ValidationMode::ShEx => write!(dest, "shex"),
ValidationMode::Shacl => write!(dest, "shacl"),
- ValidationMode::PGSchema => write!(dest, "pgschema"),
}
}
}
@@ -29,7 +27,6 @@
match s.to_lowercase().as_str() {
"shex" => Ok(ValidationMode::ShEx),
"shacl" => Ok(ValidationMode::Shacl),
- "pgschema" => Ok(ValidationMode::PGSchema),
other => Err(format!("Unknown validation mode: {}", other)),
}
}
|