Re: Another thing on property paths...

On 17/12/10 09:53, Axel Polleres wrote:
> Independent from Jorge's remarks on the comments list, I have had another
> question on PropertyPaths, particulary about ZeroLengthPath:
>
>
> Admittedly, find the e.g. the zeroLengthPath operator quite unintiuitive at the moment,
> linking *ALL* nodes with each other...

It does not.

eval(D(G), ZeroLengthPath(vx:var, path, vy:var))) =
   { {(vx, term), (vy, term)} | term in nodes(G) }
   card[] = 1

NB: same *term*

Nodes are linked to themselves only by {0}

> that means that e.g.
>
> ?X knows* ?Y
>
> for not only the transitively linked pairs of resources via the knows property,
> ALL pairs of nodes in the graph... Actually, I isn't a more standard way of treating 0-length paths just as
> reflexive, i.e. only linking each node reflexively with itself?
>
> I would at least find this more intuitive and returning less noisy results, i.e. "what I can reach from one node
> in 0 steps is just the node itself" sounds intuitive to me. Am I mistaken here? If yes, why?
> At least, I don't understand why we *need* to return the pairs of all nodes here?
>
> Example:
>
> alice knows bob .
> bob knows charly .
>
> Pattern:
> ?X knows* ?Y

> Result ALL:

Where did these result come from?  I see no reason for many of them.

They include the property -

[[
A zero length path matches all subjects and all objects in the graph
]]

excludes IRIs that are only properties



?X foaf:knows* ?Y
   ==
{ ?X foaf:knows{0} ?Y } UNION { ?X foaf:knows+ ?Y }

{ ?X foaf:knows{0} ?Y }

---------------------------------------------------
| X                      | Y                      |
===================================================
| <http://example.org/a> | <http://example.org/a> |
| <http://example.org/b> | <http://example.org/b> |
| <http://example.org/c> | <http://example.org/c> |
---------------------------------------------------

{ ?X foaf:knows+ ?Y }

---------------------------------------------------
| X                      | Y                      |
===================================================
| <http://example.org/a> | <http://example.org/b> |
| <http://example.org/a> | <http://example.org/c> |
| <http://example.org/b> | <http://example.org/c> |
---------------------------------------------------

so ?X foaf:knows* ?Y

---------------------------------------------------
| X                      | Y                      |
===================================================
| <http://example.org/a> | <http://example.org/a> |
| <http://example.org/a> | <http://example.org/b> |
| <http://example.org/a> | <http://example.org/c> |
| <http://example.org/b> | <http://example.org/b> |
| <http://example.org/b> | <http://example.org/c> |
| <http://example.org/c> | <http://example.org/c> |
---------------------------------------------------

which gets me:

   ?X ?Y  Reason:
   -----
   a  a   {0}
   a  b   +
   a  c   +
   a  k   ?? property
   b  b   {0}
   b  a   ?????
   b  c   +
   b  k   ?? property
   c  c   {0}
   c  a   ?????
   c  b   ?????
   c  k   ?? property
   k  k   ?? property
   k  a   ?? property
   k  b   ?? property
   b  c   +
   a  b   + <--- repeat why?
   b  c   + <--- repeat why?
   a  c   + <--- repeat why?

Result REFLEXIVE:
   ?X ?Y
   -----
   a  a
   b  b
   c  c
   k  k   ?? property
   a  b
   b  c
   a  c
>
> (a = alice, b = bob, c = chalry, k = knows)
>
> Can someony explain to me why the reflexive only version of ZeroLengthPath wouldn't work with the rest?



>
> Axel

Received on Friday, 17 December 2010 14:20:14 UTC