• Topic
  • Discussion
  • VOS.VirtuosoRDFSinkFolder(Last) -- DAVWikiAdmin? , 2017-06-29 07:42:33 Edit WebDAV System Administrator 2017-06-29 02:42:33

    How to use Virtuoso's RDF Sink Folder

    What is the RDF Sink Folder?

    WebDAV supports a special folder type for RDF uploads, called rdf_sink. This folder can be used to uploads RDF files from any WebDAV client.

    When a new user is created, a new WebDAV folder with name rdf_sink is automatically created in the user's home directory.

    The rdf_sink folder has two special properties - virt:rdf_graph and virt:rdf_sponger. WebDAV property names are prefixed with virt:, and these are not shown as resource/collection properties in the ODS Briefcase; they can only be seen in the Conductor. The properties of other DET folders are prefixed in the same way.

    • The property virt:rdf_graph contains the name of the graph into which triples parsed from the uploaded files will be loaded.
    • The property virt:rdf_sponger holds the upload method.
      Setting Effect
      on The content of every file uploaded to that folder will be added to the RDF store using the Sponger method.
      off The content of only files with special MIME types will be added to RDF store.

    After the first upload into the folder, a new file is created with a name based on the RDF graph name. This file is dynamic, and contains all uploaded triples.

    Resources stored to the rdf_sink folder don't have any special properties.

    A user may see the properties of this folder through the Conductor UI, using the Properties button found to the right of the folder name. That page will include two WebDAV properties, for instance --

    • virt:rdf_graph : http://demo.openlinksw.com/DAV/home/demo/rdf_sink
    • virt:rdf_sponger : on

    Users may change these values as other WebDAV properties.

    Notes for Virtuoso upgraders

    When a Virtuoso DB is upgraded from a version which lacked the RDF Sink feature, to a version which includes it --

    1. A procedure is added to automatically create the rdf_sink folder in the home directory of existing users.
    2. The Add Users page of the Conductor is changed so that when any new user created with a WebDAV home directory, then the rdf_sink folder is created too.

    HTTP Content Negotiation

    How does it work?

    1. When a file is uploaded to the rdf_sink folder, it is parsed for RDF data, which is then stored in 2 graphs:
      • In the Public Graph specified as parameter for the rdf_sink folder, containing RDF data from all files stored there;
      • In a Private Graph, containing only RDF data from this file;
    2. A rewrite rule is added for the virtual path "/DAV" especially for the rdf_sink folder.
    3. When the file is dereferenced and the user agent specifies one of the following content types in its Accept: header, then the parsed content of the file is returned from the private graph in accepted type.
      • application/rdf+xml
      • application/foaf+xml
      • text/rdf+n3
      • text/rdf+ttl
      • application/rdf+n3
      • application/rdf+turtle
      • application/turtle
      • application/x-turtle

    Examples

    Example 1

    User demo uploads an RDF file to the rdf_sink folder at http://demo.openlinksw.com/ods:

    1. Go to demo user's Briefcase instance home page.
    2. Upload the RDF file (e.g., "TimBLcard.rdf") to the rdf_sink folder.
    3. After upload, "http___demo.openlinksw.com_DAV_home_demo_rdf_sink_.RDF" DET file is created.
    4. The RDF data will then be loaded into the graph name specified in the virt:rdf_graph property for the rdf_sink folder, i.e., http://demo.openlinksw.com/DAV/home/demo/rdf_sink.

    Example 2

    Suppose there is myfoaf.rdf file with the following content:


    <rdf:RDF xmlns="http://www.example/jose/foaf.rdf#"
        xmlns:foaf="http://xmlns.com/foaf/0.1/"
        xmlns:log="http://www.w3.org/2000/10/swap/log#"
        xmlns:myfoaf="http://www.example/jose/foaf.rdf#"
        xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
    
        <foaf:Person rdf:about="http://www.example/jose/foaf.rdf#jose">
            <foaf:homepage rdf:resource="http://www.example/jose/"/>
            <foaf:knows rdf:resource="http://www.example/jose/foaf.rdf#juan"/>
            <foaf:name>Jose Jimen~ez</foaf:name>
            <foaf:nick>Jo</foaf:nick>
            <foaf:workplaceHomepage rdf:resource="http://www.corp.example/"/>
        </foaf:Person>
    
        <foaf:Person rdf:about="http://www.example/jose/foaf.rdf#juan">
            <foaf:mbox rdf:resource="mailto:juan@mail.example"/>
        </foaf:Person>
    
        <foaf:Person rdf:about="http://www.example/jose/foaf.rdf#julia">
            <foaf:mbox rdf:resource="mailto:julia@mail.example"/>
        </foaf:Person>
    
        <rdf:Description rdf:about="http://www.example/jose/foaf.rdf#kendall">
            <foaf:knows rdf:resource="http://www.example/jose/foaf.rdf#edd"/>
        </rdf:Description>
    </rdf:RDF>
    

    Now let's upload the myfoaf.rdf file to destination server demo.openlinksw.com, for user demo:


    File: myfoaf.rdf
    Destination Server: demo.openlinksw.com
    
    curl -T myfoaf.rdf http://demo.openlinksw.com/DAV/home/demo/rdf_sink/myfoaf.rdf -u demo:demo
    <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
    <HTML>
    <HEAD>
      <TITLE>201 Created</TITLE>
    </HEAD>
    <BODY>
      <H1>Created</H1>
      Resource /DAV/home/demo/rdf_sink/ myfoaf.rdf has been created.
    </BODY>
    </HTML>
    

    See Also

    CategoryVirtuoso CategoryDAV CategorySpec