Details

    • Type: Bug
    • Status: Closed - Won't Fix
    • Resolution: Won't Fix
    • Affects Version/s: BIGDATA_RELEASE_1_3_1
    • Fix Version/s: None
    • Component/s: SPARQL UPDATE
    • Labels:
      None

      Description

      I am trying to run the following update:

      base <http://localhost:8000/>
      prefix owl: <http://www.w3.org/2002/07/owl#>
      prefix s: </bdm/api/>
      prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
      prefix bds: <http://www.bigdata.com/rdf/search#>
      prefix xsd: <http://www.w3.org/2001/XMLSchema#>
      prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
      prefix skos: <http://www.w3.org/2004/02/skos/core#>
      prefix dc: <http://purl.org/dc/elements/1.1/>
      prefix syapse: </graph/syapse#>
      
          DELETE {
            GRAPH <http://localhost:8000/graph/vocabulary/syapse/unit_of_measure#> {
              ?subOld <http://localhost:8000/graph/syapse#prefOrAltLabel> ?superOld .
            }
          }
          INSERT {
            GRAPH <http://localhost:8000/graph/vocabulary/syapse/unit_of_measure#> {
              ?subNew <http://localhost:8000/graph/syapse#prefOrAltLabel> ?superNew .
            }
          }
          WHERE
          {
            { GRAPH <http://localhost:8000/graph/vocabulary/syapse/unit_of_measure#> {
                ?subOld <http://localhost:8000/graph/syapse#prefOrAltLabel> ?superOld .
              }
             } UNION {
               <http://localhost:8000/graph/syapse#prefOrAltLabel> rdfs:domain ?domain .
               GRAPH <http://localhost:8000/graph/vocabulary/syapse/unit_of_measure#> {
                ?subNew rdf:type ?domain .
               }
               ?subNew skos:prefLabel | skos:altLabel ?superNew
             }
          }
      

      It only does the delete part.
      To get the insert to work, my workaround is to split it into two, which can all be packaged into the same request.

      base <http://localhost:8000/>
      prefix owl: <http://www.w3.org/2002/07/owl#>
      prefix s: </bdm/api/>
      prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
      prefix bds: <http://www.bigdata.com/rdf/search#>
      prefix xsd: <http://www.w3.org/2001/XMLSchema#>
      prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
      prefix skos: <http://www.w3.org/2004/02/skos/core#>
      prefix dc: <http://purl.org/dc/elements/1.1/>
      prefix syapse: </graph/syapse#>
      
          DELETE {
            GRAPH <http://localhost:8000/graph/vocabulary/syapse/unit_of_measure#> {
              ?subOld <http://localhost:8000/graph/syapse#prefOrAltLabel> ?superOld .
            }
          }
      
          WHERE
          {
             GRAPH <http://localhost:8000/graph/vocabulary/syapse/unit_of_measure#> {
                ?subOld <http://localhost:8000/graph/syapse#prefOrAltLabel> ?superOld .
              }
          }
      
      ;
          INSERT {
            GRAPH <http://localhost:8000/graph/vocabulary/syapse/unit_of_measure#> {
              ?subNew <http://localhost:8000/graph/syapse#prefOrAltLabel> ?superNew .
            }
          }
          WHERE
          {
               <http://localhost:8000/graph/syapse#prefOrAltLabel> rdfs:domain ?domain .
               GRAPH <http://localhost:8000/graph/vocabulary/syapse/unit_of_measure#> {
                ?subNew rdf:type ?domain .
               }
               ?subNew skos:prefLabel | skos:altLabel ?superNew
          }
      
      

        Activity

        Hide
        bryanthompson bryanthompson added a comment -

        Jeremy,

        Can you turn this into a unit test and then assign the ticket to me?

        Thanks,
        Bryan

        Show
        bryanthompson bryanthompson added a comment - Jeremy, Can you turn this into a unit test and then assign the ticket to me? Thanks, Bryan
        Hide
        bryanthompson bryanthompson added a comment -

        Ping?

        Show
        bryanthompson bryanthompson added a comment - Ping?
        Hide
        beebs Brad Bebee added a comment -

        Jeremy Carroll Do you have a test case for this one?

        Show
        beebs Brad Bebee added a comment - Jeremy Carroll Do you have a test case for this one?
        Hide
        jjc Jeremy Carroll added a comment - - edited

        Create a new quad more store, add the single quad:
        <eg:a> <eg:a> <eg:a> <eg:a>

        The following update deletes a triple without adding one, correct behavior is to delete the triple and add it back:

            DELETE {
              GRAPH <eg:a> {
                ?S ?P ?O
              }
            }
            INSERT {
              GRAPH <eg:a> {
                ?o ?p ?s
              
              }
            }
            WHERE
            {
              { GRAPH <eg:a> {
                ?s <eg:a> ?o
              } }
              UNION
             { GRAPH <eg:a> {
                ?S ?P ?O
              } }
                    
            }
        

        I have tried a few simpler ones, and I think this is fairly close to minimal

        Show
        jjc Jeremy Carroll added a comment - - edited Create a new quad more store, add the single quad: <eg:a> <eg:a> <eg:a> <eg:a> The following update deletes a triple without adding one, correct behavior is to delete the triple and add it back: DELETE { GRAPH <eg:a> { ?S ?P ?O } } INSERT { GRAPH <eg:a> { ?o ?p ?s } } WHERE { { GRAPH <eg:a> { ?s <eg:a> ?o } } UNION { GRAPH <eg:a> { ?S ?P ?O } } } I have tried a few simpler ones, and I think this is fairly close to minimal
        Hide
        jjc Jeremy Carroll added a comment -

        In a more complex example, I now had the workaround of breaking it into two parts in a single atomic NSS operation failed to work

        Show
        jjc Jeremy Carroll added a comment - In a more complex example, I now had the workaround of breaking it into two parts in a single atomic NSS operation failed to work
        Hide
        jjc Jeremy Carroll added a comment - - edited

        This is the more complex example, which adds nothing despite the second update by itself working

        base <https://test.syapse.com/>
        prefix owl: <http://www.w3.org/2002/07/owl#>
        prefix s: </bdm/api/>
        prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
        prefix bds: <http://www.bigdata.com/rdf/search#>
        prefix xsd: <http://www.w3.org/2001/XMLSchema#>
        prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
        prefix skos: <http://www.w3.org/2004/02/skos/core#>
        prefix dc: <http://purl.org/dc/elements/1.1/>
        prefix syapse: </graph/syapse#>
        
        
            # Blazegraph DELETE-INSERT not working for this case, split into two separate updates
            # http://trac.bigdata.com/ticket/1012
            DELETE {
              GRAPH <https://test.syapse.com/graph/ontology/rep:rep> {
                ?subOld <https://test.syapse.com/graph/syapse#subClassOf> ?superOld .
              }
            }
            
        #USING </graph/ontology/rep:base>
        #USING </graph/syapse>
        #USING </graph/ontology/rep:rep>
        #USING </graph/ontology/rep:sys>
        #USING NAMED </graph/ontology/rep:base>
        #USING NAMED </graph/syapse>
        #USING NAMED </graph/ontology/rep:rep>
        #USING NAMED </graph/ontology/rep:sys>
            WHERE
            {
                GRAPH <https://test.syapse.com/graph/ontology/rep:rep> {
                  ?subOld <https://test.syapse.com/graph/syapse#subClassOf> ?superOld .
                }
            } ;
            
            INSERT {
              GRAPH <https://test.syapse.com/graph/ontology/rep:rep> {
                ?subNew <https://test.syapse.com/graph/syapse#subClassOf> ?superNew .
              }
            }
            
        #USING </graph/ontology/rep:base>
        #USING </graph/syapse>
        #USING </graph/ontology/rep:rep>
        #USING </graph/ontology/rep:sys>
        #USING NAMED </graph/ontology/rep:base>
        #USING NAMED </graph/syapse>
        #USING NAMED </graph/ontology/rep:rep>
        #USING NAMED </graph/ontology/rep:sys>
            WHERE
            {
                { 
                 GRAPH <https://test.syapse.com/graph/ontology/rep:rep> {
                     ?subNew rdf:type <http://www.w3.org/2002/07/owl#Class> .
                 }
                 ?subNew rdfs:subClassOf * ?superNew .
                 ?superNew rdf:type <http://www.w3.org/2002/07/owl#Class> .
                 hint:Prior hint:runLast true .
                
        } UNION {
        
                 GRAPH <https://test.syapse.com/graph/ontology/rep:rep> {
                     ?superNew rdf:type <http://www.w3.org/2002/07/owl#Class> .
                 }
                 ?subNew rdfs:subClassOf * ?superNew .
                 ?subNew rdf:type <http://www.w3.org/2002/07/owl#Class> .
                 hint:Prior hint:runLast true .
                 }
            } ;
        

        This works as above, but does not when the commented lines are included, despite them having no logical effect

        Show
        jjc Jeremy Carroll added a comment - - edited This is the more complex example, which adds nothing despite the second update by itself working base <https://test.syapse.com/> prefix owl: <http://www.w3.org/2002/07/owl#> prefix s: </bdm/api/> prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> prefix bds: <http://www.bigdata.com/rdf/search#> prefix xsd: <http://www.w3.org/2001/XMLSchema#> prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> prefix skos: <http://www.w3.org/2004/02/skos/core#> prefix dc: <http://purl.org/dc/elements/1.1/> prefix syapse: </graph/syapse#> # Blazegraph DELETE-INSERT not working for this case, split into two separate updates # http://trac.bigdata.com/ticket/1012 DELETE { GRAPH <https://test.syapse.com/graph/ontology/rep:rep> { ?subOld <https://test.syapse.com/graph/syapse#subClassOf> ?superOld . } } #USING </graph/ontology/rep:base> #USING </graph/syapse> #USING </graph/ontology/rep:rep> #USING </graph/ontology/rep:sys> #USING NAMED </graph/ontology/rep:base> #USING NAMED </graph/syapse> #USING NAMED </graph/ontology/rep:rep> #USING NAMED </graph/ontology/rep:sys> WHERE { GRAPH <https://test.syapse.com/graph/ontology/rep:rep> { ?subOld <https://test.syapse.com/graph/syapse#subClassOf> ?superOld . } } ; INSERT { GRAPH <https://test.syapse.com/graph/ontology/rep:rep> { ?subNew <https://test.syapse.com/graph/syapse#subClassOf> ?superNew . } } #USING </graph/ontology/rep:base> #USING </graph/syapse> #USING </graph/ontology/rep:rep> #USING </graph/ontology/rep:sys> #USING NAMED </graph/ontology/rep:base> #USING NAMED </graph/syapse> #USING NAMED </graph/ontology/rep:rep> #USING NAMED </graph/ontology/rep:sys> WHERE { { GRAPH <https://test.syapse.com/graph/ontology/rep:rep> { ?subNew rdf:type <http://www.w3.org/2002/07/owl#Class> . } ?subNew rdfs:subClassOf * ?superNew . ?superNew rdf:type <http://www.w3.org/2002/07/owl#Class> . hint:Prior hint:runLast true . } UNION { GRAPH <https://test.syapse.com/graph/ontology/rep:rep> { ?superNew rdf:type <http://www.w3.org/2002/07/owl#Class> . } ?subNew rdfs:subClassOf * ?superNew . ?subNew rdf:type <http://www.w3.org/2002/07/owl#Class> . hint:Prior hint:runLast true . } } ; This works as above, but does not when the commented lines are included, despite them having no logical effect
        Hide
        bryanthompson bryanthompson added a comment -

        I reworked the example above as part of trying to validate this ticket. The example appears to be invalid because ?p is not bound in the INSERT DATA clause.

        1. Create a new quads mode namespace.

        2. Insert a single statement:

        INSERT DATA { GRAPH <a> { <a> <a> <a> } }
        

        3. Verify one statement in the namespace

        SELECT * WHERE { GRAPH ?g { ?a ?b ?c } }
        

        4. Run the WHERE clause of the UPDATE request as a SELECT query:

        SELECT * WHERE {
               { GRAPH <a> { ?s <a> ?o } }
         UNION
               { GRAPH <a> { ?S ?P ?O } }
        }
        

        The results are below. Note that ?p is not bound by the WHERE clause.

        s	o	S	P	O
        <a>	<a>			
        		<a>	<a>	<a>
        

        5. Run the SPARQL UPDATE request. One statement is removed. No statements are added.

        DELETE { GRAPH <a> { ?S ?P ?O } }
        INSERT { GRAPH <a> { ?o ?p ?s } }
        WHERE {
               { GRAPH <a> { ?s <a> ?o } }
         UNION
               { GRAPH <a> { ?S ?P ?O } }
        }
        

        This is verified by re-running the SELECT * query:

        SELECT * WHERE { GRAPH ?g { ?a ?b ?c } }
        

        Based on this, I do not see the problem?

        Further, if I modified the SPARQL UPDATE request as follows (replacing ?p with <a>), the INSERT/DELETE modified 2 statements and the namespace contains the statement after the request is run:

        DELETE { GRAPH <a> { ?S ?P ?O } }
        INSERT { GRAPH <a> { ?o <a> ?s } }
        WHERE {
               { GRAPH <a> { ?s <a> ?o } }
         UNION
               { GRAPH <a> { ?S ?P ?O } }
        }
        

        Likewise, if I modify the SPARQL UPDATE request to bind ?p in the WHERE clause, then the INSERT/DELETE modified 2 statements and the namespace contains the statement after the request.

        DELETE { GRAPH <a> { ?S ?P ?O } }
        INSERT { GRAPH <a> { ?o ?p ?s } }
        WHERE {
               { GRAPH <a> { ?s ?p ?o } }
         UNION
               { GRAPH <a> { ?S ?P ?O } }
        }
        
        Show
        bryanthompson bryanthompson added a comment - I reworked the example above as part of trying to validate this ticket. The example appears to be invalid because ?p is not bound in the INSERT DATA clause. 1. Create a new quads mode namespace. 2. Insert a single statement: INSERT DATA { GRAPH <a> { <a> <a> <a> } } 3. Verify one statement in the namespace SELECT * WHERE { GRAPH ?g { ?a ?b ?c } } 4. Run the WHERE clause of the UPDATE request as a SELECT query: SELECT * WHERE { { GRAPH <a> { ?s <a> ?o } } UNION { GRAPH <a> { ?S ?P ?O } } } The results are below. Note that ?p is not bound by the WHERE clause. s o S P O <a> <a> <a> <a> <a> 5. Run the SPARQL UPDATE request. One statement is removed. No statements are added. DELETE { GRAPH <a> { ?S ?P ?O } } INSERT { GRAPH <a> { ?o ?p ?s } } WHERE { { GRAPH <a> { ?s <a> ?o } } UNION { GRAPH <a> { ?S ?P ?O } } } This is verified by re-running the SELECT * query: SELECT * WHERE { GRAPH ?g { ?a ?b ?c } } Based on this, I do not see the problem? Further, if I modified the SPARQL UPDATE request as follows (replacing ?p with <a>), the INSERT/DELETE modified 2 statements and the namespace contains the statement after the request is run: DELETE { GRAPH <a> { ?S ?P ?O } } INSERT { GRAPH <a> { ?o <a> ?s } } WHERE { { GRAPH <a> { ?s <a> ?o } } UNION { GRAPH <a> { ?S ?P ?O } } } Likewise, if I modify the SPARQL UPDATE request to bind ?p in the WHERE clause, then the INSERT/DELETE modified 2 statements and the namespace contains the statement after the request. DELETE { GRAPH <a> { ?S ?P ?O } } INSERT { GRAPH <a> { ?o ?p ?s } } WHERE { { GRAPH <a> { ?s ?p ?o } } UNION { GRAPH <a> { ?S ?P ?O } } }
        Hide
        bryanthompson bryanthompson added a comment -

        Assigned to brad to figure out how to close the ticket as "work's for me".

        Show
        bryanthompson bryanthompson added a comment - Assigned to brad to figure out how to close the ticket as "work's for me".
        Hide
        beebs Brad Bebee added a comment -

        Moved to the Closed-Won't Fix state. Unable to replicate locally per Bryan's comment.

        Show
        beebs Brad Bebee added a comment - Moved to the Closed-Won't Fix state. Unable to replicate locally per Bryan's comment.

          People

          • Assignee:
            beebs Brad Bebee
            Reporter:
            jeremycarroll jeremycarroll
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: