--- libtm-perl-1.56.orig/debian/watch
+++ libtm-perl-1.56/debian/watch
@@ -0,0 +1,3 @@
+# format version number, currently 3; this line is compulsory!
+version=3
+http://www.cpan.org/authors/id/D/DR/DRRHO/TM-([0-9\.]+).tar.gz
--- libtm-perl-1.56.orig/debian/compat
+++ libtm-perl-1.56/debian/compat
@@ -0,0 +1 @@
+5
--- libtm-perl-1.56.orig/debian/README.source
+++ libtm-perl-1.56/debian/README.source
@@ -0,0 +1,38 @@
+This package uses dpatch to manage all modifications to the upstream
+source. Changes are stored in the source package as diffs in
+debian/patches and applied during the build.
+
+To get the fully patched source after unpacking the source package, cd
+to the root level of the source package and run:
+
+    debian/rules patch
+
+Removing a patch is as simple as removing its entry from the
+debian/patches/00list file, and please also remove the patch file
+itself.
+
+Creating a new patch is done with "dpatch-edit-patch patch XX_patchname"
+where you should replace XX with a new number and patchname with a
+descriptive shortname of the patch. You can then simply edit all the
+files your patch wants to edit, and then simply "exit 0" from the shell
+to actually create the patch file.
+
+To tweak an already existing patch, call "dpatch-edit-patch XX_patchname"
+and replace XX_patchname with the actual filename from debian/patches
+you want to use.
+
+To clean up afterwards again, "debian/rules unpatch" will do the
+work for you - or you can of course choose to call
+"fakeroot debian/rules clean" all together.
+
+
+--- 
+
+this documentation is part of dpatch package, and may be used by
+packages using dpatch to comply with policy on README.source. This
+documentation is meant to be useful to users who are not proficient in
+dpatch in doing work with dpatch-based packages. Please send any
+improvements to the BTS of dpatch package.
+
+original text by Gerfried Fuchs, edited by Junichi Uekawa <dancer@debian.org>
+10 Aug 2008.
--- libtm-perl-1.56.orig/debian/copyright
+++ libtm-perl-1.56/debian/copyright
@@ -0,0 +1,19 @@
+This package was debianized by Alexander Zangerl <az@debian.org> on
+Thu Oct 26 14:23:30 2006.
+
+It was downloaded from the Comprehensive Perl Archive Network (CPAN).
+Visit <http://www.cpan.org/> to find a CPAN site near you.
+
+Upstream Author: Robert Barta, <drrho@cpan.org>.
+
+Copyright: 
+
+Copyright 2001-2008 by Robert Barta, <drrho@cpan.org>
+This library is free software; you can redistribute it and/or modify it
+under the same terms as Perl itself.
+
+This means that you may use - at your choice - either the Perl Artistic License
+or the GNU GPL version 1 or higher.
+
+On Debian systems the GPL, and similar licenses can be found in 
+/usr/share/common-licenses/.
--- libtm-perl-1.56.orig/debian/changelog
+++ libtm-perl-1.56/debian/changelog
@@ -0,0 +1,289 @@
+libtm-perl (1.56-3.5.201403111948) ucs4-0-0-0; urgency=low
+
+  * UCS auto build. No patches were applied to the original source package
+
+ -- Univention builddaemon <buildd@univention.de>  Tue, 11 Mar 2014 19:48:56 +0100
+
+libtm-perl (1.56-3) unstable; urgency=low
+
+  * repaired AsTMa parser, more meaningful %trace and %cancel messages.
+
+ -- Alexander Zangerl <az@debian.org>  Tue, 05 Jun 2012 11:11:59 +1000
+
+libtm-perl (1.56-2) unstable; urgency=low
+
+  * LTM parser repaired (was parse::recdescent pickyness issue)
+
+ -- Alexander Zangerl <az@debian.org>  Sat, 05 Mar 2011 10:34:13 +1000
+
+libtm-perl (1.56-1) unstable; urgency=low
+
+  * New upstream release
+  * lifted standards version
+  * cleaned up some lintian manpage warnings
+  * some AsTMa parser fixes (no misleading line numbers on errors)
+  * LTM support in this release not working
+  
+ -- Alexander Zangerl <az@debian.org>  Thu, 03 Mar 2011 20:53:34 +1000
+
+libtm-perl (1.54-1) unstable; urgency=low
+
+  * New upstream release, added test::exception to build depends
+
+ -- Alexander Zangerl <az@debian.org>  Wed, 25 Aug 2010 23:20:45 +1000
+
+libtm-perl (1.53-1) unstable; urgency=low
+
+  * New upstream release
+  * updated dependencies
+
+ -- Alexander Zangerl <az@debian.org>  Mon, 21 Jun 2010 21:15:19 +1000
+
+libtm-perl (1.50-2) unstable; urgency=low
+
+  * fixed bug in tids, badly affecting internalize (TM.pm)
+
+ -- Alexander Zangerl <az@debian.org>  Thu, 06 May 2010 14:32:09 +1000
+
+libtm-perl (1.50-1) unstable; urgency=low
+
+  * New upstream release (closes: #579899)
+
+ -- Alexander Zangerl <az@debian.org>  Mon, 03 May 2010 20:06:11 +1000
+
+libtm-perl (1.49-1) unstable; urgency=low
+
+  * New upstream release
+  * lifted standards version
+
+ -- Alexander Zangerl <az@debian.org>  Sun, 25 Apr 2010 14:30:19 +1000
+
+libtm-perl (1.48-1) unstable; urgency=low
+
+  * New upstream release
+
+ -- Alexander Zangerl <az@debian.org>  Tue, 13 Apr 2010 16:23:17 +1000
+
+libtm-perl (1.45-3) unstable; urgency=low
+
+  * added JSON Topic Map functionality.
+
+ -- Alexander Zangerl <az@debian.org>  Fri, 09 Apr 2010 19:59:10 +1000
+
+libtm-perl (1.45-2) unstable; urgency=low
+
+  * lifted standards version
+  * cleared some lintian warnings
+  * reworked build rules
+  * disabled two subtests which work fine with perl 5.10.0-19 but 
+    make 5.10.0-25 barf: upstream is a tad too busy to hunt this down right
+    now, and as the functionality being tested is highly experimental in the 
+    first place i believe skipping these two tests for now 
+    is acceptable. (closes: #545614)
+
+ -- Alexander Zangerl <az@debian.org>  Thu, 17 Sep 2009 11:25:48 +1000
+
+libtm-perl (1.45-1) unstable; urgency=low
+
+  * New upstream release
+
+ -- Alexander Zangerl <az@debian.org>  Wed, 09 Sep 2009 12:12:45 +1000
+
+libtm-perl (1.43-7) unstable; urgency=low
+
+  * fixed problem in match_forall code.
+
+ -- Alexander Zangerl <az@debian.org>  Fri, 14 Nov 2008 10:33:57 +1000
+
+libtm-perl (1.43-6) unstable; urgency=low
+
+  * fixed problem with serialization to astma1: topic reification
+    was not exported.
+
+ -- Alexander Zangerl <az@debian.org>  Mon, 27 Oct 2008 10:33:09 +1000
+
+libtm-perl (1.43-5) unstable; urgency=low
+
+  * fixed minor mistake with diff() additions of previous revision.
+
+ -- Alexander Zangerl <az@debian.org>  Wed, 24 Sep 2008 14:52:43 +1000
+
+libtm-perl (1.43-4) unstable; urgency=low
+
+  * added support for diff()ing maps that were created with versions
+    older than 1.31 (internal representation and API changes)
+
+ -- Alexander Zangerl <az@debian.org>  Mon, 15 Sep 2008 08:46:11 +1000
+
+libtm-perl (1.43-3) unstable; urgency=low
+
+  * fixed mistake wrt backporting the %include mechanism that kept
+    the tests from firing and the code from working.
+
+ -- Alexander Zangerl <az@debian.org>  Mon,  1 Sep 2008 09:47:55 +1000
+
+libtm-perl (1.43-2) unstable; urgency=low
+
+  * backported %include mechanism from astma 2.0 to 1.x
+
+ -- Alexander Zangerl <az@debian.org>  Tue, 26 Aug 2008 17:07:14 +1000
+
+libtm-perl (1.43-1) unstable; urgency=low
+
+  * New upstream release
+
+ -- Alexander Zangerl <az@debian.org>  Thu, 21 Aug 2008 10:43:15 +1000
+
+libtm-perl (1.42-1) unstable; urgency=low
+
+  * New upstream release
+  
+ -- Alexander Zangerl <az@debian.org>  Fri, 18 Jul 2008 13:52:53 +1000
+
+libtm-perl (1.26-13) unstable; urgency=low
+
+  * fix extutils::install directory mess (closes: #467987)
+
+ -- Alexander Zangerl <az@debian.org>  Wed, 27 Feb 2008 09:14:34 +1000
+
+libtm-perl (1.26-12) unstable; urgency=low
+
+  * fixed broken TM::DM name() and occurrence() methods, testcases
+  * TM::QL::CParser is now properly (re)generated
+  * some further minor manpage fixes
+
+ -- Alexander Zangerl <az@debian.org>  Tue, 26 Feb 2008 12:42:40 +1000
+
+libtm-perl (1.26-11) unstable; urgency=low
+
+  * fixed minor oversight in AsTMa and XTM serializers (misidentified 
+    some inlines as occurrences)
+  * updated Tau to support the XTM serializer
+
+ -- Alexander Zangerl <az@debian.org>  Wed, 20 Feb 2008 11:22:56 +1000
+
+libtm-perl (1.26-10) unstable; urgency=low
+
+  * fixed missing io::string dependency (closes: #458639)
+
+ -- Alexander Zangerl <az@debian.org>  Wed,  2 Jan 2008 22:00:34 +1000
+
+libtm-perl (1.26-9) unstable; urgency=low
+
+  * reorganized TM pod/manpages
+  * fixed missing xml::writer dependency
+
+ -- Alexander Zangerl <az@debian.org>  Tue, 18 Dec 2007 22:35:01 +1000
+
+libtm-perl (1.26-8) unstable; urgency=low
+
+  * fixed reification of local topics in astma 1 parser
+  * added import from and export to xtm 1.0 format
+
+ -- Alexander Zangerl <az@debian.org>  Sat,  8 Dec 2007 10:12:06 +1000
+
+libtm-perl (1.26-7) unstable; urgency=low
+
+  * modified TM::diff() testcase slightly to make it cooperate with
+    sid's perl (closes: #453217)
+
+ -- Alexander Zangerl <az@debian.org>  Wed, 28 Nov 2007 13:12:06 +1000
+
+libtm-perl (1.26-6) unstable; urgency=low
+
+  * added further fixes and test cases for TM::diff().
+  * cleaned up patches
+
+ -- Alexander Zangerl <az@debian.org>  Thu,  1 Nov 2007 13:35:51 +1000
+
+libtm-perl (1.26-5) unstable; urgency=low
+
+  * added fixes and test cases for TM diff().
+
+ -- Alexander Zangerl <az@debian.org>  Thu, 28 Jun 2007 17:35:10 +1000
+
+libtm-perl (1.26-4) unstable; urgency=low
+
+  * further astma parser fixes and test cases for the fixes, 
+    dealing with upstream problems #27236 and #27231
+
+ -- Alexander Zangerl <az@debian.org>  Wed, 23 May 2007 09:45:34 +1000
+
+libtm-perl (1.26-3) unstable; urgency=low
+
+  * added fix for upstream problem #27235
+
+ -- Alexander Zangerl <az@debian.org>  Tue, 22 May 2007 17:31:30 +1000
+
+libtm-perl (1.26-2) unstable; urgency=low
+
+  * build process now uses dpatch 
+  * added fix for upstream problem #27215: mldbm storage backend
+  * added fix for upstream #27214,27216: cleaned up totally stuffed logging
+
+ -- Alexander Zangerl <az@debian.org>  Tue, 22 May 2007 11:01:49 +1000
+
+libtm-perl (1.26-1) unstable; urgency=low
+
+  * New upstream release
+  * added patch for backslash-escaping inline comments
+  * updated dependencies
+
+ -- Alexander Zangerl <az@debian.org>  Sun,  6 May 2007 17:58:03 +1000
+
+libtm-perl (1.25-2) unstable; urgency=low
+
+  * fixed problem wrt missed dependency
+
+ -- Alexander Zangerl <az@debian.org>  Thu, 15 Feb 2007 19:13:48 +1000
+
+libtm-perl (1.25-1) unstable; urgency=low
+
+  * New upstream release
+
+ -- Alexander Zangerl <az@debian.org>  Thu, 15 Feb 2007 13:27:24 +1000
+
+libtm-perl (1.24-2) unstable; urgency=low
+
+  * added missing build-depends for libxml-simple-perl, as this
+    is used in a test... (closes: #404691)
+
+ -- Alexander Zangerl <az@debian.org>  Thu, 28 Dec 2006 14:43:38 +1000
+
+libtm-perl (1.24-1) unstable; urgency=low
+
+  * New upstream release
+
+ -- Alexander Zangerl <az@debian.org>  Mon, 25 Dec 2006 14:14:20 +1000
+
+libtm-perl (1.23-1) unstable; urgency=low
+
+  * New upstream release
+
+ -- Alexander Zangerl <az@debian.org>  Mon,  4 Dec 2006 13:54:35 +1000
+
+libtm-perl (1.22-1) unstable; urgency=low
+
+  * New upstream release
+
+ -- Alexander Zangerl <az@debian.org>  Fri,  1 Dec 2006 13:44:48 +1000
+
+libtm-perl (1.21-1) unstable; urgency=low
+
+  * New upstream release
+
+ -- Alexander Zangerl <az@debian.org>  Wed, 29 Nov 2006 12:12:04 +1000
+
+libtm-perl (1.20-2) unstable; urgency=low
+
+  * fixed missing libwww-perl dependency (closes: #399317)
+  * lifted standards-version 
+
+ -- Alexander Zangerl <az@debian.org>  Mon, 20 Nov 2006 10:00:08 +1000
+
+libtm-perl (1.20-1) unstable; urgency=low
+
+  * Initial Release.
+
+ -- Alexander Zangerl <az@debian.org>  Thu, 26 Oct 2006 14:18:12 +1000
+
--- libtm-perl-1.56.orig/debian/control
+++ libtm-perl-1.56/debian/control
@@ -0,0 +1,15 @@
+Source: libtm-perl
+Section: perl
+Priority: extra
+Build-Depends: debhelper (>= 5), dpatch
+Build-Depends-Indep: perl (>= 5.8.0-7), libwww-perl, libberkeleydb-perl, libconfig-general-perl, liblog-log4perl-perl, libmldbm-perl, libmldbm-sync-perl, libparse-yapp-perl, libtest-pod-perl, liburi-perl, libxml-libxml-perl, libclass-trait-perl, libparse-recdescent-perl, libtest-deep-perl, libxml-simple-perl, libterm-readline-gnu-perl|libterm-readline-zoid-perl|libterm-readline-perl-perl, libxml-writer-perl, libio-string-perl, libyaml-syck-perl, libregexp-common-perl, libtext-csv-perl, libtest-exception-perl
+Maintainer: Alexander Zangerl <az@debian.org>
+Standards-Version: 3.9.1
+
+Package: libtm-perl
+Architecture: all
+Depends: perl (>= 5.8.0-7), libberkeleydb-perl, libconfig-general-perl, liblog-log4perl-perl, libmldbm-perl, libmldbm-sync-perl, libparse-yapp-perl, liburi-perl, libxml-libxml-perl, libclass-trait-perl, libparse-recdescent-perl, libterm-readline-gnu-perl|libterm-readline-zoid-perl|libterm-readline-perl-perl, libtest-deep-perl, libxml-writer-perl, libio-string-perl, libwww-perl, libyaml-syck-perl, libregexp-common-perl, libtext-csv-perl,  ${misc:Depends}
+Homepage: http://search.cpan.org/~drrho/
+Description: Perl modules for reading/writing Topic Maps
+ This module consists of several classes for reading, querying and building
+ Topic Maps.
--- libtm-perl-1.56.orig/debian/rules
+++ libtm-perl-1.56/debian/rules
@@ -0,0 +1,77 @@
+#!/usr/bin/make -f
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+# If set to a true value then MakeMaker's prompt function will
+# always return the default without waiting for user input.
+export PERL_MM_USE_DEFAULT=1
+
+PACKAGE=$(shell dh_listpackages)
+TMP=$(CURDIR)/debian/$(PACKAGE)
+
+.PHONY: build clean binary-indep binary-arch binary patch unpatch configure
+
+# to get the patch application targets
+include /usr/share/dpatch/dpatch.make
+
+configure: Makefile
+
+Makefile: Makefile.PL
+	dh_testdir
+	perl Makefile.PL INSTALLDIRS=vendor
+
+build: build-stamp 
+build-stamp: $(DPATCH_STAMPFN) Makefile
+	dh_testdir
+
+	# cparser target builds the Fact* modules
+	$(MAKE) OPTIMIZE="-Wall -O2 -g" cparser all
+
+	touch build-stamp
+
+clean: unpatch
+	dh_testdir
+	dh_testroot
+	rm -f xtm.log
+	dh_clean build-stamp install-stamp
+	[ ! -f Makefile ] || $(MAKE) distclean
+	rm -f Makefile Makefile.old
+
+install: build install-stamp
+install-stamp:
+	dh_testdir
+	dh_testroot
+	dh_clean -k
+
+	[ -n "$(filter nocheck,$(DEB_BUILD_OPTIONS))" ] || $(MAKE) test
+
+	$(MAKE) install DESTDIR=$(TMP) 
+
+	# some makemaker/extutils still create this dud dir
+	[ ! -d $(TMP)/usr/lib/perl5 ] || rmdir --ignore-fail-on-non-empty --parents $(TMP)/usr/lib/perl5
+
+	touch install-stamp
+
+binary-arch:
+# We have nothing to do by default.
+
+binary-indep: build install
+	rm -f xtm.log
+
+	dh_testdir
+	dh_testroot
+	dh_installdocs README
+	dh_installchangelogs Changes
+	dh_perl
+	dh_link
+	dh_strip
+	dh_compress
+	dh_fixperms
+	dh_installdeb
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+binary: binary-indep binary-arch
+
--- libtm-perl-1.56.orig/debian/patches/02match.dpatch
+++ libtm-perl-1.56/debian/patches/02match.dpatch
@@ -0,0 +1,21 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 02match.dpatch by  <az@debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: fixes match_forall wrt. nonexistent super/subclass assocs
+
+@DPATCH@
+diff -urNad libtm-perl-1.43~/lib/TM.pm libtm-perl-1.43/lib/TM.pm
+--- libtm-perl-1.43~/lib/TM.pm	2008-11-14 10:32:45.228224161 +1000
++++ libtm-perl-1.43/lib/TM.pm	2008-11-14 10:33:04.535860833 +1000
+@@ -2863,8 +2863,8 @@
+     # if we still do not have a decision, we will check all super types of $class and see (recursively) whether we can establish is-subclass-of
+     return 1 if grep ($self->is_subclass ($_, $super),                       # check all of the intermediate type whether there is a transitive relation
+ 		      map { $self->get_x_players ($_, $SUPERCLASS) }         # find the superclass player there => intermediate type
+-		      $self->match_forall (type       => $SUBCLASSES,
+-					   subclass   => $class)
++		      grep(defined $_,$self->match_forall (type       => $SUBCLASSES,
++							   subclass   => $class))
+ 		      );
+     return 0;                                                                # ok, we give up now
+ }
--- libtm-perl-1.56.orig/debian/patches/04manpagefixes.dpatch
+++ libtm-perl-1.56/debian/patches/04manpagefixes.dpatch
@@ -0,0 +1,47 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 04manpagefixes.dpatch by  <az@debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: fix some lintian-flagged pod/man issues
+
+@DPATCH@
+diff -urNad libtm-perl-1.56~/lib/TM/CTM/Parser.pm libtm-perl-1.56/lib/TM/CTM/Parser.pm
+--- libtm-perl-1.56~/lib/TM/CTM/Parser.pm	2011-03-03 21:39:23.000000000 +1000
++++ libtm-perl-1.56/lib/TM/CTM/Parser.pm	2011-03-03 21:39:24.128966340 +1000
+@@ -583,6 +583,10 @@
+ 
+ =pod
+ 
++=head1 NAME
++
++TM::CTM::Parser - Topic Maps, trait for parsing maps in CTM format
++
+ =head1 SEE ALSO
+ 
+ L<TM>
+diff -urNad libtm-perl-1.56~/lib/TM/LTM/Parser.pm libtm-perl-1.56/lib/TM/LTM/Parser.pm
+--- libtm-perl-1.56~/lib/TM/LTM/Parser.pm	2008-04-10 03:28:17.000000000 +1000
++++ libtm-perl-1.56/lib/TM/LTM/Parser.pm	2011-03-03 21:39:47.041966142 +1000
+@@ -316,6 +316,10 @@
+ 
+ =pod
+ 
++=head1 NAME
++
++TM::LTM::Parser - Topic Maps, trait for parsing maps in LTM format
++
+ =head1 SEE ALSO
+ 
+ L<TM>
+diff -urNad libtm-perl-1.56~/lib/TM/Serializable/CSV.pm libtm-perl-1.56/lib/TM/Serializable/CSV.pm
+--- libtm-perl-1.56~/lib/TM/Serializable/CSV.pm	2011-03-03 21:39:23.000000000 +1000
++++ libtm-perl-1.56/lib/TM/Serializable/CSV.pm	2011-03-03 21:39:24.128966340 +1000
+@@ -235,8 +235,6 @@
+ 
+ =back
+ 
+-=back
+-
+ Example:
+ 
+     $tm->serialize (header_line => 'association-type,location,bio-unit',
--- libtm-perl-1.56.orig/debian/patches/01abimigration.dpatch
+++ libtm-perl-1.56/debian/patches/01abimigration.dpatch
@@ -0,0 +1,167 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 01abimigration.dpatch by  <az@debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: support for diff()ing frozen maps across the 1.2x->1.3x ABI/API changes
+
+@DPATCH@
+diff -urNad libtm-perl-1.43~/lib/TM.pm libtm-perl-1.43/lib/TM.pm
+--- libtm-perl-1.43~/lib/TM.pm	2008-07-22 04:33:23.000000000 +1000
++++ libtm-perl-1.43/lib/TM.pm	2008-09-24 14:52:05.312431923 +1000
+@@ -771,10 +771,16 @@
+ =item I<identities>
+ 
+ This hash consists of the non-trivial toplet identities that were found. If neither Subject- nor
+-Indicator-based merging is active, then this hash is empty. Otherwise, the keys are toplet
+-identifiers in the old map, with the corresponding topic identifier in the new map as value. This 
+-includes standalone topics as well as assertions and associations that were renamed due to 
+-changed player or role identities.
++Indicator-based merging is active and if neither map object was created with a TM version before 1.31, 
++then this hash is empty. Otherwise, the keys are toplet identifiers in the old map, with the 
++corresponding topic identifier in the new map as value. This includes standalone topics as well 
++as assertions and associations that were renamed due to changed player or role identities.
++
++For diff operations between maps where one map was created with a TM version before 1.31 (which can happen 
++with frozen/thawed or MLDBM-based maps) extra identifying steps are performed (because the identifier 
++format for assertions and infrastructure toplets and the stored format of toplets have changed). This situation 
++is detected automatically, and if so the identities hash will also include all map elements that were identical but 
++have different names due to the version incompatibility.
+ 
+ =item I<modified>
+ 
+@@ -821,10 +827,23 @@
+ 	my $key   = ($map eq $oldmap ? "old":"new");
+ 	my $value = ($map eq $oldmap ? 1:2);
+ 
+-	for my $m (map { $_->[TM->LID] } ($map->toplets(\ '+all'))) {
++	# if either is older than tm 1.31, then we need to deal with base-prefixed toplets (called midlets then)
++	# which are no longer prefixed (for all infrastructure topics)
++	$xlatneeded||=1
++	    if (exists($map->{usual_suspects})); # this key is no longer present in newer maps
++
++	for my $m (keys %{$map->{mid2iid}})
++	{
+ 	    # get the topic-aspects (tid, locators and identifiers)
+ 	    # for finding unchanged/new/old topics
+ 	    my $midlet=$map->toplet($m);
++
++	    # fudging time is here :-(
++	    # if this is an old map with address and indicators but no lid, we frob one in.
++	    if (@{$midlet}==2)
++	    {
++		$midlet=[$m,@{$midlet}];
++	    }
+ 	    $locators{$key}->{$midlet->[TM->ADDRESS]}=$m
+ 		if ($midlet->[TM->ADDRESS]);
+ 	    map { $indicators{$key}->{$_}=$m } (@{$midlet->[TM->INDICATORS]});
+@@ -839,6 +858,27 @@
+     # first identity: same topic ids 
+     my %old2new = map { ($_,$_) } grep { $seen{$_} == 3 } keys %seen;
+     my $foundxlat;
++    # almost-first identity: infrastructure topics which were base-prefixed but are no longer
++    if (exists($oldmap->{usual_suspects}) ^ exists($newmap->{usual_suspects}))
++    {
++	for my $short (grep { $seen{$_} != 3 && $_!~/^$base/ } keys %seen)
++	{
++	    my $long=$base.$short;
++	    if ($infrastructure->{mid2iid}->{$short} && $seen{$long} == 3-$seen{$short})
++	    {
++		if ($seen{$long} == 2) # saw long in new map
++		{
++		    $old2new{$short}=$long;
++		}
++		else
++		{
++		    $old2new{$long}=$short;
++		}
++		$foundxlat||=1;
++	    }
++	}
++    }		
++
+     if (grep($_==TM->Subject_based_Merging,@{$options->{consistency}}))
+     {
+ 	# second: same locators
+@@ -889,10 +929,9 @@
+     # weed out the topics/midlets that are unchanged
+     # and all the identical assertions
+     my @checkassertion;
+-    for my $t (keys %checkmidlet) {
+-
+-	if ($t =~ /^[A-F0-9]{32}$/i) {
+-	    my $oa=$oldmap->retrieve($t);
++    for my $t (keys %checkmidlet) 
++    {
++	if (my $oa=$oldmap->retrieve($t)) { 
+ 	    my $on=$newmap->retrieve($old2new{$t});
+ 	    
+ 	    if ($oa && $on && $oa->[TM->LID] ne $on->[TM->LID]) {
+@@ -913,6 +952,9 @@
+ 	    {
+ 		my ($a,$b)=@_;
+ 		
++		$a=["",@{$a}] if (@{$a}==2); # fudge in blank LID for old maps
++		$b=["",@{$b}] if (@{$b}==2); # fudge in blank LID for old maps
++		
+ 		my ($A, $B) = ($a->[TM->ADDRESS] ||'', $b->[TM->ADDRESS] ||'');       # just convert undef into ''
+ 		return 0 unless $A eq $B;                                             # different subject address?
+ 		my %SIDS;
+@@ -920,11 +962,9 @@
+ 		return 0 if grep { $_ != 2 } values %SIDS;                            # if it is not exactly 2 (one from a, one from b), then not equal
+ 		return 1; # we're happy: different LIDs don't interest us here
+ 	    }
+-	    
+ 	}
+     }
+ 
+-#warn "modified ".Dumper \%modified;
+ 
+     my %old2newid;    
+     my %identities; 
+@@ -934,6 +974,10 @@
+ 	# into new namespace and compute the id
+ 	# don't waste time: do this only on the assertions that may be required
+ 	# minusass (or plusass) must be checked to find assertions with renamed-but-identical players
++	
++	# once more fudging time: if the "new" map object uses the long lid-format (ie. made with older api),
++	# we need to append the base ourselves because mklabel does not do that anymore.
++	my $maybebase=(($newmap->asserts)[0]->[TM->LID]=~/^$base/ )?$base:"";
+ 	for my $t (@checkassertion,keys %minusass)
+ 	{
+ 	    my $m=$oldmap->retrieve($t);
+@@ -952,7 +996,7 @@
+ 				 type=>$type,
+ 				 roles=>\@newroles,players=>\@newplayers);
+ 	    $newmap->canonicalize($n);
+-	    my $newid=TM::mklabel($n);
++	    my $newid=$maybebase.TM::mklabel($n); 
+ 	    $old2newid{$t}=$newid;
+ 
+ 	    if ($plusass{$newid}) # we found a matching assertion, wohee!
+@@ -981,6 +1025,9 @@
+ 	{
+ 	    $unmodified=\%minus; $map=$oldmap; $candidates=\%minusass;
+ 	}
++
++	# working with potentially old maps we may need to base-prefix or not...
++	my $maybebase=(($map->asserts)[0]->[TM->LID]=~/^$base/ )?$base:"";
+ 	
+ 	for my $t (keys %{$candidates})
+ 	{
+@@ -989,13 +1036,13 @@
+ 	    if ($m->[TM->KIND] ne TM->ASSOC)
+ 	    {
+ 		# bn or oc: attach to referenced topic
+-		$who=($map->get_x_players($m,"thing"))[0];
++		$who=($map->get_x_players($m,$maybebase."thing"))[0];
+ 		$what=$t;
+ 	    }
+-	    elsif ($m->[TM->TYPE] eq "isa")
++	    elsif ($m->[TM->TYPE] eq $maybebase."isa")
+ 	    {
+ 		# isa associations get attached to the instance topic
+-		$who=($map->get_x_players($m,"instance"))[0];
++		$who=($map->get_x_players($m,$maybebase."instance"))[0];
+ 		$what=$t;
+ 	    }
+ 	    else 
--- libtm-perl-1.56.orig/debian/patches/03astmaparser.dpatch
+++ libtm-perl-1.56/debian/patches/03astmaparser.dpatch
@@ -0,0 +1,348 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 03reifiedassoc.dpatch by  <az@debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: fixing various minor astma parser bugs and issues
+
+@DPATCH@
+diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' libtm-perl-1.56~/t/041astmafact.t libtm-perl-1.56/t/041astmafact.t
+--- libtm-perl-1.56~/t/041astmafact.t	2012-06-05 11:17:55.000000000 +1000
++++ libtm-perl-1.56/t/041astmafact.t	2012-06-05 11:17:55.513090521 +1000
+@@ -140,6 +140,31 @@
+   is ($ms->toplets,        $npt, 'empty map 2 (toplets)');
+ }
+ 
++#-- dots in topic ids
++eval {
++  my $ms = _parse (q|
++this.is.a.valid.topic.name
++
++this.is.even-more.so.a_topic
++
++|);
++}; 
++ok(!$@,'topics with dots in the name work');
++
++eval {
++  my $ms = _parse (q|
++in-line-with-policy
++bn: goals of backup system must be in line with corp policies
++in: eg: no backup of desktops
++
++ex-suggested
++bn: ex-suggested:
++
++|);
++}; 
++ok(!$@,'topics with in- and ex- in the name work');
++
++
+ { # empty line with blanks
+   my $ms = _parse (q|
+ topic1
+@@ -433,6 +458,15 @@
+   is (scalar $ms->match (TM->FORALL, scope => 'tm:sss',                   iplayer => 'tm:player' ),   1, 'association scoped 3');
+ }
+ 
++{
++  my $ms = _parse (q|
++(is-a-wonderful)
++role : aaa bbb
++
++|);
++is (scalar $ms->match, $npa+1, 'association with is-a type');
++}
++
+ #-- reification --------------------------------------
+ 
+ {
+@@ -509,13 +543,13 @@
+ 
+ {
+   my $ms = _parse (q|
+-(xxx) is-reified-by aaa
++(xxx) is-reified-by aaa-and-bbb
+   role : player
+ |);
+ #warn Dumper $ms;
+   my ($a) = $ms->match (TM->FORALL, type => 'tm:xxx');
+-  is_deeply ([ $ms->is_reified ($a) ], [ 'tm:aaa' ], 'assoc reified: regained');
+-  is ($ms->reifies ('tm:aaa'), $a,                   'assoc reified: regained 2');
++  is_deeply ([ $ms->is_reified ($a) ], [ 'tm:aaa-and-bbb' ], 'assoc reified: regained');
++  is ($ms->reifies ('tm:aaa-and-bbb'), $a,                   'assoc reified: regained 2');
+ }
+ 
+ {
+@@ -1055,6 +1089,48 @@
+ 
+ }
+ 
++
++{
++    my $tmp;
++    use IO::File;
++    use POSIX qw(tmpnam);
++    do { $tmp = tmpnam().".atm" ;  } until IO::File->new ($tmp, O_RDWR|O_CREAT|O_EXCL);
++
++    my $fh = IO::File->new ("> $tmp") || die "so what?";
++    print $fh q|
++aaa
++
++ccc
++|;
++    $fh->close;
++
++    my $ms = _parse (qq|
++
++eee
++
++%include file:$tmp
++
++|);
++#warn Dumper $ms;
++    is ($ms->tids ('aaa'), 'tm:aaa', '%include: file, internalized');
++    is ($ms->tids ('ccc'), 'tm:ccc', '%include: file, internalized');
++    is ($ms->tids ('eee'), 'tm:eee', '%include: file, internalized');
++}
++
++{ # include with UNIX pipe
++    my $ms = _parse (qq|
++
++eee
++
++%include (echo "aaa" ; echo ; echo "ccc" ; echo ) \|
++
++|);
++    is ($ms->tids ('aaa'), 'tm:aaa', '%include: pipe, internalized');
++    is ($ms->tids ('ccc'), 'tm:ccc', '%include: pipe, internalized');
++    is ($ms->tids ('eee'), 'tm:eee', '%include: pipe, internalized');
++
++};
++
+ my ($tmp);
+ use IO::File;
+ use POSIX qw(tmpnam);
+@@ -1073,7 +1149,7 @@
+ |);
+ 
+  is (scalar $ms->toplets, $npt+1, 'cancelling');
+- ERRexpect ("Cancelled");
++ ERRexpect ("Parsing cancelled");
+ ##warn Dumper $ms;
+ }
+ 
+@@ -1087,7 +1163,7 @@
+ |);
+ 
+  is (scalar $ms->toplets, $npt+1, 'cancelling (blanks)');
+- ERRexpect ("Cancelled");
++ ERRexpect ("Parsing cancelled");
+ ##warn Dumper $ms;
+ }
+ 
+@@ -1137,9 +1213,6 @@
+     close (ERR);
+ }
+ 
+-__END__
+-
+-
+ 
+ __END__
+ 
+@@ -1188,8 +1261,6 @@
+    ok (!$@);
+ } 
+ 
+-__END__
+-
+ ##=========================================================
+ 
+ 
+diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' libtm-perl-1.56~/yapp/astma-fact.yp libtm-perl-1.56/yapp/astma-fact.yp
+--- libtm-perl-1.56~/yapp/astma-fact.yp	2012-06-05 11:17:55.000000000 +1000
++++ libtm-perl-1.56/yapp/astma-fact.yp	2012-06-05 11:20:23.435860221 +1000
+@@ -24,6 +24,7 @@
+ %token ISINDICATEDBY
+ %token LOG
+ %token CANCEL
++%token INCLUDE
+ %token TRACE
+ %token ENCODING
+ %token COLON
+@@ -39,9 +40,31 @@
+                    | maplet_definitions maplet_definition
+                    | maplet_definitions template_definition EOL
+                    | maplet_definitions COMMENT EOL
+-                   | maplet_definitions LOG EOL             { warn "Logging $_[2]"; }
+-                   | maplet_definitions CANCEL EOL          { die  "Cancelled"; }
+-                   | maplet_definitions TRACE EOL           { $tracing = $_[2]; warn "# start tracing: level $tracing"; }
++                   | maplet_definitions LOG EOL             { warn "Logging $_[2]\n"; }
++                   | maplet_definitions CANCEL EOL          { die  "Parsing cancelled\n"; }
++		| maplet_definitions INCLUDE EOL {
++		    my $content;
++
++		    if ($_[2] =~ /\|\s*$/) 
++		    { # a pipe | at the end, this is a UNIX pipe
++			use IO::File;
++			my $fh = IO::File->new ($_[2]) 
++			    || die "unable to open pipe '$_[2]'\n";
++			local $/ = undef;
++			$content = <$fh>;
++			$fh->close;
++		    } 
++		    else 
++		    {
++			use LWP::Simple;
++			$content = get($_[2]) 
++			    || die "unable to load '$_[2]' with LWP\n";
++		    }
++		    $_[0]->YYData->{INPUT} = 
++			$content . $_[0]->YYData->{INPUT}; # prepend it
++		}
++
++                   | maplet_definitions TRACE EOL           { $tracing = $_[2]; warn "start tracing: level $tracing\n"; }
+                    | maplet_definitions ENCODING EOL        {
+ 		                                              use Encode;
+ 							      Encode::from_to ($_[0]->YYData->{INPUT}, "iso-8859-1", $_[2]);
+@@ -55,17 +78,22 @@
+ 
+ topic_definition  : ID types reification_indication inline_assocs EOL
+                     {
++			my $tn=$_[1];
+ 			$_[1] = $_[0]->{USER}->{store}->internalize ($_[1]);
+ 
+ 			if (ref $_[3]) {                                                   # we have reification info
+ 			    if (     $_[3]->[0] == 1) {                                    # 1 = REIFIES, means current ID is a shorthand for the other
+-				$_[0]->{USER}->{store}->internalize ($_[1] => $_[3]->[1]); 
++				my $target=$_[3]->[1];
++				# the other is a local id? then lookup/insert such a topic 
++				$target=$_[0]->{USER}->{store}->internalize($_[0]->{USER}->{store}->baseuri.$target)
++				    if ($target=~/^[a-z_:][a-z0-9_:.-]*$/i); 
++				$_[0]->{USER}->{store}->internalize ($_[1] => $target); 
+ 			    } elsif ($_[3]->[0] == 0) {                                    # 0 = IS-REIFIED, this must be the other way round
+ 				$_[0]->{USER}->{store}->internalize ($_[3]->[1] => $_[1]);
+ 			    } elsif ($_[3]->[0] == 2) {                                    # 2 = ISINDICATEDBY, add the subject indicators
+ 				$_[0]->{USER}->{store}->internalize ($_[1] => \ $_[3]->[1]);
+ 			    } else {
+-				die "internal fu**up";
++				die "internal fu**up\n";
+ 			    }
+ 			}
+ 			# assert instance/class
+@@ -119,7 +147,7 @@
+ 							    undef ], 'Assertion' );
+ 				} elsif ($templates->tids ( $type ) &&
+ 					 (my @ts    = $templates->match (TM->FORALL, type => $templates->tids ( $type )  ))) {
+-				    warn "duplicate template for '$type' found (maybe typo?), taking one" if @ts > 1;
++				    warn "duplicate template for '$type' found (maybe typo?), taking one\n" if @ts > 1;
+ 				    my $t = $ts[0];                                           # I choose one
+ 				    $store->assert (bless [ undef,                   	      # LID
+ 							    undef,                   	      # SCOPE
+@@ -153,11 +181,11 @@
+ 						           ],
+ 							    undef ], 'Assertion' );
+ 				} else {
+-				    die "unknown association type '$type' in inlined association";
++				    die "unknown association type '$type' in inlined association\n";
+ 				}
+ 			    }
+ 			}
+-			warn "added toplet $_[1]" if $tracing;
++			warn "added toplet $tn\n" if $tracing;
+ 		     }
+                        characteristics_indication
+                         {
+@@ -185,7 +213,7 @@
+ 			    map { $implicits->{'subclasses'}->{ $_->[0] == TM->NAME ? 'name' : 'occurrence' }->{$_->[2]}++ }
+                             grep ($_->[2], @{$_[7]->[0]});                              # get all the characteristics with types
+ 			}
+-			warn "added ".(scalar @{$_[7]->[0]})."characteristics for $_[1]" if $tracing > 1;
++			warn "added ".(scalar @{$_[7]->[0]})." characteristics for $_[1]\n" if $tracing > 1;
+ 		    }
+ ;
+ 
+@@ -287,16 +315,16 @@
+ 					  # (assoc) reifies http://.... means
+ 					  #     1) the assoc will be addes as thing (is done already)
+ 					  #     2) the http:// will be used as one subject indicator
+-					  die "reifier of association must be a URI" unless $_[5]->[1] =~ /^\w+:.+/;
++					  die "reifier of association must be a URI\n" unless $_[5]->[1] =~ /^\w+:.+/;
+ 					  $ms->internalize ($a->[TM::LID], $_[5]->[1]);
+ 				      } elsif ($_[5]->[0] == 0) {              # something reifies this assoc
+ 					  # (assoc) is-reified-by xxx   means
+ 					  #     1) assoc is added as thing (is done already)
+ 					  #     2) the local identifier is added as thing with the abs URL of the assoc as subject address
+-					  die "reifier must be local identifier" unless $_[5]->[1] =~ /^[A-Za-z][A-Za-z0-9_\.-]+$/;
++					  die "reifier must be local identifier\n" unless $_[5]->[1] =~ /^[A-Za-z][A-Za-z0-9_\.-]+$/;
+ 					  $ms->internalize ($_[5]->[1] => $a);
+ 				      } else { # this would be 'indication' but we do not want that here
+-					  die "indication for associations are undefined";
++					  die "indication for associations are undefined\n";
+ 				      }
+ 				  }
+ 			      }
+@@ -307,7 +335,7 @@
+ # implicit			   $implicits->{'subclasses'}->{'association'}->{$_[2]}++;
+ 				   $_[0]->{USER}->{implicits}->{'isa-scope'}->{$_[4]}++ if $_[4];
+ 			       }
+-			       warn "added assertion $_[2]" if $tracing;
++			       warn "added assertion $_[2]\n" if $tracing;
+ 			   }
+ ;
+ 
+@@ -329,13 +357,13 @@
+                            | ids ID                           { push @{$_[1]}, $_[2]; $_[1] }
+ ;
+ 
+-string                     : STRING EOL { die "empty string in characteristics" unless $_[1]; $_[1] }
++string                     : STRING EOL { die "empty string in characteristics\n" unless $_[1]; $_[1] }
+ ;
+ 
+ %%
+ 
+ sub _Error {
+-    die "Syntax error: Found ".$_[0]->YYCurtok." but expected ".join (' or ', $_[0]->YYExpect);
++    die "Syntax error: Found ".$_[0]->YYCurtok." but expected ".join (' or ', $_[0]->YYExpect)."\n";
+ }
+ 
+ use constant CHUNK_SIZE => 32000;
+@@ -358,13 +386,14 @@
+ #warn "lexer ($parser->{USER}->{string}):>>>".$parser->YYData->{INPUT}."<<<";
+ 
+     $$refINPUT =~ s/^\n//so                           and return ('EOL',       	   undef);
++    # note: these are notoriously imprecise and prohibit topics named in, rd, ex, oc or bn.
+     $$refINPUT =~ s/^in\b(?![\.-])//o                 and return ('IN',        	   undef);
+     $$refINPUT =~ s/^rd\b(?![\.-])//o                 and return ('IN',        	   undef);
+     $$refINPUT =~ s/^oc\b(?![\.-])//o                 and return ('OC',        	   undef);
+     $$refINPUT =~ s/^ex\b(?![\.-])//o                 and return ('OC',        	   undef);
+     $$refINPUT =~ s/^bn\b(?![\.-])//o                 and return ('BN',        	   undef);
+ 
+-    $$refINPUT =~ s/^sin\b(?![\.-])//o                and return ('SIN',       	   undef);
++    $$refINPUT =~ s/^sin\s*(?=:)//o                and return ('SIN',       	   undef);
+     $$refINPUT =~ s/^is-a\b(?![\.-])//o               and return ('ISA',       	   undef);
+     $$refINPUT =~ s/^reifies\b(?![\.-])//o            and return ('REIFIES',   	   undef);
+     $$refINPUT =~ s/^=//o                             and return ('REIFIES',   	   undef);
+@@ -404,6 +433,8 @@
+     $$refINPUT =~ s/^(\d{4}-\d{1,2}-\d{1,2})(\s+(\d{1,2}):(\d{2}))?//o
+                                                       and return ('ID',        sprintf "urn:x-date:%s:%02d:%02d", $1, $3 || 0, $4 || 0); # is a date
+ 
++    $$refINPUT =~ s/^%include\s+(.*?)(?=\n)//so 
++	and return ('INCLUDE',   $1); # positive look-ahead
+     $$refINPUT =~ s/^%log\s+(.*?)(?=\n)//so           and return ('LOG',       $1); # positive look-ahead
+     $$refINPUT =~ s/^%cancel\s*(?=\n)//so             and return ('CANCEL',    $1); # positive look-ahead
+     $$refINPUT =~ s/^%trace\s+(.*?)(?=\n)//so         and return ('TRACE',     $1); # positive look-ahead
+@@ -450,10 +481,10 @@
+ 
+     eval {
+ 	$self->YYParse ( yylex => \&_Lexer, yyerror => \&_Error );
+-    }; if ($@ =~ /^Cancelled/) {
+-	warn $@;                                                        # de-escalate Cancelling to warning
++    }; if ($@ =~ /^Parsing cancelled/) {
++	warn $@."\n";                                                        # de-escalate Cancelling to warning
+     } elsif ($@) {
+-	die $@;                                                         # otherwise re-raise the exception
++	die $@."\n";                                                         # otherwise re-raise the exception
+     }
+ 
+ 
--- libtm-perl-1.56.orig/debian/patches/00list
+++ libtm-perl-1.56/debian/patches/00list
@@ -0,0 +1,7 @@
+01abimigration
+01internalize
+02mldbm
+02match
+03astmaparser
+04manpagefixes
+06parserhotfix
\ No newline at end of file
--- libtm-perl-1.56.orig/debian/patches/02mldbm.dpatch
+++ libtm-perl-1.56/debian/patches/02mldbm.dpatch
@@ -0,0 +1,37 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 01mldbm.dpatch by  <az@debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: fix for upstream #27215: use berkeley db, don't die in mtime on nxfile
+
+@DPATCH@
+diff -urNad libtm-perl-1.53~/lib/TM/Synchronizable/MLDBM.pm libtm-perl-1.53/lib/TM/Synchronizable/MLDBM.pm
+--- libtm-perl-1.53~/lib/TM/Synchronizable/MLDBM.pm	2008-09-26 01:54:58.000000000 +1000
++++ libtm-perl-1.53/lib/TM/Synchronizable/MLDBM.pm	2010-06-21 21:37:45.776848350 +1000
+@@ -5,7 +5,8 @@
+ 
+ use Data::Dumper;
+ 
+-use MLDBM qw(MLDBM::Sync::SDBM_File Storable);
++#use MLDBM qw(MLDBM::Sync::SDBM_File Storable);
++use MLDBM qw(DB_File);
+ use MLDBM::Sync;
+ use Fcntl qw(:DEFAULT);
+ 
+diff -urNad libtm-perl-1.53~/lib/TM/Synchronizable.pm libtm-perl-1.53/lib/TM/Synchronizable.pm
+--- libtm-perl-1.53~/lib/TM/Synchronizable.pm	2010-06-05 04:41:54.000000000 +1000
++++ libtm-perl-1.53/lib/TM/Synchronizable.pm	2010-06-21 21:40:24.391848130 +1000
+@@ -84,9 +84,12 @@
+     my $self = shift;
+     my $url  = $self->url;
+ 
++    my $mtime=$self->mtime;
++    die "source '$url' is not accessible or does not exist.\n"
++	if (!defined $mtime);
+     $self->source_in (@_) if $self->last_mod           # modification in map
+                           <                            # earlier than
+-                          $self->mtime + 1;            # modification of resource
++                          $mtime + 1;            # modification of resource
+ }
+ 
+ =pod
--- libtm-perl-1.56.orig/debian/patches/06parserhotfix.dpatch
+++ libtm-perl-1.56/debian/patches/06parserhotfix.dpatch
@@ -0,0 +1,29 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 06parserhotfix.dpatch by  <az@debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: No description.
+
+@DPATCH@
+diff -urNad libtm-perl-1.56~/lib/TM/LTM/Parser.pm libtm-perl-1.56/lib/TM/LTM/Parser.pm
+--- libtm-perl-1.56~/lib/TM/LTM/Parser.pm	2011-03-05 10:39:32.000000000 +1000
++++ libtm-perl-1.56/lib/TM/LTM/Parser.pm	2011-03-05 10:45:48.035966323 +1000
+@@ -157,9 +157,9 @@
+ 							 [ map { $_->[1] } @{$item[3]} ],               # ROLES
+ 							 [ map { $_->[0] } @{$item[3]} ],               # PLAYERS
+ 							 undef ]);
+-			  $return = $a;
+ #warn "reify ".Dumper $item[6];
+ 			  $store->internalize ($item[6]->[0], $a->[TM->LID]) if $item[6]->[0];
++			  $return = $a;
+ 		      }
+ 
+                       assocroles : assocrole(s /,/)
+@@ -290,6 +290,7 @@
+     $self->{parser}->startrule (\$text, 1, $self->{store}, $TM::log, $implicits);
+     $TM::log->logdie ( scalar __PACKAGE__ . ": Found unparseable '".substr($text,0,40)."....'" ) unless $text =~ /^\s*$/s;
+ 
++
+     { # resolving implicit stuff
+ 	my $store     = $self->{store};
+ 
--- libtm-perl-1.56.orig/debian/patches/01internalize.dpatch
+++ libtm-perl-1.56/debian/patches/01internalize.dpatch
@@ -0,0 +1,24 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 01internalize.dpatch by  <az@debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: improve documentation of internalize oddities
+
+@DPATCH@
+diff -urNad libtm-perl-1.53~/lib/TM.pm libtm-perl-1.53/lib/TM.pm
+--- libtm-perl-1.53~/lib/TM.pm	2010-06-21 21:31:18.323848241 +1000
++++ libtm-perl-1.53/lib/TM.pm	2010-06-21 21:31:18.377848271 +1000
+@@ -1343,6 +1343,13 @@
+ then perl will (un)helpfully replace the required undef with the string "undef" and wreck the operation. 
+ Using either a variable to hold the undef or replacing the (syntactic sugar) arrow with a comma works around this issue.
+ 
++Attention: If you call internalize like this
++
++  $tm->internalize(undef => $whatever) 
++
++then perl will (un)helpfully replace the required undef with the string "undef" and wreck the operation. 
++Using either a variable to hold the undef or replacing the (syntactic sugar) arrow with a comma works around this issue.
++
+ =item C<undef =E<gt> \ URI>
+ 
+ Like above, only that the URI us used as subject identifier.
--- libtm-perl-1.56.orig/debian/patches/debian/patches/03astmaparser.dpatch
+++ libtm-perl-1.56/debian/patches/debian/patches/03astmaparser.dpatch
@@ -0,0 +1,30 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 03astmaparser.dpatch by  <az@debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: No description.
+
+@DPATCH@
+diff -urNad libtm-perl-1.56~/yapp/astma-fact.yp libtm-perl-1.56/yapp/astma-fact.yp
+--- libtm-perl-1.56~/yapp/astma-fact.yp	2011-03-03 23:21:22.495966334 +1000
++++ libtm-perl-1.56/yapp/astma-fact.yp	2011-03-03 23:23:20.794966558 +1000
+@@ -358,13 +358,13 @@
+ #warn "lexer ($parser->{USER}->{string}):>>>".$parser->YYData->{INPUT}."<<<";
+ 
+     $$refINPUT =~ s/^\n//so                           and return ('EOL',       	   undef);
+-    $$refINPUT =~ s/^in\b(?![\.-])//o                 and return ('IN',        	   undef);
+-    $$refINPUT =~ s/^rd\b(?![\.-])//o                 and return ('IN',        	   undef);
+-    $$refINPUT =~ s/^oc\b(?![\.-])//o                 and return ('OC',        	   undef);
+-    $$refINPUT =~ s/^ex\b(?![\.-])//o                 and return ('OC',        	   undef);
+-    $$refINPUT =~ s/^bn\b(?![\.-])//o                 and return ('BN',        	   undef);
++    $$refINPUT =~ s/^in\s*:/:/o                 and return ('IN',        	   undef);
++    $$refINPUT =~ s/^rd\s*:/:/o                 and return ('IN',        	   undef);
++    $$refINPUT =~ s/^oc\s*:/:/o                 and return ('OC',        	   undef);
++    $$refINPUT =~ s/^ex\s*:/:/o                 and return ('OC',        	   undef);
++    $$refINPUT =~ s/^bn\s*:/:/o                 and return ('BN',        	   undef);
+ 
+-    $$refINPUT =~ s/^sin\b(?![\.-])//o                and return ('SIN',       	   undef);
++    $$refINPUT =~ s/^sin\s*:/:/o                and return ('SIN',       	   undef);
+     $$refINPUT =~ s/^is-a\b(?![\.-])//o               and return ('ISA',       	   undef);
+     $$refINPUT =~ s/^reifies\b(?![\.-])//o            and return ('REIFIES',   	   undef);
+     $$refINPUT =~ s/^=//o                             and return ('REIFIES',   	   undef);
