%META:TOPICPARENT{name="VirtSparqlCxmlFacetPivotBridgeHtml"}% ---+Pivot Collections (Part 5) ---++Contents Part 1: [[VirtSparqlCxmlHtml][Introduction]] Part 2: [[VirtSparqlCxmlHtml][SparqlCxml]] Part 3: [[VirtSparqlCxmlDzcsHtml][SparqlCxml Deep Zoom Collections]] Part 4: [[VirtSparqlCxmlHtmlPivotViewer][HtmlPivotViewer]] Part 5: Importing CXML * [[#AncImportingCxml][Importing CXML]] * [[#AncCxmlToRdfImport][DB.DBA.CXML_TO_RDF_IMPORT_URL()]] * [[#AncGeneratedSubjectUris][Generated Subject URIs]] * [[#AncGeneratedPredicates][Generated Predicates]] * [[#AncPredsForCollectionAndItemAttributes][Predicates for Collection and Item Attributes]] * [[#AncPredsForItemFacets][Predicates for Item Facets]] * [[#AncConvertToCommonPreds][Converting Generated Predicates to Common Predicates]] Part 6: [[VirtSparqlCxmlFacetPivotBridgeHtml][Facet Pivot Bridge]] Part 7: [[VirtSparqlCxmlDETsHtml][DETs : Persisting SPARQL Query Results to DAV]] Part 8: [[VirtSparqlCxmlFAQsHtml][Frequently Asked Questions (FAQs)]] Part 9: [[VirtSparqlCxmlGlossaryHtml][Glossary]] --- #AncImportingCxml ---++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: #AncCxmlToRdfImport ---+++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 ('http://content.getpivot.com/Collections/uspresidents/uspresidents.cxml'); * DB.DBA.CXML_TO_RDF_IMPORT_URL ('http://www.bluesware.ch/parlament/collection/Parlament.cxml'); * DB.DBA.CXML_TO_RDF_IMPORT_URL ('http://pivot.lobsterpot.com.au/Collections/WindowsPhone7Pivot.cxml'); * DB.DBA.CXML_TO_RDF_IMPORT_URL ('http://pivot.lobsterpot.com.au/collections/PASSChapters.cxml'); * DB.DBA.CXML_TO_RDF_IMPORT_URL ('http://www.wssdemo.com/livepivot/collections/sharepoint/sharepoint.cxml'); 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. #AncGeneratedSubjectUris ---+++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 http://www.bluesware.ch/parlament/collection/Parlament.cxml . . . . . . is assigned subject URI <http://www.bluesware.ch/parlament/collection/Parlament.cxml#2565> #AncGeneratedPredicates ---+++Generated Predicates #AncPredsForCollectionAndItemAttributes ---++++Predicates for Collection and Item Attributes Item attributes Href, Description etc are mapped to predicates named virtcxml:Facet{attribute-name}, where: prefix virtcxml: <http://www.openlinksw.com/schemas/virtcxml#> | *CXML Entity* | *Attribute* | *Mapped to predicate* | | Item | Href | virtcxml:FacetHref | | Item | Description | virtcxml:FacetDescription | | Item | Image | virtcxml:FacetImage | | Item | Related | virtcxml:FacetRelated | | Collection | Copyright | virtcxml:FacetCopyright | Rather than just holding an image number, predicate virtcxml:FacetImage holds the full path of the corresponding Deep Zoom image, for example http://www.bluesware.ch/parlament/collection/p_deepzoom/2023.dzi. 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. #AncPredsForItemFacets ---++++Predicates for Item Facets 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: ... when imported, generates the predicates: http://www.openlinksw.com/schemas/virtcxml#Custom-Alter http://www.openlinksw.com/schemas/virtcxml#Custom-Amtsjahre http://www.openlinksw.com/schemas/virtcxml#Custom-Funktion http://www.openlinksw.com/schemas/virtcxml#Custom-Geburtsdatum http://www.openlinksw.com/schemas/virtcxml#Custom-Geschlecht http://www.openlinksw.com/schemas/virtcxml#Custom-Kanton http://www.openlinksw.com/schemas/virtcxml#Custom-Kinder http://www.openlinksw.com/schemas/virtcxml#Custom-Parlamentsmandate http://www.openlinksw.com/schemas/virtcxml#Custom-Partei http://www.openlinksw.com/schemas/virtcxml#Custom-Vorname #AncConvertToCommonPreds ---++++Converting Generated Predicates to Common Predicates 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: | *Generated Predicate* | *Converted To* | | virtcxml:FacetName | rdfs:label | | virtcxml:FacetDescription | dc:description | | virtcxml:FacetHref | sioc:links_to | | virtcxml:FacetImage | foaf:depiction | ---+++++Usage Example: sparql clear graph ; sparql insert in { ?s ?p ?o } from where {?s ?p ?o}; DB.DBA.CXML_FACETS_TO_COMMON_PREDS ('http://qq/1');