ImageProperties And RDF Example
The following example demonstrates how to use the se:imageproperties macro to enrich an image with metadata in HTML. The result contains a Resource Description Framework (RDF) XML snippet that is embedded in HTML. Photosites such as Flickr use this technique for image metadata enrichment.
Smartsite SXML | Copy Code |
---|---|
<se:imageproperties location="26202" includemetadata="true"> <se:parameters> <se:parameter name="format"> <se:rowformat> <img src="{this.field(location)}" alt="" width="{this.field(width)}" height="{this.field(height)}"/> <!-- <rdf:RDF xmlns="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <Work rdf:about=""> <se:format inputdata="{this.parent.field(metadata)}"> <se:rowformat expression="this.field(name)==Headline"> <dc:title>{this.field(value)}</dc:title> </se:rowformat> <se:rowformat expression="this.field(name)==CaptionAbstract"> <dc:description>{this.field(value)}</dc:description> </se:rowformat> <se:rowformat expression="this.field(name)==ModifyDate"> <dc:date>{this.field(value)}</dc:date> </se:rowformat> <se:rowformat expression="this.field(name)==CopyrightNotice"> <dc:creator>{this.field(value)}</dc:creator> </se:rowformat> <se:rowformat expression="this.field(name)==CopyrightNotice"> <dc:rights>{this.field(value)}</dc:rights> </se:rowformat> <se:rowformat expression="this.field(name)==Keyword"> <dc:subject>{this.field(value)}</dc:subject> </se:rowformat> </se:format> <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> <license rdf:resource="http://creativecommons.org/licenses/by/2.0/" /> </Work> <License rdf:about="http://creativecommons.org/licenses/by/2.0/"> <permits rdf:resource="http://web.resource.org/cc/Reproduction" /> <permits rdf:resource="http://web.resource.org/cc/Distribution" /> <requires rdf:resource="http://web.resource.org/cc/Notice" /> <requires rdf:resource="http://web.resource.org/cc/Attribution" /> <permits rdf:resource="http://web.resource.org/cc/DerivativeWorks" /> </License> </rdf:RDF> --> </se:rowformat> </se:parameter> </se:parameters> </se:imageproperties> |
Example Result | Copy Code |
---|---|
<img src="/test.net?id=26202" alt="" width="500" height="332" /> <!-- <rdf:RDF xmlns="http://web.resource.org/cc/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <Work rdf:about=""> <dc:date xmlns:dc="http://purl.org/dc/elements/1.1/">2006:12:30 11:16:15</dc:date> <dc:subject xmlns:dc="http://purl.org/dc/elements/1.1/">desert</dc:subject> <dc:subject xmlns:dc="http://purl.org/dc/elements/1.1/">escape</dc:subject> <dc:subject xmlns:dc="http://purl.org/dc/elements/1.1/">mountain</dc:subject> <dc:subject xmlns:dc="http://purl.org/dc/elements/1.1/">snow</dc:subject> <dc:title xmlns:dc="http://purl.org/dc/elements/1.1/">South of Mono Lake</dc:title> <dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">James Duncan Davidson</dc:creator> <dc:description xmlns:dc="http://purl.org/dc/elements/1.1/">My trusty Escape on a snow covered dirt road in the desert just a bit south of Mono Lake.</dc:description> <dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> <license rdf:resource="http://creativecommons.org/licenses/by/2.0/" /> </Work> <License rdf:about="http://creativecommons.org/licenses/by/2.0/"> <permits rdf:resource="http://web.resource.org/cc/Reproduction" /> <permits rdf:resource="http://web.resource.org/cc/Distribution" /> <requires rdf:resource="http://web.resource.org/cc/Notice" /> <requires rdf:resource="http://web.resource.org/cc/Attribution" /> <permits rdf:resource="http://web.resource.org/cc/DerivativeWorks" /> </License> </rdf:RDF> --> |