Deep select in graph augmentation rule across blank nodes?

6 views
Skip to first unread message

Leif Warner

unread,
Feb 22, 2011, 2:13:32 AM2/22/11
to scardf
So for the SnAugmenter class, it's supposed to take a function of type
GraphNode->NodeBag to select which nodes to apply the rule to.
I was wondering how to to deep selections across blank nodes with
this?
I try graph/-/having(FOAF\"account"-> Branch(FOAF
\"accountServiceHomepage"->"http://twitter.com")) to select all people
who have an account on twitter, where foaf:account points at a blank
node, but it tells me:
java.lang.IllegalArgumentException: Cannot convert _:b8b593c0fd9a5bc31-
( (<http://xmlns.com/foaf/0.1/accountServiceHomepage>,
{PlainLiteral("http://twitter.com")}) ) of class org.scardf.Branch to
Node
at org.scardf.Node$.from(core.scala:67)
at org.scardf.GraphNode.has(graphnode.scala:28)
at org.scardf.having$$anonfun$apply$7$$anonfun$apply
$8.apply(converters.scala:71)
at org.scardf.having$$anonfun$apply$7$$anonfun$apply
$8.apply(converters.scala:71)
at scala.collection.TraversableLike$$anonfun$map
$1.apply(TraversableLike.scala:206)
at scala.collection.TraversableLike$$anonfun$map
$1.apply(TraversableLike.scala:206)
at scala.collection.IndexedSeqOptimized
$class.foreach(IndexedSeqOptimized.scala:34)
at scala.collection.mutable.WrappedArray.foreach(WrappedArray.scala:
32)
at scala.col...

This is with a JenaGraph.

The use-case for this is that I want to write something that, given
that a person has accounts on other services, use those service's
API's to pull in other info to load into the graph.
I was debating doing this using forward-chaining jena rules, but
scardf augmentations just being arbitrary scala code seemed like a
nicer way to go. I'm not sure if thinking about this in terms of
"graph rules" is the way to go, though. It'd be doing http calls and
generating a new graph to work on, it seems.
-Leif

Hrvoje Simic

unread,
Feb 26, 2011, 2:50:46 PM2/26/11
to sca...@googlegroups.com
> I try graph/-/having(FOAF\"account"-> Branch(FOAF
> \"accountServiceHomepage"->"http://twitter.com")) to select all people
> who have an account on twitter, where foaf:account points at a blank
> node

How about something like this (introducing variables account and homepage):

g/-/where( _/account/having( homepage -> "http://twitter.com" )/#? )

I.e. all nodes in g for which account node has (at least one) homepage
property "http://twitter.com"

Reply all
Reply to author
Forward
0 new messages