Example #1
0
        public void Select(SemWeb.StatementSink sink)
        {
            byte []        data   = null;
            ImageDirectory props  = Root.ReadDirectory(Tag.ImageProps);
            ImageDirectory camera = props.ReadDirectory(Tag.CameraObject);

            data = props.ReadEntry(Tag.TimeStamp);
            if (data != null)
            {
                MetadataStore.AddLiteral(sink, "xmp:CreateDate", new CaptureTime(data, little).ToString());
            }

            data = props.ReadEntry(Tag.ImageSpec);
            if (data != null)
            {
                ImageSpec spec = new ImageSpec(data, little);
                MetadataStore.AddLiteral(sink, "tiff:Orientation", ((int)spec.Orientation).ToString());
                MetadataStore.AddLiteral(sink, "tiff:ImageWidth", spec.ImageWidth.ToString());
                MetadataStore.AddLiteral(sink, "tiff:ImageLength", spec.ImageHeight.ToString());
                string comp = spec.ComponentBitDepth.ToString();

                if (spec.IsColor)
                {
                    MetadataStore.Add(sink, "tiff:BitsPerSample", "rdf:Seq", new string [] { comp, comp, comp });
                }
                else
                {
                    MetadataStore.Add(sink, "tiff:BitsPerSample", "rdf:Seq", new string [] { comp });
                }

                if (!spec.HasSquarePixels)
                {
                    MetadataStore.AddLiteral(sink, "tiff:XResolution",
                                             (1000000 * spec.PixelAspectRatio).ToString());
                    MetadataStore.AddLiteral(sink, "tiff:YResolution",
                                             (1000000 * (1 / spec.PixelAspectRatio)).ToString());
                }
            }

            data = camera.ReadEntry(Tag.CanonRawMakeModel);
            if (data != null)
            {
                string    make_model = System.Text.Encoding.ASCII.GetString(data, 0, data.Length - 1);
                string [] vals       = make_model.Split(new char [] { '\0' });
                MetadataStore.AddLiteral(sink, "tiff:Make", vals [0]);
                MetadataStore.AddLiteral(sink, "tiff:Model", vals [1]);
            }

            /*
             * // FIXME this doesn't appear to be ascii.
             * data = camera.ReadEntry (Tag.OwnerName);
             * if (data != null) {
             *      string name = System.Text.Encoding.ASCII.GetString (data, 0, data.Length - 1);
             *      MetadataStore.AddLiteral (sink, "dc:creator", "rdf:Seq", new SemWeb.Literal (name));
             * }
             */
        }
 public void Select(StatementSink sink)
 {
     using (Stream stream = Open()) {
         Header header = new Header(stream);
         MetadataStore.AddLiteral(sink, "tiff:ImageWidth", header.Width.ToString());
         MetadataStore.AddLiteral(sink, "tiff:ImageLength", header.Height.ToString());
         string bits = header.IsDeep ? "16" : "8";
         MetadataStore.Add(sink, "tiff:BitsPerSample", "rdf:Seq", new string [] { bits, bits, bits });
     }
 }
        public void Select(SemWeb.StatementSink sink)
        {
            Entity keywords = null;

            foreach (DataSet data in sets)
            {
                switch (data.ID)
                {
                case DataSetID.CopyrightNotice:
                    MetadataStore.AddLiteral(sink, "dc:rights", "rdf:Alt", new Literal(data.XmpObject, "x-default", null));
                    break;

                case DataSetID.ByLine:
                    MetadataStore.AddLiteral(sink, "dc:creator", "rdf:Seq", new Literal(data.XmpObject, "x-default", null));
                    break;

                case DataSetID.CaptionAbstract:
                    MetadataStore.AddLiteral(sink, "dc:description", "rdf:Alt", new Literal(data.XmpObject, "x-default", null));
                    break;

                case DataSetID.ObjectName:
                    MetadataStore.AddLiteral(sink, "dc:title", "rdf:Alt", new Literal(data.XmpObject, "x-default", null));
                    break;

                case DataSetID.Keywords:
                    if (keywords == null)
                    {
                        keywords = new BNode();
                        sink.Add(new Statement(MetadataStore.FSpotXMPBase,
                                               MetadataStore.Namespaces.Resolve("dc:subject"),
                                               keywords));
                        sink.Add(new Statement(keywords,
                                               (Entity)MetadataStore.Namespaces.Resolve("rdf:type"),
                                               (Entity)MetadataStore.Namespaces.Resolve("rdf:Bag")));
                    }
                    sink.Add(new Statement(keywords,
                                           MetadataStore.Namespaces.Resolve("rdf:li"),
                                           new Literal(data.XmpObject, "x-default", null)));
                    break;

                default:
                    if (data.XmpPredicate != null)
                    {
                        sink.Add(new Statement(MetadataStore.FSpotXMPBase,
                                               (Entity)data.XmpPredicate,
                                               new Literal(data.XmpObject)));
                    }
                    break;
                }
            }
        }
 public void Select(StatementSink sink)
 {
     MetadataStore.AddLiteral(sink, "tiff:Orientation", ((int)Info.Orientation).ToString());
     MetadataStore.AddLiteral(sink, "tiff:ImageWidth", Info.Width.ToString());
     MetadataStore.AddLiteral(sink, "tiff:ImageLength", Info.Height.ToString());
 }