On May 27, 2009, at 12:21 PM, Schmitz, Jeffrey A wrote:
>
> It's getting curiousor and curiousor...
>
> Using the TBC SPARQL tab, when I call a function that filters
> according
> to an argument, e.g.:
>
> SELECT ?user
> WHERE {
> ?project ModelManagement:hasUser ?user .
> ?user Common:name ?username .
> FILTER (?username = ?arg1) .
> }
If the function returns no binding then it will be comparable to a
wildcard in the query below.
>
>
> As long as I pass in an argument that has a match:
>
> SELECT ?value
> WHERE {LET(?user := ModelManagement:getProjectUser("john"))
> ?user ModelManagement:firstName ?value}
>
> the function returns just one result as expected (in this case for
> some
> reason the blank result rows aren't returned). However, if I pass
> in a
> value that has NO matches:
>
> SELECT ?value
> WHERE {LET(?user := ModelManagement:getProjectUser("xxx"))
> ?user ModelManagement:firstName ?value}
>
>
> It acts like the FILTER statement isn't there, and all User's names in
> the model are returned. I would have expected no results to be
> returned. Btw, I'm seeing this same behavior in my code too. Am I
> thinking about this wrong, or is there perhaps a problem with how
> FILTER
> works within a Function?
No, the behavior is correct (as far as I understand your example). The
function returns no binding and therefore ?user is unbound and will be
iterating over all possible subjects of the firstName triples.
In your first email, please keep in mind that the execution order of
ARQ might be different from what you have typed it. In particular, I
find often that LET statements are executed at the end, and therefore
lead to more iterations than expected.
Holger
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TopBraid Composer Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/topbraid-composer-users?hl=en
-~----------~----~----~----~------~----~------~--~---