results redundant sparql

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

results redundant sparql

duha
This post was updated on .
Hi,,,
I need to update this Query to get results without redundant

Thanks

SELECT DISTINCT  ?y ?s1
WHERE {
  {
SELECT DISTINCT ?s ?s1
WHERE {
{  {?s rdf:type ab:Disease   .
    ?s ab:Has_symptoms ?sym.
 
  ?s1 ab:Treats ?sym.}

      }

 
     
     ?sym ab:has_name "البلغم".          
     
  }
   
  }
  ?y ab:Treats  ?s.
 
 

  }



--
Sent from: http://protege-project.136.n4.nabble.com/Protege-User-f4659818.html
_______________________________________________
protege-user mailing list
protege-user@lists.stanford.edu
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: results redundant sparql

Lorenz Buehmann
What means redundant? You're already using DISTINCT keyword, so you
won't get duplicate rows. Can you show sample data + sample output please?

If you're getting something like

:a1 :b1
:b1 :a1

FILTER(?y > ?s1)

would be a workaround.

Also, why the subquery?

On 02.01.20 10:25, duha wrote:

> SELECT DISTINCT  ?y ?s1
> WHERE {
>   {
> SELECT DISTINCT ?s ?s1
> WHERE {
> {  {?s rdf:type ab:Disease   .
>     ?s ab:Has_symptoms ?sym.
>  
>   ?s1 ab:Treats ?sym.}
>
>       }
>
>  
>      
>      ?sym ab:has_name "البلغم".          
>      
>   }
>    
>   }
>   ?y ab:Treats  ?s.
>  
>  
>
>   }*
_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: results redundant sparql

duha
Redundant occurs when using different object properties to get results as a
loop

Result1          Result2

X11                   x21
X11                   x21
X11                   x21
X11                    x21
X12                    x21
x12                    x21

I need output same
Result1          Result2

X1                    x21
X12                  




--
Sent from: http://protege-project.136.n4.nabble.com/Protege-User-f4659818.html
_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user
Reply | Threaded
Open this post in threaded view
|

Re: results redundant sparql

Lorenz Buehmann
Well, for me it's impossible that you're getting redundant rows when
using DISTINCT keyword. Please make a screenshot and attach it here.

> Subquery here because of no direct access between classes only through class
> disease.

You don't need a sub-query, it's a simple join on variables.

Also, which Protege version and which SPARQL tab are you using?

On 1/4/20 12:00 PM, duha wrote:

> Redundant occurs when using different object properties to get results as a
> loop
>
> Result1          Result2
>
> X11                   x21
> X11                   x21
> X11                   x21
> X11                    x21
> X12                    x21
> x12                    x21
>
> I need output same
> Result1          Result2
>
> X1                    x21
> X12                  
>
>
>
>
> --
> Sent from: http://protege-project.136.n4.nabble.com/Protege-User-f4659818.html
> _______________________________________________
> protege-user mailing list
> [hidden email]
> https://mailman.stanford.edu/mailman/listinfo/protege-user

--
Lorenz Bühmann
AKSW group, University of Leipzig
Group: http://aksw.org - semantic web research center


_______________________________________________
protege-user mailing list
[hidden email]
https://mailman.stanford.edu/mailman/listinfo/protege-user