XMP/RDF help needed
- From: Bengt Thuree <bengt thuree com>
- To: f-spot-list <f-spot-list gnome org>
- Subject: XMP/RDF help needed
- Date: Thu, 25 May 2006 07:59:33 +0800
Hi Guys
I am playing with Warrens patch, and using Gabriels GThumb tag import
patch as a template. So far so good. I have managed to import the normal
keywords (the ones F-Spot stores), plus some normal photoshop/iView
stored parameters. I am stuck on some other tags...
Do anyone have any clue of how to import tags in XMP/RDF?
I have done the following,
> if (xmptags_sidecar)
> xmpfile = new XmpFile(System.IO.File.OpenRead(xmptags_file));
> else {
> JpegFile jpegfile = new JpegFile(xmptags_file);
> JpegHeader jpegheader = jpegfile.Header;
> xmpfile = jpegheader.GetXmp();
> }
>
> Console.WriteLine ("Starting the foreach stmt loop");
>
> // if we find a photoshop:Headline node than put it's content in the description field.
> foreach (SemWeb.Statement stmt in xmpfile.Store) {
>
> Console.WriteLine ("stmt.Subject = >>{0}<<" ,stmt.Subject);
> Console.WriteLine ("stmt.Predicate = >>{0}<<", stmt.Predicate);
> Console.WriteLine ("stmp.Object = >>{0}<<", stmt.Object);
> Console.WriteLine ("stmp.Meta = >>{0}<<", stmt.Meta);
>
> string stmt_obj_str = stmt.Object.ToString();
>
> // Check for headline (if we are not processing keywords)
> if (!found_keywords)
> switch (stmt.Predicate.ToString()) {
> case "http://ns.adobe.com/photoshop/1.0/City" :
> city = fetch_object (stmt_obj_str);
> break;
> case "http://ns.adobe.com/photoshop/1.0/Country" :
> country = fetch_object (stmt_obj_str);
> break;
> case "http://ns.adobe.com/photoshop/1.0/Headline" :
> headline = fetch_object (stmt_obj_str);
> break;
> case "http://ns.adobe.com/photoshop/1.0/Caption" :
> caption = fetch_object (stmt_obj_str);
> break;
> case "http://ns.adobe.com/photoshop/1.0/Urgency" :
> urgency = fetch_object (stmt_obj_str);
> break;
> case "http://ns.iview-multimedia.com/mediapro/1.0/Location" :
> location = fetch_object (stmt_obj_str);
> break;
> default :
> break;
> }
>
> // Keywords are attached in objects between a header (http..) and an ending ("_")
> // Check if we have a start keywords object
> if (stmt_obj_str == "http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag") {
> found_keywords = true;
> continue;
> }
>
> // If we found end object for keywords
> if ( (found_keywords) && (stmt_obj_str == "_") ) {
> found_keywords = false;
> continue;
> }
>
> if (found_keywords) {
> // SemWeb puts quotes around the strings it returns,
> // so we need to remove them
> if (stmt_obj_str.StartsWith("\"") && stmt_obj_str.EndsWith("\"")) {
> stmt_obj_str = stmt_obj_str.Substring(1,stmt_obj_str.Length-2);
> }
> keyword_list.Add(stmt_obj_str);
> }
But can not seem to import these tags...
> Importing xmptags metadata from /home/bengt/pictures/slask6/IMG_5299.jpg.xmp
> Starting the foreach stmt loop
> stmt.Subject = >>uuid:0f410644-9396-11d9-bb8e-a67e6693b6e9<<
> stmt.Predicate = >>http://purl.org/dc/elements/1.1/format<<
> stmp.Object = >>"image/jpeg"<<
> stmp.Meta = >>_<<
> stmt.Subject = >>_<<
> stmt.Predicate = >>http://www.w3.org/1999/02/22-rdf-syntax-ns#type<<
> stmp.Object = >>http://www.w3.org/1999/02/22-rdf-syntax-ns#Alt<<
> stmp.Meta = >>_<<
> stmt.Subject = >>_<<
> stmt.Predicate = >>http://www.w3.org/1999/02/22-rdf-syntax-ns#_1<<
> stmp.Object = >>"After digging the furrows another ten yards with the tractor, Jim Moore hops off to hand-set more leeks and onions."@x-default<<
> stmp.Meta = >>_<<
> stmt.Subject = >>uuid:0f410644-9396-11d9-bb8e-a67e6693b6e9<<
> stmt.Predicate = >>http://purl.org/dc/elements/1.1/description<<
> stmp.Object = >>_<<
> stmp.Meta = >>_<<
> stmt.Subject = >>_<<
> stmt.Predicate = >>http://www.w3.org/1999/02/22-rdf-syntax-ns#type<<
> stmp.Object = >>http://www.w3.org/1999/02/22-rdf-syntax-ns#Alt<<
> stmp.Meta = >>_<<
> stmt.Subject = >>_<<
> stmt.Predicate = >>http://www.w3.org/1999/02/22-rdf-syntax-ns#_1<<
> stmp.Object = >>"01661gdx"@x-default<<
> stmp.Meta = >>_<<
> stmt.Subject = >>uuid:0f410644-9396-11d9-bb8e-a67e6693b6e9<<
> stmt.Predicate = >>http://purl.org/dc/elements/1.1/title<<
> stmp.Object = >>_<<
> stmp.Meta = >>_<<
> stmt.Subject = >>_<<
> stmt.Predicate = >>http://www.w3.org/1999/02/22-rdf-syntax-ns#type<<
> stmp.Object = >>http://www.w3.org/1999/02/22-rdf-syntax-ns#Alt<<
> stmp.Meta = >>_<<
> stmt.Subject = >>_<<
> stmt.Predicate = >>http://www.w3.org/1999/02/22-rdf-syntax-ns#_1<<
> stmp.Object = >>"\u00A92003 Big Newspaper, all rights reserved"@x-default<<
> stmp.Meta = >>_<<
> stmt.Subject = >>uuid:0f410644-9396-11d9-bb8e-a67e6693b6e9<<
> stmt.Predicate = >>http://purl.org/dc/elements/1.1/rights<<
> stmp.Object = >>_<<
> stmp.Meta = >>_<<
> stmt.Subject = >>_<<
> stmt.Predicate = >>http://www.w3.org/1999/02/22-rdf-syntax-ns#type<<
> stmp.Object = >>http://www.w3.org/1999/02/22-rdf-syntax-ns#Seq<<
> stmp.Meta = >>_<<
> stmt.Subject = >>_<<
> stmt.Predicate = >>http://www.w3.org/1999/02/22-rdf-syntax-ns#_1<<
> stmp.Object = >>"John Doe"<<
> stmp.Meta = >>_<<
> stmt.Subject = >>uuid:0f410644-9396-11d9-bb8e-a67e6693b6e9<<
> stmt.Predicate = >>http://purl.org/dc/elements/1.1/creator<<
> stmp.Object = >>_<<
> stmp.Meta = >>_<<
> stmt.Subject = >>_<<
> stmt.Predicate = >>http://www.w3.org/1999/02/22-rdf-syntax-ns#type<<
> stmp.Object = >>http://www.w3.org/1999/02/22-rdf-syntax-ns#Bag<<
> stmp.Meta = >>_<<
> stmt.Subject = >>_<<
> stmt.Predicate = >>http://www.w3.org/1999/02/22-rdf-syntax-ns#_1<<
> stmp.Object = >>"subject 1"<<
> stmp.Meta = >>_<<
> stmt.Subject = >>_<<
> stmt.Predicate = >>http://www.w3.org/1999/02/22-rdf-syntax-ns#_2<<
> stmp.Object = >>"subject 2"<<
> stmp.Meta = >>_<<
> stmt.Subject = >>_<<
> stmt.Predicate = >>http://www.w3.org/1999/02/22-rdf-syntax-ns#_3<<
> stmp.Object = >>"subject 3"<<
> stmp.Meta = >>_<<
> stmt.Subject = >>uuid:0f410644-9396-11d9-bb8e-a67e6693b6e9<<
> stmt.Predicate = >>http://purl.org/dc/elements/1.1/subject<<
> stmp.Object = >>_<<
> stmp.Meta = >>_<<
>
If you wonder, I am using this XMP sidecar file as my sample.
>
> <rdf:Description rdf:about='uuid:0f410644-9396-11d9-bb8e-a67e6693b6e9'
> xmlns:dc='http://purl.org/dc/elements/1.1/'>
> <dc:format>image/jpeg</dc:format>
> <dc:description>
> <rdf:Alt>
> <rdf:li xml:lang='x-default'>After digging the furrows another ten yards with the tractor, Jim Moore hops off to hand-set more leeks and onions.</rdf:li>
> </rdf:Alt>
> </dc:description>
> <dc:title>
> <rdf:Alt>
> <rdf:li xml:lang='x-default'>01661gdx</rdf:li>
> </rdf:Alt>
> </dc:title>
> <dc:rights>
> <rdf:Alt>
> <rdf:li xml:lang='x-default'>�2003 Big Newspaper, all rights reserved</rdf:li>
> </rdf:Alt>
> </dc:rights>
> <dc:creator>
> <rdf:Seq>
> <rdf:li>John Doe</rdf:li>
> </rdf:Seq>
> </dc:creator>
> <dc:subject>
> <rdf:Bag>
> <rdf:li>subject 1</rdf:li>
> <rdf:li>subject 2</rdf:li>
> <rdf:li>subject 3</rdf:li>
> </rdf:Bag>
> </dc:subject>
> </rdf:Description>
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]