W3C home > Mailing lists > Public > public-cwm-talk@w3.org > July to September 2004

gleaning RDF from omnigraffle diagrams

From: Dan Connolly <connolly@w3.org>
Date: Thu, 30 Sep 2004 00:32:16 -0500
Message-Id: <16F20905-12A2-11D9-BB22-000D9338C596@w3.org>
Cc: Tim Berners-Lee <timbl@w3.org>, public-cwm-talk@w3.org
To: Eric Miller <em@w3.org>

EricM, I think you asked me about using omnigraffle as an authoring 
tool for RDF.

I made some progress tonight.

Omnigraffle files are plists. I started a transformation for those
a while ago:
   http://www.w3.org/2000/10/swap/util/plist2rdf.xsl

I just enhanced it (v 1.3 2004/09/30 04:49:27) to do datatypes the 
modern way.

So we start with an omnigraffle file, which looks like...

---
<plist version="1.0">
<dict>
	<key>CanvasColor</key>
	<dict>
		<key>a</key>
		<string>1</string>
		<key>w</key>
		<string>1</string>
	</dict>
	<key>ColumnAlign</key>
	<integer>0</integer>
	<key>ColumnSpacing</key>
	<real>3.600000e+01</real>
---

and then...

$ xsltproc plist2rdf.xsl foo.graffle

and out comes...

---
   <r:Description>
     <a:CanvasColor>
       <r:Description>
         <a:a>1</a:a>
         <a:w>1</a:w>
       </r:Description>
     </a:CanvasColor>
     <a:ColumnAlign 
r:datatype="http://www.w3.org/2001/XMLSchema#integer">0</a:Co
lumnAlign>
     <a:ColumnSpacing 
r:datatype="http://www.w3.org/2001/XMLSchema#double">3.6000
00e+01</a:ColumnSpacing>
---

now I can hardly read the datatype syntax, but I checked it with cwm 
ala...

$ xsltproc plist2rdf.xsl foo.graffle | python cwm.py --rdf --n3>,xxx.n3

and now I can read it...

---
       [      :CanvasColor  [
                  :a "1";
                  :w "1" ];
              :ColumnAlign 0;
              :ColumnSpacing 36.0;
---

The main problem with this approach is that it puts all plist keys in 
one namespace...

  @prefix : <http://www.w3.org/2000/10/swap/util/applePList@@#> .

which is a fib. Omnigraffle's :CanvasColor property might not be the 
same as
some other app's :CanvasColor property. Maybe the namespace should
be a parameter to the plist2rdf.xsl thingy. I dunno... anyway...


I was wondering if the information about which arrows are connected to 
which circles comes thru, and it does:

---
              [
                      r:rest ();
                      :Class "LineGraphic";
                      :Head  [
                          :ID 3 ];
                      :ID 5;
                      :Style  [
                          :stroke  [
                              :HeadArrow "FilledArrow";
                              :LineType 1;
                              :TailArrow "0" ] ];
                      :Tail  [
                          :ID 2 ] ]
---

(I dunno where the r:rest () bit comes from; cwm bug, I think.)

Anyway, the point is, I have a square connected to a circle
by an arrow. I can write rules to match that graphic structure
and transform it to, say, :neighbor relationships:

[[[
{ ?L :Head [ :ID ?HEADID ];
      :Tail [ :ID ?TAILID ].
   [] :ID ?HEADID; :Shape ?HEADSHAPE.
   [] :ID ?TAILID; :Shape ?TAILSHAPE.
} => { ( ?TAILID ?TAILSHAPE )
          :neighbor ( ?HEADID ?HEADSHAPE) }.
]]]


$ python ../cwm.py ,xxx.n3 --filter=,linefilter.n3

and out comes:

       ( 2 "Rectangle"  ) :neighbor  ( 3 "Circle"  ) .

more or less... I stripped namespace decls, comments,
and rearranged the whitespace.

But I hope you get the idea. It's sort of the "putting the
toothpaste back into the tube" version of

  Circles and arrows diagrams using stylesheet rules
  http://www.w3.org/2001/02pd/

-- 
Dan, still getting used to the Apple OS X Mail.app
p.s. I was thinking of formatting this as "Rich Text" but
I don't see how to make links.
Received on Thursday, 30 September 2004 05:32:03 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 8 January 2008 14:11:01 GMT