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

Correct XMLns for gml? #330

Closed
SimonBin opened this issue May 12, 2022 · 7 comments · Fixed by #334
Closed

Correct XMLns for gml? #330

SimonBin opened this issue May 12, 2022 · 7 comments · Fixed by #334
Assignees
Labels
bug Something isn't working
Milestone

Comments

@SimonBin
Copy link

The GeoSPARQL standard references OGC07-036 here: https://github.com/opengeospatial/ogc-geosparql/blob/master/1.1/spec/11-Part-08.adoc#geography-markup-language-serializationgml

which defines http://www.opengis.net/gml/3.2 as the XML namespace of GML in section 5.1

This example file from the repo:

geo:hasGeometry [ a geo:Geometry ;
geo:asGML """<gml:MultiSurface xmlns:gml="http://www.opengis.net/gml/3.2" xmlns:MB="WFS" xmlns:wfs="http://www.opengis.net/wfs/2.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" srsName="urn:ogc:def:crs:EPSG:6.9:3857">

(currently removed)

likewise uses this namespace.

In the sole example on

<gml:Point
srsName=\"http://www.opengis.net/def/crs/OGC/1.3/CRS84\"
xmlns:gml=\"http://www.opengis.net/ont/gml\">
<gml:pos>-83.38 33.95</gml:pos>
</gml:Point>
"""^^<http://www.opengis.net/ont/geosparql#gmlLiteral>

however, a different namespace (the RDF Ontology namespace http://www.opengis.net/ont/gml) is used.

This creates interoperability problems when consuming a GML file from WFS and trying to load it into a gmlLiteral, as the XML tags do not match any more. Is this a bug/bad example in the standard? Or are we supposed to massage GML with sed to alter the XML namespaces?

Currently, Apache Jena hardcodes the NS from the example:
https://github.com/apache/jena/blob/231624d00188f58da6c15fcf5f940f0448111d02/jena-geosparql/src/main/java/org/apache/jena/geosparql/implementation/parsers/gml/GMLReader.java#L67

and is thus unable to correctly parse a GML geometry from a regular GML document

This also touches upon #144

@situx
Copy link
Collaborator

situx commented May 12, 2022

Hi, @SimonBin thank you for your question.

In the GeoSPARQL standard, we only define literal types, so we only define the type geo:gmlLiteral type in your case.
The goal is for you to encode literals in any version of GML that is published.
The namespace http://www.opengis.net/ont/gml is used for the additional RDF vocabulary describing the GML type hierarchy. This vocabulary, similarly to the Simple Features Vocabulary we provide with the standard is intended to classify Geometry instances in RDF.
So I see no reason to not use the GML 3.2 namespace or a GML 2.0 namespace in a GML literal.
Another question is why this example, which is also present in GeoSPARQL 1.0, is using the RDF namespace.
I believe it is not wrong, because it references a valid GM_Object, but from a practical point of view it seems misleading.
@mperry455 since you worked on the GeoSPARQL 1.0 standard, was there a particular reason for you to put the RDF namespace in the GML literal instead of a GML 3.2 namespace or a GML 2.0 namespace?

@SimonBin
Copy link
Author

after looking into it a bit more closely, I actually have reason to believe it is wrong, because gml:pos is not specified at all in http://www.opengis.net/ont/gml as far as I can see, but only in http://schemas.opengis.net/gml/3.2.1/geometryBasic0d1d.xsd (which is included by http://www.opengis.net/gml/3.2)

@situx
Copy link
Collaborator

situx commented May 12, 2022

Indeed you are right, gml:pos is not defined in http://www.opengis.net/ont/gml
Looks like a mistake in the example of the GeoSPARQL 1.0 specification that we should correct for GeoSPARQL 1.1 onwards.
I will raise the issue in our next call in one week at the latest to get this sorted out. Thanks for noticing.
In any case, I think for the Jena implementation, you are free to use any GML namespace that is valid in your GML literal, so you should be able to follow the Moreton island example.

@Aklakan
Copy link

Aklakan commented May 12, 2022

Touching standard XML namespaces in an attempt to somehow link from the XML world to the RDF one seems like a bad idea as it breaks all tooling relying on those namespaces.

Strictly speaking, if an XML document uses a different namespace for GML then its no longer GML. If I used rdfs:label and declared PREFIX rdfs: <http://myweb.site/> then I wouldn't be using the RDFS vocabulary either.

It is the GML/XML spec that would have to explicitly allow for using http://www.opengis.net/ont/gml as an alternative namespace.

If I understand your last sentence correctly, you agree that all implementations (not just jena) should support the conventional GML namespaces - right?

@situx
Copy link
Collaborator

situx commented May 12, 2022

Yes, correct, this is the way I see it. GML literals encoded in GML 3.2 should use the GML 3.2 namespace, GML 2.0 literals the GML 2.0 namespace and so on...
But as I was not part of the team developing GeoSPARQL 1.0, I would like the opinion of one of the authors of the spec like @mperry455 to clarify this here or in our next call.
I will give feedback here and add a pull request for correction of the spec example if necessary.

@situx situx added this to the GeoSPARQL 1.1 milestone May 13, 2022
@situx situx added the bug Something isn't working label May 13, 2022
@situx situx added this to Backlog in GeoSPARQL 1.1 May 13, 2022
@mperry455
Copy link
Collaborator

@situx Right. GML literals should use the namespace for their GML version.

@situx
Copy link
Collaborator

situx commented May 18, 2022

Great! Then we have a linked pull request now to fix this issue

@situx situx moved this from Backlog to In progress in GeoSPARQL 1.1 May 18, 2022
@situx situx self-assigned this May 18, 2022
@jabhay jabhay moved this from In progress to Done in GeoSPARQL 1.1 May 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

Successfully merging a pull request may close this issue.

4 participants