Uploaded image for project: 'Apache Jena'
  1. Apache Jena
  2. JENA-1419

Documentation issue on the SPARQL datasets

    XMLWordPrintableJSON

Details

    • Documentation
    • Status: Closed
    • Critical
    • Resolution: Fixed
    • Jena 3.5.0
    • Jena 3.9.0
    • ARQ, Documentation
    • None
    • ArchLinux

    Description

      In section:
      http://jena.apache.org/tutorials/sparql_datasets.html#querying-a-specific-graph

      The output is empty. As if the graph couldn't be found.

      PREFIX : <[file:///home/jo/eclipse-workspace/sparql_tutorial_data/]>
       PREFIX dc: <[http://purl.org/dc/elements/1.1/]>
      
      SELECT *
       WHERE
       { GRAPH ?g
      
      { ?b dc:title ?title }
      
      }
      
      

      Gives:

      --------------------------------------------------------------------
      |b|title|g|
      
      ====================================================================
      |_:b0|"Harry Potter and the Chamber of Secrets"|<ds-ng-1.ttl>|
      |_:b1|"Harry Potter and the Philospher's Stone"|<ds-ng-1.ttl>|
      |_:b2|"Harry Potter and the Sorcerer's Stone"|<ds-ng-2.ttl>|
      |_:b3|"Harry Potter and the Chamber of Secrets"|<ds-ng-2.ttl>|
      
      --------------------------------------------------------------------
      
      
      PREFIX dc: <[http://purl.org/dc/elements/1.1/]>
       PREFIX : <.>
      
      SELECT ?title
       {
       GRAPH :ds-ng-2.ttl
      
      { ?b dc:title ?title }
      
      }
      
      

      Gives

      ---------
      |title|
      
      =========
       ---------
      
      

      Running with Jena 3.5.0, on Linux (Arch)

       $ arq --graph ds-dft.ttl --namedgraph ds-ng-1.ttl --namedgraph \
       ds-ng-2.ttl --query q-ds-3.rq
      
      

      There is also a problem with q-ds-4.rq:

       ----------------
      |date|title|
      
      ================
       ----------------
      
      

      And same with q-ds-5.rq.

      ---------------------------------------------------------------------------------------
      |s|p|o|g|
      
      =======================================================================================
      |:ds-ng-1.ttl|dc:date|"2005-07-14T03:18:56+01:00"^^xsd:dateTime| |
      |:ds-ng-2.ttl|dc:date|"2005-09-22T05:53:05+01:00"^^xsd:dateTime| |
      |_:b0|dc:title|"Harry Potter and the Chamber of Secrets"|<ds-ng-1.ttl>|
      |_:b1|dc:title|"Harry Potter and the Philospher's Stone"|<ds-ng-1.ttl>|
      |_:b2|dc:title|"Harry Potter and the Sorcerer's Stone"|<ds-ng-2.ttl>|
      |_:b3|dc:title|"Harry Potter and the Chamber of Secrets"|<ds-ng-2.ttl>|
      
      ---------------------------------------------------------------------------------------
      
      

      We see that g and s are not in the same format.

      Looking around, I found that:
      https://github.com/apache/jena/blob/master/jena-arq/etc/dataset.ttl

      And made a dataset such as:

       @prefix dc: <[http://purl.org/dc/elements/1.1/]> .
       @prefix rdfs: <[http://www.w3.org/2000/01/rdf-schema#|http://www.w3.org/2000/01/rdf-schema]> .
       @prefix rdf: <[http://www.w3.org/1999/02/22-rdf-syntax-ns#|http://www.w3.org/1999/02/22-rdf-syntax-ns]> .
       @prefix xsd: <[http://www.w3.org/2001/XMLSchema#|http://www.w3.org/2001/XMLSchema]> .
       @prefix ja: <[http://jena.hpl.hp.com/2005/11/Assembler#|http://jena.hpl.hp.com/2005/11/Assembler]> .
       @prefix : <#> .
      
      <> rdf:type ja:RDFDataset ;
       ja:defaultGraph
       [ rdf:type ja:MemoryModel] ;
       ja:namedGraph [ ja:graphName <[http://example/graph1]> ;
       ja:graph :data1 ] ;
       ja:namedGraph [ ja:graphName <[http://example/graph2]> ;
       ja:graph :data2 ] ;
       .
       :data1 rdf:type ja:MemoryModel ;
       ja:content [ja:externalContent <ds-ng-1.ttl> ;
       dc:date "2005-07-14T03:18:56+01:00"^^xsd:dateTime] ;
       .
      
      :data2 rdf:type ja:MemoryModel ;
       ja:content [ja:externalContent <ds-ng-2.ttl> ;
       dc:date "2005-09-22T05:53:05+01:00"^^xsd:dateTime] ;
       .
      
      

      Using that I was able to query them, but still not by date. There
      doesn't seem to be a default graph anymore.

      Attachments

        Activity

          People

            andy Andy Seaborne
            bjo Jonathan Bisson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: