Fwd: Abiword RDF progress for September...

From: Martin Sevior <msevior_at_gmail.com>
Date: Mon Oct 03 2011 - 03:23:35 CEST

FYI. Ben's great great work on RDF for AbiWord.

Cheers
MArtin

---------- Forwarded message ----------
From: Ben Martin <monkeyiq@users.sourceforge.net>
Date: Thu, Sep 29, 2011 at 9:53 AM
Subject: Abiword RDF progress for September...
To: Valer Mischenko <valer@nlnet.nl>, Michiel Leenaars
<michiel@nlnet.nl>, Martin Sevior <msevior@gmail.com>, "J.M. Maurer"
<uwog@uwog.net>

Hi,

 I now have xml:id duplication during copy and paste fixed. I also
expanded on the M2 to ensure that copy and paste between abiword and
calligra works with RDF as expected in both directions:
http://monkeyiq.blogspot.com/2011/09/copy-and-paste-with-semantics.html

 RDF is now preserved in abw, rtf, and odf format in abiword. A little
bit of code was needed to expand the RTF support to include shuffling
triples across document boundaries. Thanks to Martin for his response to
my inquiry about how to legally encode such an extension in RTF.

 The most recent thing I have been hacking on is the
PL_ListenerCoupleCloser class. This class together with the
pt_PieceTable::tellListenerSubset() method are responsible for giving a
copy and paste document listener both matched pairs of tags, even when
only one such tag is in the selected range. Use of a closer is optional,
and without one the semantics should be the same as the old
tellListenerSubset().

 The PL_ListenerCoupleCloser class has a long class header comment
explaining things in detail. In short for a selection shown below, the
Closer class will ensure that the bm-start is passed to
listener->populate() before the selection is passed to it. This way, the
listener will see a valid bm-start, content, bm-end, content, range and
will not have to worry about the bm-start and end tags dangling as it
will always see matched pairs in the correct order. My current focus is
only on rdf anchors rather than bookmarks tags. But the closer should
work for any items one wants to visit before or after the selected
range.

Some text <bm-start>I can jump here<bm-end> and then more waffle
                        ^-------------------------^

The heart of tellListenerSubset() was abstracted to the function shown
below, allowing the range to be walked forwards or backwards, with the
termination condition being a functor, and only select fragment types to
be visited and passed to the nominated Listener.

static PT_DocPosition _tellListenerSubsetWalkRange(
   pt_PieceTable* pt,
   PL_Listener* pListener,
   PD_DocumentRange* pDocRange,
   PT_DocPosition rangeStartPos,
   PT_DocPosition rangeEndPos,
   f_WalkRangeFinished_t finishedFunctor = finishedFunctorEndOfRage,
   m_fragtypecol_t& fragmentTypesToVisit =
_getTellListenerSubsetWalkRangeVisitAllFragments(),
   bool walkForwards = true )

I'm still expanding the PL_ListenerCoupleCloser and will add another
matched tag pair case I discovered along the way. For example, currently
if you select into an annotation but not right to the end of it, the
resulting ODF on the clipboard will have the annotation in it. If you
select from the middle of the annotation through its end and onward to
some point, no information about the annotation is in the resulting
ODF.

For RTF there is still also the case described in my initial email:
http://www.abisource.com/mailinglists/abiword-dev/2011/Sep/0065.html
That case should be able to be fixed using the closer class. Having the
closer operate at the tellListener level enables it to be applied to
help any listener see a closed range in the document.

The closer class should allow for times when one wishes to visit the
open or close tag for something that is in the range either before or
after the range itself is visited. So the Listener can concentrate on
doing its job rather than worrying if it will see the matching
open/close tag(s).

I plan to add a test case or two into my test suite on git for the RDF
copy and paste cases before calling M2 complete. This will likely be
limited to abiword only (no calligra) and I'm thinking also having two
active documents in the cases to test copy and paste with RDF triples
going through RTF from one document to another. This should be completed
by around mid October and I'll send a short message at that time.

Received on Mon Oct 3 03:23:51 2011

This archive was generated by hypermail 2.1.8 : Mon Oct 03 2011 - 03:23:51 CEST