From 24537d5f9a430aa39baa8a90d2e00b8e681a2f86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herminio=20Garc=C3=ADa=20Gonz=C3=A1lez?= Date: Fri, 5 Sep 2025 17:46:10 +0200 Subject: [PATCH] Added the option to use - to read the mapping rules from stdin in the -m option. Closes #232. --- src/main/scala/com/herminiogarcia/shexml/Main.scala | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/scala/com/herminiogarcia/shexml/Main.scala b/src/main/scala/com/herminiogarcia/shexml/Main.scala index d7a2c53..c2c4c6a 100644 --- a/src/main/scala/com/herminiogarcia/shexml/Main.scala +++ b/src/main/scala/com/herminiogarcia/shexml/Main.scala @@ -26,7 +26,7 @@ object Main { description = Array("Map and merge heterogeneous data sources with a Shape Expressions based syntax")) class Main extends Callable[Int] { - @Option(names = Array("-m", "--mapping"), required = true, description = Array("Path to the file with the mappings")) + @Option(names = Array("-m", "--mapping"), required = true, description = Array("Path to the file with the mappings. If '-' is provided as the path the engine will read from the standard input.")) private var file: String = "" @ArgGroup(validate = false, heading = "Options for the transformation to RDF%n") @@ -39,7 +39,7 @@ class Main extends Callable[Int] { private var generalTransformationOptions: GeneralTransformationOptions = new GeneralTransformationOptions() override def call(): Int = { - val fileHandler = scala.io.Source.fromFile(file) + val fileHandler = if(file == "-") scala.io.Source.stdin else scala.io.Source.fromFile(file) val parallelExecutionConfiguration = if(generalTransformationOptions.parallel) ParallelExecutionConfigurator(generalTransformationOptions.parallelAspects, generalTransformationOptions.numberOfThreads) else ParallelExecutionConfigurator.empty