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

Fix/duplicate namespace declarations #471

Merged
merged 4 commits into from
Sep 19, 2021

Conversation

pmcb55
Copy link
Contributor

@pmcb55 pmcb55 commented Sep 18, 2021

This PR is to fix an annoying problem with duplicate main-ontology namespaces appearing. For example, simply run against this Turtle to see the problem:

prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix owl: <http://www.w3.org/2002/07/owl#>
prefix vann: <http://purl.org/vocab/vann/>

<https://ex.com/namespace-with-slash/> a owl:Ontology ;
     vann:preferredNamespacePrefix "ex" ;
     vann:preferredNamespaceURI <https://ex.com/namespace-with-slash/> .

<https://ex.com/namespace-with-slash/SomeClass> a rdfs:Class .

This results in Widoco generating: Table 1: Namespaces used in the document:

Prefix Namespace
ex https://ex.com/namespace-with-slash/
ex https://ex.com/namespace-with-slash
owl http://www.w3.org/2002/07/owl
rdf http://www.w3.org/1999/02/22-rdf-syntax-ns
xml http://www.w3.org/XML/1998/namespace
xsd http://www.w3.org/2001/XMLSchema
rdfs http://www.w3.org/2000/01/rdf-schema
vann http://purl.org/vocab/vann

I would have added a simple regression test (using the Turtle I provided above), but I don't see any unit tests beyond the basic test/widoco/CreateDocInThreadTest.java file. There are very few tests in there, and I can't easily see how I'd assert on the correct behaviour, i.e., to assert that only the correct namespaces are listed in the generated output. Perhaps you could add such a test, at least as an initial example for others contributing to this codebase.

(This PR also introduces a blank line between the main ontology's namespace and the rest, just 'cos that's the most important namespace, and the blank line makes it stand out more - but feel free remove that if you prefer!)

@dgarijo dgarijo merged commit 6f40e62 into dgarijo:develop Sep 19, 2021
@dgarijo
Copy link
Owner

dgarijo commented Sep 19, 2021

Thanks @pmcb55 !

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

Successfully merging this pull request may close these issues.

2 participants