VirtSparqlCxmlImportPivot Collections (Part 5)Pivot Collections (Part 5) Contents Part 1: Introduction Part 2: SparqlCxml Part 3: SparqlCxml Deep Zoom Collections Part 4: PivotViewer Part 5: Importing CXML Importing CXML DB.DBA.CXML_TO_RDF_IMPORT_URL() Generated Subject URIs Generated Predicates Predicates for Collection and Item Attributes Predicates for Item Facets Converting Generated Predicates to Common Predicates Part 6: Facet Pivot Bridge Part 7: DETs : Persisting SPARQL Query Results to DAV Part 8: Frequently Asked Questions (FAQs) Part 9: Glossary Importing CXML As well as being able to generate CXML from RDF, Virtuoso provides the facility to do the reverse and generate RDF from imported CXML. The sparql_cxml VAD includes the procedure: DB.DBA.CXML_TO_RDF_IMPORT_URL (in url varchar) Parameters: url : the URL of the CXML file to import Usage examples: DB.DBA.CXML_TO_RDF_IMPORT_URL (''); DB.DBA.CXML_TO_RDF_IMPORT_URL (''); DB.DBA.CXML_TO_RDF_IMPORT_URL (''); DB.DBA.CXML_TO_RDF_IMPORT_URL (''); DB.DBA.CXML_TO_RDF_IMPORT_URL (''); The given CXML file is imported into a graph of the same name and can be queried like any other. e.g. DESCRIBE ?s FROM <> where { ?s ?p ?o } SELECT * FROM <> WHERE {?s ?p ?o . ?s virtcxml:FacetImage ?image . } define input:inference "virtrdf-label" DESCRIBE ?s from <> where { ?s ?p ?o } Deep Zoom images associated with the collection are also imported into the DZC_xxx tables used to serve DZIs when generating CXML (see VirtSparqlCxmlDzcs). Imported images are assigned to the virtcxml:FacetImage predicate. This can be used directly with the ?image reserved query variable in SELECT statements used for CXML generation. The second DESCRIBE example above exploits inferencing to use the imported images as images for a new dynamic collection. The virtrdf-label inference context includes an entry: virtcxml:FacetImage owl:equivalentProperty foaf:depiction Graph virtcxml: in turn includes an entry: foaf:depiction a virtcxml:FacetCategoryPattern ; virtcxml:FacetType "Item/@virt:Image" ; virtcxml:FacetDescription "A facet for absolute URI of depiction of a collection item" . with the result that imported images associated with virtcxml:FacetImage automatically have a virtcxml:FacetType of "Item/@virt:Image" and are seen by DESCRIBE as candidate images for the dynamic collection. Generated Subject URIs Each item in the collection receives its own subject URI. The subject URI takes the form: <{collection-URI}#{item-ID}>. e.g. Item #2565 in collection <Collection Name="Das Schweizer Parlament 2010 (aktualisiert am 6. Dez.2010)" SchemaVersion="1.0"> <FacetCategories> <FacetCategory Name="Funktion" Type="String" p:IsFilterVisible="true" p:IsMetaDataVisible="true" p:IsWordWheelVisible="true"/> . . . </FacetCategories> <Items ImgBase="p_deepzoom\p1.dzc"> <Item Id="2565" Name="Abate Fabio" Img="#0" Href=""> . . . is assigned subject URI <> Generated Predicates Predicates for Collection and Item Attributes Item attributes Href, Description etc are mapped to predicates named virtcxml:Facet{attribute-name}, where: prefix virtcxml: <> <tgroup><thead /><tbody> <row /> <row><entry> Item </entry><entry> Href </entry><entry> virtcxml:FacetHref </entry></row> <row><entry> Item </entry><entry> Description </entry><entry> virtcxml:FacetDescription </entry></row> <row><entry> Item </entry><entry> Image </entry><entry> virtcxml:FacetImage </entry></row> <row><entry> Item </entry><entry> Related </entry><entry> virtcxml:FacetRelated </entry></row> <row><entry> Collection </entry><entry> Copyright </entry><entry> virtcxml:FacetCopyright </entry></row> </tbody></tgroup></table> <para>Rather than just holding an image number, predicate virtcxml:FacetImage holds the full path of the corresponding Deep Zoom image, for example The image number in the .cxml file is dereferenced through the collection's .dzc file, identified by the Items/@ImgBase attribute, to obtain the DZI path.</para> <ulink url=""> <para> </para> <bridgehead class="">Predicates for Item Facets</bridgehead> <para>A predicate is generated for each facet category. The predicate URI takes the form virtcxml:Custom-{facet-category-name} e.g. A collection containing the following facet categories: </para> <programlisting><Collection Name="Das Schweizer Parlament 2010 (aktualisiert am 6. Dez.2010)" SchemaVersion="1.0"> <FacetCategories> <FacetCategory Name="Alter" Type="Number" p:IsFilterVisible="true" p:IsMetaDataVisible="true" p:IsWordWheelVisible="false"/> <FacetCategory Name="Amtsjahre" Type="Number" p:IsFilterVisible="true" p:IsMetaDataVisible="true" p:IsWordWheelVisible="false"/> <FacetCategory Name="Funktion" Type="String" p:IsFilterVisible="true" p:IsMetaDataVisible="true" p:IsWordWheelVisible="true"/> <FacetCategory Name="Geburtsdatum" Type="DateTime" Format="dd. MMM. yyyy" p:IsFilterVisible="true" p:IsMetaDataVisible="true" p:IsWordWheelVisible="false"/> <FacetCategory Name="Geschlecht" Type="String" p:IsFilterVisible="true" p:IsMetaDataVisible="true" p:IsWordWheelVisible="true"/> <FacetCategory Name="Kanton" Type="String" p:IsFilterVisible="true" p:IsMetaDataVisible="true" p:IsWordWheelVisible="true"/> <FacetCategory Name="Kinder" Type="Number" p:IsFilterVisible="true" p:IsMetaDataVisible="true" p:IsWordWheelVisible="false"/> <FacetCategory Name="Parlamentsmandate" Type="Number" p:IsFilterVisible="true" p:IsMetaDataVisible="true" p:IsWordWheelVisible="false"/> <FacetCategory Name="Partei" Type="String" p:IsFilterVisible="true" p:IsMetaDataVisible="true" p:IsWordWheelVisible="true"/> <FacetCategory Name="Vorname" Type="String" p:IsFilterVisible="true" p:IsMetaDataVisible="true" p:IsWordWheelVisible="true"/> </FacetCategories> ... </programlisting><para>when imported, generates the predicates: </para> <programlisting> </programlisting><para> <ulink url=""> </ulink></para> <bridgehead class="">Converting Generated Predicates to Common Predicates</bridgehead> <para>Following a CXML import, some of the generated predicates can be converted to more popular predicates using the Virtuoso/PL procedure DB.DBA.CXML_FACETS_TO_COMMON_PREDS. The affected predicates are detailed below: </para> <table><title /><tgroup><thead /><tbody> <row /> <row><entry> virtcxml:FacetName </entry><entry> rdfs:label </entry></row> <row><entry> virtcxml:FacetDescription </entry><entry> dc:description </entry></row> <row><entry> virtcxml:FacetHref </entry><entry> sioc:links_to </entry></row> <row><entry> virtcxml:FacetImage </entry><entry> foaf:depiction </entry></row> </tbody></tgroup></table> <bridgehead class="">Usage Example:</bridgehead> <programlisting>sparql clear graph <http://qq/1>; sparql insert in <http://qq/1> { ?s ?p ?o } from <> where {?s ?p ?o}; DB.DBA.CXML_FACETS_TO_COMMON_PREDS ('http://qq/1'); </programlisting></ulink></ulink></ulink></ulink></ulink></section></docbook>