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

Support carml XML namespace extensions #34

Closed
ktk opened this issue Nov 14, 2019 · 6 comments
Closed

Support carml XML namespace extensions #34

ktk opened this issue Nov 14, 2019 · 6 comments
Assignees
Labels
Projects

Comments

@ktk
Copy link
Member

ktk commented Nov 14, 2019

That's pretty vital in carml, in my experience one does not get any results without properly adding it to the mapping.

https://github.com/carml/carml#xml-namespace-extension

@ktk ktk added the xml label Nov 14, 2019
@mchlrch
Copy link
Member

mchlrch commented Feb 13, 2020

If multiple namespaces have to be registered, then each one requires its own carml:declaresNamespace statement.

@prefix rr: <http://www.w3.org/ns/r2rml#>.
@prefix rml: <http://semweb.mmlab.be/ns/rml#>.
@prefix ql: <http://semweb.mmlab.be/ns/ql#> .
@prefix carml: <http://carml.taxonic.com/carml/> .
@prefix ex: <http://www.example.com/> .

<#SubjectMapping> a rr:TriplesMap ;
  rml:logicalSource [
    rml:source [
      a carml:Stream ;
      carml:declaresNamespace [
        carml:namespacePrefix "exa" ;
        carml:namespaceName "http://www.example.com/audios/1.0/" ;
      ] ;
      carml:declaresNamespace [
        carml:namespacePrefix "exb" ;
        carml:namespaceName "http://www.example.com/books/1.0/" ;
      ] ;

    ] ;
    rml:referenceFormulation ql:XPath ;
    rml:iterator "/ex:bookstore/*" ;
  ]
.

@mchlrch
Copy link
Member

mchlrch commented Feb 13, 2020

Those XML namespaces belong to the source side of things. I suggest we implement this in the grammar similar to how the CSVW dialect is implemented.

source-group SomeSourceGroup {
	xml-namespace-extension SomeXmlNsExtension
	
	logical-source foo {
		type xml

		...
	}

}

xml-namespace-extension SomeXmlNsExtension {
	prefix "exa" "http://www.example.com/audios/1.0/"
	prefix "exb" "http://www.example.com/books/1.0/"
}

xml-namespace-extension can be declared on the LogicalSource or on the SourceGroup

@mchlrch mchlrch added this to To do in main via automation Feb 13, 2020
@nnamtug nnamtug self-assigned this Feb 14, 2020
@nnamtug nnamtug moved this from To do to In progress in main Feb 14, 2020
nnamtug added a commit that referenced this issue Feb 14, 2020
@nnamtug
Copy link
Collaborator

nnamtug commented Feb 14, 2020

Assumption: only generate 'carml:declaresNamespace' for prefixes used in the current mapping

If this is not the case, revert commit 53f8796

@nnamtug
Copy link
Collaborator

nnamtug commented Feb 14, 2020

also tweaked code-completion and validation for LogicalSource and SourceGroup

  • dialect requires srcType=CSV
  • xml-namespace-extension rquires srcType=XML

Not adding all possible examples for this validation into editor-test due to excessive testing in ValidationRuleTest.xtend.

Project editor-test now has examples for code completion.

@nnamtug nnamtug moved this from In progress to Ready for Test in main Feb 14, 2020
@mchlrch
Copy link
Member

mchlrch commented Feb 27, 2020

Assumption: only generate 'carml:declaresNamespace' for prefixes used in the current mapping

If this is not the case, revert commit 53f8796

This is not the case. All prefixes contained in the xml-namespace-extension of the source need to be added with a carml:declaresNamespace. These are namespaces used in the XML document that gets transformed, which are independent of the vocabulary namespaces of the target RDF data.

@mchlrch mchlrch moved this from Ready for Test to In progress in main Feb 27, 2020
@nnamtug nnamtug moved this from In progress to Ready for Test in main Feb 28, 2020
@mchlrch
Copy link
Member

mchlrch commented Mar 5, 2020

Works as expected. Good to merge

@nnamtug nnamtug closed this as completed in af28305 Mar 6, 2020
main automation moved this from Ready for Test to Done Mar 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
main
  
Done
Development

No branches or pull requests

3 participants