An ARC2 -> Graph Gear Plugin

Tagged:  •    •  

The recent (re)release of LCSH as skos (way to go! especially to Ed Summers!) includes some nifty visualizations using Graph Gear. It got me thinking that it'd be great to be able to take an RDF graph from ARC2 and push it into a Graph Gear visualization. And so, there went my weekend!

I'm still testing things and will write up some complete documentation soon, but here's my first stab at it, an ARC2 plugin to produce Graph Gear XML. (Download at bottom of post) Here's an example, taking a graph of my colleagues' twitter info and pushing it through the serializer to make the Graph Gear visualization. (I wish I knew how to force more space between the nodes--working on that!)

If it's all working, you can use the config array to pass values for the attributes on the Graph Gear <graph> , <node>, and <edge> elements, like so:

 $config = array(
	'title'=>'ARC2 -> GraphGear Demo',
	'type'=>'directed',
	'bgcolor'=>'ffffff',
	'linecolor'=>'000000',
	'viewmode'=>'display',
	'width'=>'725',
	'height'=>'400',
	'scale'=> '150' );

I've also put in some mechanisms to guide the output based on the actual triples in your RDF. So, for example, you can put arrays in the config array to specify which predicates to follow for things like the label, links, and images. Passing the same ns array used for the ARC2 store will let you use prefixes:


  	'labelPreds'=> array('http://xmlns.com/foaf/0.1/nick',	'dc:title'),	
	'imagePreds'=>array('foaf:depiction'),	
	'linkPreds'=> array('foaf:page'),

Similarly, you can guide thing like the text and node color and type by the namespace and/or class of the resource, and for predicates the namespace or the particular predicate (particular types or predicates override the namespace instructions):

	'nsPredTextColorMap'=> array('foaf'=>'ff0000', 'dc'=>'00ff00'),
	'predPredTextColorMap'=> array('http://xmlns.com/foaf/0.1/knows'=>'0000ff'),
	'typeNodeTextColorMap'=>array('foaf:Person'=>'aaaaaa'),
	'nsNodeTextColorMap'=>array('foaf'=>'bbbbbb'),

Like I said, I'll be working on getting some complete documentation up soon, as well as putting it through some more rigorous testing and revising. Any comments, bugs, or guidance will be hugely appreciated!

AttachmentSize
ARC2_GraphGearSerializerPlugin.php.txt12.21 KB

Trackback URL for this post:

http://patrickgmj.net/trackback/171

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Very cool. I use ARC2 on my site to for profile and activity see:

http://foaf.me/index.php?webid=http://bblfish.net/people/henry/card&hash=me

(you can click through friends, and see an activity stream)

It would be great if I could add your graphgear module as a tab.

What would be ideal is if it could look something like :

tabgraph.php
?webid=example.com/foaf.rdf

And it would go away and pull out the graph, then it would just be one line to pop it into the social net ...

You can download the source here: http://github.com/melvincarvalho/foafme/tree/master

Thanks...something like that tab would be really cool for visualizing those social networks. I imagine it'd be fairly quick to do, and I'll definitely be looking at the foaf.me source, too! Hope the tabs come together. I'd love to see them.

That's great !
Could be a nice way to rewrite my FOAFGear hack (http://apassant.net/home/2008/01/foafgear/) using ARC2. Maybe something to be included in knowee as well ?

that's really cool stuff

Yeah, I'm totally agree with you. I found this tool very useful for my website.
__________________
James, http://polls.tw/

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options