-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement generation of enriched namespaces file, reorganize project …
…to depend on the new file The new XML contains user namespaces (defined in namespaces.xml) and internal namespaces (such as core-shape). Both model2owl internals and get_namespaces.sh relies on that file and not on namespaces.xml. Moreover, model2owl internals now depends on a new template which generates namespaces declarations based on enriched file which is passed to the XSLT transformation engine as command line argument. For now, the path of the new XML file is kept in the Makefile, but this can be further improved in the future (if we come up with application internal XSL config or other solution). Scope of changes: * new XSL file for generation of the enriched namespaces XML file * unit test for the above XSL file * project codebase: * new function generating namespaces declarations and references to `$namespacePrefixes` replaced with `$internalNamespacePrefixes` * Makefile changes: * new recipe * existing 3 recipes generating *.rdf artefacts now include generation of the new XML file * required adjustments * Adjustments in the get_namespaces.sh script
- Loading branch information
1 parent
f4a9247
commit a8596c6
Showing
10 changed files
with
113 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -325,3 +325,4 @@ lib64 | |
pyvenv.cfg | ||
/build/ | ||
/node_modules/ | ||
.temp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<xsl:stylesheet xmlns="http://publications.europa.eu/ns/" | ||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | ||
xmlns:xd="http://www.oxygenxml.com/ns/doc/xsl" | ||
xmlns:fn="http://www.w3.org/2005/xpath-functions" | ||
exclude-result-prefixes="xd xsl fn" | ||
version="3.0"> | ||
|
||
<xsl:import href="../../config-proxy.xsl"/> | ||
<xsl:output version="1.0" encoding="UTF-8" indent="yes" /> | ||
|
||
<xd:doc> | ||
<xd:desc> | ||
A template for generating enriched namespaces XML file that | ||
contains internal model2owl namespaces which are constructed | ||
based on the model2owl configuration. | ||
</xd:desc> | ||
</xd:doc> | ||
<xsl:template match="/"> | ||
<prefixes> | ||
<xsl:for-each select="/*:prefixes/*:prefix"> | ||
<prefix name="{./@name}" value="{./@value}"> | ||
<xsl:if test="boolean(./@importURI)"> | ||
<xsl:attribute name="importURI"> | ||
<xsl:value-of select="./@importURI" /> | ||
</xsl:attribute> | ||
</xsl:if> | ||
</prefix> | ||
</xsl:for-each> | ||
<prefix name="{fn:concat($moduleReference, '-res')}" | ||
value="{fn:concat($base-restriction-uri,$defaultDelimiter)}"/> | ||
<prefix name="{fn:concat($moduleReference, '-shape')}" | ||
value="{fn:concat($base-shape-uri,$defaultDelimiter)}"/> | ||
</prefixes> | ||
</xsl:template> | ||
</xsl:stylesheet> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<x:description xmlns:x="http://www.jenitennison.com/xslt/xspec" | ||
xmlns:fn="http://www.w3.org/2005/xpath-functions" | ||
xmlns:xs="http://www.w3.org/2001/XMLSchema" | ||
stylesheet="../../../src/xml/enriched-namespaces.xsl"> | ||
|
||
<x:scenario label="Scenario testing completeness of the generated enriched namespaces"> | ||
<x:context href="../../ePO-default-config/namespaces.xml" select="/"/> | ||
<x:variable name="userNamespacesCnt" as="xs:integer" | ||
href="../../ePO-default-config/namespaces.xml" | ||
select="fn:count(//*:prefixes/*:prefix)"/> | ||
<x:expect label="there is 1 top-level prefix element" test="count(*:prefixes) = 1"/> | ||
<x:expect label="there are user-defined namespaces" | ||
test="fn:count(*:prefixes/*:prefix) >= $userNamespacesCnt"/> | ||
<x:expect label="there is an internal namespace" | ||
test="*:prefixes/*:prefix[@name = 'core-shape'] = 'http://data.europa.eu/a4g/data-shape#'"/> | ||
</x:scenario> | ||
</x:description> |