dgarijo / Widoco

Wizard for documenting ontologies. WIDOCO is a step by step generator of HTML templates with the documentation of your ontology. It uses the LODE environment to create part of the template.
Apache License 2.0
286 stars 88 forks source link

LODE error: empty sequence is not allowed in $descriptions #457

Open seralf opened 3 years ago

seralf commented 3 years ago

Describe the bug In some case (see example) if the ontology is missing informations, LODE gives an error while parsing.

To Reproduce

  1. Start widoco by CLI or GUI, using NIF ontology as example source. (source on github)

  2. The error will be similar to the following one:


[main] INFO widoco.CreateResources - - ontology IRI: http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-core#
Error on line 35 of structural-reasoner.xsl:
  XTTE0570: An empty sequence is not allowed as the value of variable $descriptions
  in variable disjoints
  at f:getDisjoints() (file:///.../extraction.xsl#1190)
  at xsl:call-template name="get.entity.disjoint" 
  ...in built-in template rule
[main] ERROR lode.LODEGeneration - Error while applying LODE. Error while applying the XLS file: An empty sequence is not allowed as the value of variable $descriptions
[main] ERROR widoco.gui.GuiController - Error while generating the documentation: An empty sequence is not allowed as the value of variable $descriptions
; SystemID: file:/.../structural-reasoner.xsl; Line#: 35; Column#: -1
net.sf.saxon.trans.XPathException: An empty sequence is not allowed as the value of variable $descriptions

Expected behavior In case there are information missing, they sholud be populated by the default (for example while transforming from .ttl format to .rdf format). This way we can still have all the warning from the external dependency (LODE), and we'll miss those information in HTML, but still we can avoid breaking the compilation of ontology documentation

Screenshots

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

seralf commented 3 years ago

In the example about NIF ontology, the problem seems to be related on how the disjiointed classes are written:

[] a owl:AllDisjointClasses ; 
    owl:members nif:RFC5147String, nif:ContextHashBasedString , nif:OffsetBasedString ,  nif:CStringInst .

this may turn in RDF/XML in something similar to:

  <owl:AllDisjointClasses rdf:nodeID="genid8">
    <owl:members rdf:resource="http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-core#RFC5147String"/>
    <owl:members rdf:resource="http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-core#ContextHashBasedString"/>
    <owl:members rdf:resource="http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-core#OffsetBasedString"/>
    <owl:members rdf:resource="http://persistence.uni-leipzig.org/nlp2rdf/ontologies/nif-core#CStringInst"/>
  </owl:AllDisjointClasses>

and it seems to be essentially related to how those information are handled by default by LODE itself: https://github.com/essepuntato/LODE/blob/master/src/main/webapp/structural-reasoner.xsl#L33-L35

dgarijo commented 3 years ago

Thanks. If you have a suggestion for this issues I would appreciate it @seralf Otherwise, it may have to wait a bit until I get the time to look it up in detail

seralf commented 3 years ago

Hi @dgarijo I'm not sure how to fix it... I was thinking about opening an issue on the LODE codebase itself, but that expect an RDF/XML source, that is generated before sending to it. So I suppose it coulbe be possible to write the owl:members nodes in a different way. I imagine two possible options, at least:

  1. open an issue on LODE, asking / contributing to support handling rdf:resource as well (this seems to be the problem, looking at the XSLT, but I might be wrong)
  2. prepare the RDF/XML in a different way, for example adding blank nodes or similar placeholders, that are already handled by LODE. This workaround maybe could work looking at other ontologies that don't have this problem, and should be removed in case the support in LODE is extended, as in point 1.