[GH-ISSUE #529] [Ontology] XML Datatype for Semantic Versioning #6380

Open
opened 2026-06-17 05:08:13 -05:00 by GiteaMirror · 6 comments
Owner

Originally created by @cmplstofB on GitHub (Aug 31, 2019).
Original GitHub issue: https://github.com/semver/semver/issues/529

Are there any plans to create XML datatype for Semantic Versioning?

Adding an identifier which represents the version information is based on Semantic Versioning can make the data more machine-friendly and human-readable.

  • Example in RDF/Turtle:
@prefix ex: <http://example.com/> .
@prefix dct: <http://purl.org/dc/terms/> .
@prefix sv: <http://semver.org/onto#> .

<http://example.org/pub/software/latest.bin>
    dct:created "2019-08-31"^^dct:W3CDTF ;
    ex:versionInfo "1.0.0-beta"^^sv:VersionString .
  • Example in RDF/XML:
<rdf:RDF
  xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
  xmlns:ex="http://example.com/"
  xmlns:dct="http://purl.org/dc/terms/"
>
    <rdf:Description rdf:about="http://example.org/pub/software/latest.bin">
        <dct:created rdf:datatype="http://purl.org/dc/terms/W3CDTF">2019-08-31</dct:created>
        <ex:versionInfo rdf:datatype="http://semver.org/onto#VersionString">1.0.0-beta</ex:versionInfo>
    </rdf:Description>
</rdf:RDF>
Originally created by @cmplstofB on GitHub (Aug 31, 2019). Original GitHub issue: https://github.com/semver/semver/issues/529 Are there any plans to create XML datatype for Semantic Versioning? Adding an identifier which represents the version information is based on Semantic Versioning can make the data more machine-friendly and human-readable. * Example in RDF/Turtle: ```turtle @prefix ex: <http://example.com/> . @prefix dct: <http://purl.org/dc/terms/> . @prefix sv: <http://semver.org/onto#> . <http://example.org/pub/software/latest.bin> dct:created "2019-08-31"^^dct:W3CDTF ; ex:versionInfo "1.0.0-beta"^^sv:VersionString . ``` * Example in RDF/XML: ```xml <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:ex="http://example.com/" xmlns:dct="http://purl.org/dc/terms/" > <rdf:Description rdf:about="http://example.org/pub/software/latest.bin"> <dct:created rdf:datatype="http://purl.org/dc/terms/W3CDTF">2019-08-31</dct:created> <ex:versionInfo rdf:datatype="http://semver.org/onto#VersionString">1.0.0-beta</ex:versionInfo> </rdf:Description> </rdf:RDF> ```
GiteaMirror added the question label 2026-06-17 05:08:13 -05:00
Author
Owner

@cmplstofB commented on GitHub (Aug 31, 2019):

Here is an example of the ontology for semver (it may contain some errors...);

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rdf:RDF [
  <!ENTITY owl "http://www.w3.org/2002/07/owl#">
  <!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
  <!ENTITY rdfs 'http://www.w3.org/2000/01/rdf-schema#'>
  <!ENTITY xs 'http://www.w3.org/2001/XMLSchema'>
]>
<rdf:RDF
  xmlns:owl="&owl;"
  xmlns:rdf="&rdf;"
  xmlns:rdf="&rdfs;"
  xmlns:xs="&xs;"
>
	<owl:Ontology rdf:about="http://semver.org/onto"/>
	<owl:DatatypeProperty rdf:about="http://semver.org/onto#VersionString">
		<rdfs:label xml:lang="en">Version String</rdfs:label>
		<rdfs:comment xml:lang="en">Version string defined in Semantic Versioning.</rdfs:comment>
		<rdfs:range>
			<rdfs:Datatype>
				<owl:onDatatype rdf:resource="&xs;#string"/>
				<owl:withRestrictions xs:base="&xs;#string" rdf:parseType="Resource">
					<xs:pattern xs:value="(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(-(0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*)(\.(0|[0-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*))?)?(+([a-zA-Z0-9-])?(\.?[a-zA-Z0-9-]*)?)?"/>
				</owl:withRestrictions>
			</rdfs:Datatype>
		</rdfs:range>
</rdf:RDF>
<!-- gh-comment-id:526846367 --> @cmplstofB commented on GitHub (Aug 31, 2019): Here is an example of the ontology for semver (it may contain some errors...); ```xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE rdf:RDF [ <!ENTITY owl "http://www.w3.org/2002/07/owl#"> <!ENTITY rdf 'http://www.w3.org/1999/02/22-rdf-syntax-ns#'> <!ENTITY rdfs 'http://www.w3.org/2000/01/rdf-schema#'> <!ENTITY xs 'http://www.w3.org/2001/XMLSchema'> ]> <rdf:RDF xmlns:owl="&owl;" xmlns:rdf="&rdf;" xmlns:rdf="&rdfs;" xmlns:xs="&xs;" > <owl:Ontology rdf:about="http://semver.org/onto"/> <owl:DatatypeProperty rdf:about="http://semver.org/onto#VersionString"> <rdfs:label xml:lang="en">Version String</rdfs:label> <rdfs:comment xml:lang="en">Version string defined in Semantic Versioning.</rdfs:comment> <rdfs:range> <rdfs:Datatype> <owl:onDatatype rdf:resource="&xs;#string"/> <owl:withRestrictions xs:base="&xs;#string" rdf:parseType="Resource"> <xs:pattern xs:value="(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(-(0|[1-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*)(\.(0|[0-9]\d*|\d*[a-zA-Z-][a-zA-Z0-9-]*))?)?(+([a-zA-Z0-9-])?(\.?[a-zA-Z0-9-]*)?)?"/> </owl:withRestrictions> </rdfs:Datatype> </rdfs:range> </rdf:RDF> ```
Author
Owner

@wizzwizz4 commented on GitHub (Sep 1, 2019):

What's that /onto page? It's not a URL; is it just a namespace URI?

<!-- gh-comment-id:526904665 --> @wizzwizz4 commented on GitHub (Sep 1, 2019): What's that /onto page? It's not a URL; is it just a namespace URI?
Author
Owner

@cmplstofB commented on GitHub (Sep 1, 2019):

@wizzwizz4 Yes.
I prepared the URI just to give an example.

<!-- gh-comment-id:526906970 --> @cmplstofB commented on GitHub (Sep 1, 2019): @wizzwizz4 Yes. I prepared the URI just to give an example.
Author
Owner

@jwdonahue commented on GitHub (Sep 5, 2019):

This seems like a good idea. I think however, for those purposes, you may need a much more robust regex and we'd definitely need a lot more testing infrastructure to validate it. The example regex provided by the spec has been vetted against a large enough data set that we have high confidence in it, but the regex itself, depends on the version string being the sole content and starting at the beginning of the line.


I would add that all our test oracles are one liners as well.

<!-- gh-comment-id:528490662 --> @jwdonahue commented on GitHub (Sep 5, 2019): This seems like a good idea. I think however, for those purposes, you may need a much more robust regex and we'd definitely need a lot more testing infrastructure to validate it. The [example regex provided by the spec](https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string) has been vetted against a large enough data set that we have high confidence in it, but the regex itself, depends on the version string being the sole content and starting at the beginning of the line. ___ I would add that all our test oracles are one liners as well.
Author
Owner

@jwdonahue commented on GitHub (Sep 11, 2019):

Also, a lone version triple is not distinguishable as a SemVer string. Given the state of current practice in the software industry, you cannot unambiguously label the string "1.0.0" as a SemVer string, nor perhaps, in the absence of sufficient context, can you identify it as a version string of any kind.

<!-- gh-comment-id:530479360 --> @jwdonahue commented on GitHub (Sep 11, 2019): Also, a lone version triple is not distinguishable as a SemVer string. Given the state of current practice in the software industry, you cannot unambiguously label the string "1.0.0" as a SemVer string, nor perhaps, in the absence of sufficient context, can you identify it as a version string of any kind.
Author
Owner

@clemchst commented on GitHub (Sep 29, 2025):

+1 to this one.
It would be very nice to have an official xsd/namespace constraining SemVer values in xml files.

<!-- gh-comment-id:3348027300 --> @clemchst commented on GitHub (Sep 29, 2025): +1 to this one. It would be very nice to have an official xsd/namespace constraining SemVer values in xml files.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/semver#6380