Hi Sanjeev,

This is a consequence of how SPARQL works. It will happen whenever there are 
multiple values for one of the requested properties. So, if any taxonomy has 
multiple values for rdfs:label, rdfs:comment, or metadata:status, then there 
will be multiple lines in the tabular result set returned by the query.

Imagine the following data:

    :Robert a :Person.
    :Robert :nickname "Bob".
    :Robert :nickname "Bobby".

Now we run this query:

    SELECT ?person ?nickname
    WHERE {
        ?person a :Person.
        ?person :nickname ?nickname.
    }

it would return these results:

    ?person        ?nickname
    :Robert         "Bob"
    :Robert         "Bobby"

So we see two results, even though there is only one person in the data. That’s 
because the person has two nicknames.

The unexpected results you see are an equivalent problem.

Your screenshot shows a taxonomy that has multiple status values. An asset 
collection should never be both under development and in use. So this should be 
fixed in the data.

You say that there are other examples where you get multiple results even 
though there is only one status value. In those cases, probably another 
property has multiple values.

To debug this kind of problem, what I usually do is this. First I remove all 
the clauses that ask for the various properties that could cause the 
duplication. Check that the result has no duplicates. Then re-introduce the 
clauses one by one, to see which one causes the duplication.

Then once the problem is identified, how to fix it? Either remove the duplicate 
values from the data. Or change the query so that it can deal with multiple 
values. Some properties can be reasonably expected to have multiple values, 
e.g., in different languages. In that case one could refine the query to pick 
the desired value, e.g., by using a FILTER that keeps only the value with the 
desired language tag. Another useful tool is the group_concat aggregate 
function which can merge multiple values into a single row, like "Bob, Bobby".

Hope that helps,
Richard


> On 23 Nov 2018, at 11:05, Sanjeev Devireddy <[email protected]> 
> wrote:
> 
> Hi,
>     An intermittent issue is observed in EDG/EVN application(Version 
> 5.3.2.v20170621-1517R) and that is, when a new taxonomy is created then from 
> the EDG/EVN application UI, it is seen as one taxonomy but the SPARQL (please 
> check below) to get the list of taxonomies from the application database 
> shows the duplicate entries (please check the below screenshot) of that 
> taxonomy. I tried by cloning the Geography Vocabulary and that also shows 
> duplicate entries for that cloned version.
> 
> SPARQL
> 
> SELECT DISTINCT ?projectGraph  ?name ?description ?statusLabel
> WHERE {
>     rdf:nil <http://topbraid.org/teamwork#graphsUnderTeamControl> ( 
> ?projectGraph ?teamGraph ) .
>     GRAPH ?projectGraph {
>         ?projectGraph a <http://evn.topbraidlive.org/evnprojects#Taxonomy> .
>         ?projectGraph rdfs:label ?name .
>         ?projectGraph rdfs:comment ?description .
>         ?projectGraph <http://topbraid.org/metadata#status> ?statusVar .
>         GRAPH <http://topbraid.org/metadata> {
>                 ?statusVar rdfs:label ?statusLabel .
>         } .
>         } .
> }ORDER BY (?name)
> 
> 
> Result - Duplicate Entries for the taxonomy, Geography Vocabulary Copy
> 
> <Auto Generated Inline Image 1.png>
> 
>     As shown in the above screenshot, interestingly there are two different 
> statuses( In use & Under Development ) for the Vocabulary named 'Geography 
> Vocabulary Copy'. But we have some examples for the duplicate entries of a 
> taxonomy with the same status also.
> 
> 
> Could someone please help to fix the issue?
> 
> 
> Thanks,
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "TopBraid Suite Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to [email protected] 
> <mailto:[email protected]>.
> For more options, visit https://groups.google.com/d/optout 
> <https://groups.google.com/d/optout>.
> <Auto Generated Inline Image 1.png>

-- 
You received this message because you are subscribed to the Google Groups 
"TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to