Virtuoso Open-Source Edition

VOS.VirtTipsAndTricksGuideQuadStorageInternally

  • Topic
  • Discussion
  • VOS.VirtTipsAndTricksGuideQuadStorageInternally(1.1) -- DAVWikiAdmin? , 2017-06-13 05:36:47 Edit WebDAV System Administrator 2017-06-13 05:36:47

    How can I see which quad storages exist and in which quad storage a graph resides?

    Let's take for example a created RDF view from relational data in Virtuoso. The RDF output therefor should have two graphs which reside in a quad storage named for ex.:

    http://localhost:8890/rdfv_demo/quad_storage/default
    

    Also the RDF is accessible over the SPARQL endpoint with the following query:

    define input:storage <http://localhost:8890/rdfv_demo/quad_storage/default>
    SELECT * 
    WHERE 
      { 
        ?s ?p ?o 
      }
    

    Now one could ask is there a way to define internally (once) that the quad storage should be included in queries to the SPARQL endpoint? So that the user does not have to define the input:storage explicitly in each query, like this:

    http://localhost:8890/sparql?query=select * where { ?s ?p ?o }&default-graph-uri=NULL&named-graph-uri=NULL
    

    All metadata about all RDF storages are kept in "system" graph <http://www.openlinksw.com/schemas/virtrdf#> ( namespace prefix virtrdf: ). Subjects of type virtrdf:QuadStorage are RDF storages. There are three of them by default:

    SQL> SPARQL SELECT * FROM virtrdf: WHERE { ?s a virtrdf:QuadStorage };
    s
    VARCHAR
    _______________________________________________________________________________
    
    http://www.openlinksw.com/schemas/virtrdf#DefaultQuadStorage
    http://www.openlinksw.com/schemas/virtrdf#DefaultServiceStorage
    http://www.openlinksw.com/schemas/virtrdf#SyncToQuads
    
    3 Rows. -- 3 msec.
    
    1. virtrdf:DefaultQuadStorage is what's in use if no input:storage specified.
    2. virtrdf:DefaultServiceStorage will be used for SPARQL federation.
    3. virtrdf:SyncToQuads is to keep the list of Linked Data Views that are translated into RDB2RDF triggers.

    There are two ways of using the Linked Data View from above in SPARQL endpoint without define input:storage:

    1. Create Linked Data View right in virtrdf:DefaultQuadStorage or add the view in other storage and then copy it from there to virtrdf:DefaultQuadStorage.
      • In any of these two variants, use:

        SPARQL ALTER QUAD STORAGE virtrdf:DefaultQuadStorage . . .

    2. Use SYS_SPARQL_HOST table as described here and set SH_DEFINES so it contains your favorite define input:storage

    Related