Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Files and carml-jar #143

Open
ktk opened this issue Nov 22, 2022 · 3 comments
Open

Files and carml-jar #143

ktk opened this issue Nov 22, 2022 · 3 comments

Comments

@ktk
Copy link
Member

ktk commented Nov 22, 2022

There is a new cli tool for carml available: https://github.com/carml/carml-jar

I could get it to work with XRM carml output but I had to figure out how to do it properly. With the current configuration I can only get it to work with piping the file as a stream and I have to do the XRM source like this: source "". This generates:

<#MapCanton>
	a rr:TriplesMap;
	
	rml:logicalSource [
		rml:source [
			a carml:Stream;
			carml:streamName "";
			carml:declaresNamespace [
				carml:namespacePrefix "eCH-0071";
				carml:namespaceName "http://www.ech.ch/xmlns/eCH-0071/1"
			]
		];
		rml:referenceFormulation ql:XPath;
		rml:iterator "/eCH-0071:nomenclature/cantons/canton"
	];

I can then run: cat input/eCH0071.xml| java -jar bin/carml-jar-1.0.0-SNAPSHOT-0.4.4.jar map -m src-gen/mapping.carml.ttl

However, I cannot run it directly from a file, I always have to pipe it. So I checked out the carml docs and it says the name can be left out or empty, so that seems to be correct.

So I checked out the ontology and I found stream:url, so I changed the generated output to this (manually):

<#MapCanton>
	a rr:TriplesMap;
	
	rml:logicalSource [
		rml:source [
			carml:url "eCH0071.xml"; # cannot have a carml:Stream in this case
			carml:declaresNamespace [
				carml:namespacePrefix "eCH-0071";
				carml:namespaceName "http://www.ech.ch/xmlns/eCH-0071/1"
			]
		];
		rml:referenceFormulation ql:XPath;
		rml:iterator "/eCH-0071:nomenclature/cantons/canton"
	];

And then I can run it directly from file:

java -jar bin/carml-jar-1.0.0-SNAPSHOT-0.4.4.jar map -m src-gen -rsl input -of ttl -P

This probably would work in XRM via rml output but I use the XML Namespace extension so I have to stick with carml-syntax.

Not sure how to handle that properly in XRM though, would be nice if both options could be generated.

@mchlrch
Copy link
Member

mchlrch commented Nov 23, 2022

I understand this as follows: carml requires different rml:logicalSource definitions, depending on if either a stream source or a files source should be used.

For stream sources:

	rml:logicalSource [
		rml:source [
			a carml:Stream;
			carml:streamName "";
			...
		];
		...
	];

For file sources:

	rml:logicalSource [
		rml:source [
			carml:url "eCH0071.xml";
			...
		];
		...
	];

Using output carml in xrm version 1.2.0 generates the "stream sources" definition.

The new requirement is now, that both variations can be generated from xrm. Is that correct @ktk ?

@ktk
Copy link
Member Author

ktk commented Nov 23, 2022

Correct interpretation.

It would be nice as people can use XRM and create carml output without having to interact with streams that way. For those that do not necessarily use a barnard59 pipeline, that's probably a nice thing to have.

@mchlrch mchlrch transferred this issue from zazuko/expressive-rdf-mapper Dec 5, 2023
@ktk
Copy link
Member Author

ktk commented Jan 2, 2024

Ran into this again btw. I think for pure carml-cli mode, this feature would be useful. So either have an anonymous (empty) stream or a filename with carml:url

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants