[TF-PP] Zero-length paths (ACTION-251)

ACTION-251

Here are some of my questions regarding zero-length property paths. The current Property Paths editor's draft says:

"A path of length zero connects a graph node to itself."
and
"A zero occurrence of a path element always matches."

It's this second sentence that worries me. It suggests to me that a zero-length path will always match, regardless of the path endpoints being used as graph nodes (or even used in the graph at all). In graph theory, I believe "graph node" is usually restricted to the vertices (which I think would mostly make my concerns go away), but in the RDF case I think we really want to allow predicate terms to participate in path matching (important for things like RDFS inferencing).

Here are some examples to flesh out the issue:

# Data
:s :p :o

# Example 1
ASK { :p :q{0} :p }

In this case, :p is never used as the subject or object of a triple in the graph. Does a zero-length path exist that connects :p with itself?

# Example 2
ASK { :q :p{0} :q }

In this case, :q does not exist in the graph at all (in the subject, predicate, or object position). Does a zero-length path exist that connects :q with itself?

# Example 3
ASK { ?q :p{0} ?q . FILTER(?q = :q) }

This seems like it should return the same answer as Example 2, but if it returns true, the next example seems bad:

# Example 4
SELECT (COUNT(*) AS ?count) WHERE { ?start :p{0} ?end }

Here, we are trying to count all the zero-length paths. If Examples 2 and 3 return true, it seems that zero-length paths exist connecting every node to itself, regardless of the node's presence in the graph. This interpretation suggests to me that the count returned here should be infinite (something I'd very much like to avoid).


One approach to avoiding the infinite answers is to restrict zero-length path matching to only those terms that appear in the graph (in either subject, predicate, or object positions). This would result in answers true, false, false, and 3 for examples 1-4, respectively.

Thoughts?

thanks,
.greg

Received on Thursday, 3 June 2010 15:45:38 UTC