xmpedit

GTK+ editor for XMP metadata embedded in images
git clone https://code.djc.id.au/git/xmpedit/
commit 4ff0033d1aa233fce75c7e22c3a4ded135d94c8a
parent 34b02c88da37fe337bf6b73de3bad9900a7df35c
Author: Dan Callaghan <djc@djc.id.au>
Date:   Sat, 20 Nov 2010 19:23:09 +1000

use rdf:Alt for description

Diffstat:
Msrc/ImageMetadata.vala | 8+++++++-
Mtest/guitest.py | 2+-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/src/ImageMetadata.vala b/src/ImageMetadata.vala
@@ -95,12 +95,18 @@ public class Description : Object, ImageProperty {
     private void update() {
         graph.remove_matching_statements(subject, DC_DESCRIPTION, null);
         if (_value.length > 0) {
+            var alt = new RDF.Blank();
+            graph.insert(new RDF.Statement(subject, DC_DESCRIPTION, alt));
+            graph.insert(new RDF.Statement(alt,
+                    new RDF.URIRef(RDF.RDF_NS + "type"),
+                    new RDF.URIRef(RDF.RDF_NS + "Alt")));
             RDF.PlainLiteral object;
             if (_lang.length > 0)
                 object = new RDF.PlainLiteral.with_lang(_value, _lang);
             else
                 object = new RDF.PlainLiteral(_value);
-            graph.insert(new RDF.Statement(subject, DC_DESCRIPTION, object));
+            graph.insert(new RDF.Statement(alt,
+                    new RDF.URIRef(RDF.RDF_NS + "li"), object));
         }
         changed();
     }
diff --git a/test/guitest.py b/test/guitest.py
@@ -143,7 +143,7 @@ class Test(XmpeditTestCase):
         xmp = extract_xmp(self.tempfile.name)
         self.assertEquals(len(xmp), 2675)
         self.assertEquals(extract_xmp(self.tempfile.name),
-                u'''<?xpacket begin="\ufeff" id="W5M0MpCehiHzreSzNTczkc9d"?><x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="xmpedit 0.0-dev"><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><rdf:Description rdf:about=""><Iptc4xmlCore:Location xmlns:Iptc4xmlCore="http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/">UQ St Lucia</Iptc4xmlCore:Location><dc:description xmlns:dc="http://purl.org/dc/elements/1.1/" xml:lang="en">new description</dc:description></rdf:Description></rdf:RDF></x:xmpmeta>''' + ' ' * 2179 + '''<?xpacket end="w"?>''')
+                u'''<?xpacket begin="\ufeff" id="W5M0MpCehiHzreSzNTczkc9d"?><x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="xmpedit 0.0-dev"><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><rdf:Description rdf:about=""><Iptc4xmlCore:Location xmlns:Iptc4xmlCore="http://iptc.org/std/Iptc4xmpCore/1.0/xmlns/">UQ St Lucia</Iptc4xmlCore:Location><dc:description xmlns:dc="http://purl.org/dc/elements/1.1/"><rdf:Alt><rdf:li xml:lang="en">new description</rdf:li></rdf:Alt></dc:description></rdf:Description></rdf:RDF></x:xmpmeta>''' + ' ' * 2143 + '''<?xpacket end="w"?>''')
 
 if __name__ == '__main__':
     unittest.main()