CSIRO-enviro-informatics / VocPrez

GNU General Public License v3.0
3 stars 5 forks source link

Multi-parent Concept Hierarchy issue #17

Open edmondchuc opened 5 years ago

edmondchuc commented 5 years ago

The SPARQL query is producing the wrong length for concepts with more than one skos:broader.

edmondchuc commented 5 years ago

I've added a fix for now but the problem still exists from the original SPARQL query.

File: 'source.py' Class: 'Source'

@staticmethod
    def draw_concept_hierarchy(hierarchy):
        tab = '\t'
        previous_length = 1

        text = ''
        for item in hierarchy:
            if item[0] == previous_length + 2: # SPARQL query error on length value
                mult = item[0] - 2
            else: # everything is normal
                mult = item[0] - 1
            t = tab * mult + '* [' + item[2] + ']' + '(' + item[1] + ')\n'
            text += t
            previous_length = item[0]

        return markdown.markdown(text)
edmondchuc commented 5 years ago

As mentioned in the previous posts, the SPARQL query is calculating the wrong length for some of the concepts to its top concept. This has resulted in some concept hierarchies completely breaking due to the length being wrong. I've added a bandage fix which seems to solve all the issues related to the wrong length for now, but further bugs/errors may appear until we can improve the original SPARQL query.

The broken concept hierarchy was for Simple Lithology, rva-56.

The fix: https://github.com/CSIRO-enviro-informatics/VocPrez/commit/2861b0436ab17070ec323c50de51e3ab0755cf36