Scott,
        Thanks for telling me about Property Paths - I didn't know you could
do that.

Your query won't do what I need - I'm trying to traverse all three relations
(subclassof, "superclassof", and allValuesFrom) from a given starting point,
in an effort to expose "orphan classes" that aren't connected to all the
others (except through owl:Thing of course), which I will do by differencing
my results from your results. (I hadn't mentioned needed to also traverse
the sub- and super- relations.)

Meanwhile, I believe I have done it, using three pairs of functions (one
pair for allValuesFrom, one for subclassof, and one for "superclassof"), and
using smf:isBound as a termination test for functions that don't return
(because they contain empty results, or because they encounter a previously
visited class). Seems to work fine - I'd be happy to share if you are
interested, or if you believe I don't have to resort to recursion.


 - Steve

Steven R. Ray, Ph.D.
Distinguished Research Fellow
Carnegie Mellon University
NASA Research Park
Building 23 (MS 23-11)
P.O. Box 1
Moffett Field, CA 94305-0001
Email:    [email protected]
Phone: (650) 587-3780
Cell:      (202) 316-6481
Skype: steverayconsulting


-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Scott Henninger
Sent: Sunday, February 10, 2013 4:11 AM
To: TopBraid Suite Users
Subject: [topbraid-users] Re: Traversing a graph

Steve; I believe the following query will work for you:

SELECT ?avfCls
WHERE {
    ?cls rdfs:subClassOf ?x .
    ?x owl:allValuesFrom ?avfCls .
}

...and with SPARQL 1.1 Property Paths this can be shortened to

SELECT ?avfCls
WHERE {
    ?cls rdfs:subClassOf / owl:allValuesFrom ?avfCls .
}

Keep in mind that the graph pattern matching does the iteration for you.
Recursive solutions are rarely needed.

-- Scott

On Feb 8, 5:41 pm, "Steve Ray (CMU)" <[email protected]> wrote:
> I have been working on writing a graph-traversal algorithm using 
> SPARQL queries and function calls, and it occurs to me that someone in 
> this group might have already done this. I am trying to transitively 
> follow all of the owl:allValuesFrom restrictions from a given starting 
> class. The two challenges are that this involves a double-hop from one 
> class to the next (rdfs:subClassOf followed by owl:allValuesFrom), and 
> that such a traversal typically has many cycles (i.e. closed loops) 
> within it, most trivially with bidirectional relations.
>
> If anybody has done this, either elegantly or otherwise, I'd love to 
> see your solution. Meanwhile, I will share with this group when and if 
> I get mine to work.
>
> - Steve
>
> Steven R. Ray, Ph.D.
>
> Distinguished Research Fellow
>
> Carnegie Mellon University
>
> NASA Research Park
>
> Building 23 (MS 23-11)
>
> P.O. Box 1
> Moffett Field, CA 94305-0001
>
> Email:    [email protected]
>
> Phone: (650) 587-3780
>
> Cell:      (202) 316-6481
>
> Skype: steverayconsulting
>
> 10yr-logo-sm
>
>  image001.jpg
> 12KViewDownload

--
-- You received this message because you are subscribed to the Google Group
"TopBraid Suite Users", the topics of which include Enterprise Vocabulary
Network (EVN), TopBraid Composer, TopBraid Live, TopBraid Ensemble,
SPARQLMotion, SPARQL Web Pages and SPIN.
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-users?hl=en
---
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/groups/opt_out.



-- 
-- You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include Enterprise Vocabulary 
Network (EVN), TopBraid Composer, TopBraid Live,
TopBraid Ensemble, SPARQLMotion, SPARQL Web Pages and SPIN.
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-users?hl=en
--- 
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/groups/opt_out.


Reply via email to