plt-tud / r43ples

Revision Management for the Semantic Web
Other
19 stars 16 forks source link

Diff query #55

Open markusgraube opened 7 years ago

markusgraube commented 7 years ago

Provide template for diff queries between two revisions with

Should be possible with

CONSTRUCT {
  GRAPH <added> { ?s_a ?p_a ?o_a}
  GRAPH <deleted> { ?s_d ?p_d ?o_d}
  GRAPH <same> { ?s_s ?p_s ?o_s}
}
WHERE {
  GRAPH <dataset> REVISION "2" {
   ?s_d ?p_d ?o_d.
   ?s_s ?p_s ?o_s.
  }
  GRAPH <dataset> REVISION "5" {
   ?s_a ?p_a ?o_a. 
   ?s_s ?p_s ?o_s.
  }
 MINUS {
    GRAPH <dataset> REVISION "5" {
      ?s_d ?p_d ?o_d.
    }
  }
MINUS {
    GRAPH <dataset> REVISION "2" {
      ?s_a ?p_a ?o_a.
    }
  }
}

Create a API for this query dependant on graph, from and to:

http://localhost:9998/r43ples/diff?graph=<dataset>&from=<revision1>&to=<revision2>

Optionally the request can be specified to a specific resource with the additional query fragment resource:

http://localhost:9998/r43ples/diff?graph=<dataset>&from=<revision1>&to=<revision2>&resource=<resource>

The result should provide a TRIG serialisation of the changes:

<added> {
  // added triples
}
<deleted> {
  //deleted triples
}
<same> {
  //same triples
}
markusgraube commented 7 years ago

Okay, CREATE doesn't support Named Graphs.

Furthermore, the temp graph is overwritten by the same graph with another revision number. I have to fix this first

markusgraube commented 7 years ago

Same Triples:

CONSTRUCT {?s ?p ?o.}
WHERE {
  GRAPH <http://test.com/r43ples-dataset-1> REVISION "2" {
   ?s ?p ?o.
  }
  GRAPH <http://test.com/r43ples-dataset-1> REVISION "5" {
   ?s ?p ?o.
  }
}
markusgraube commented 7 years ago

added triples

CONSTRUCT {?s ?p ?o.}
WHERE {
GRAPH <http://test.com/r43ples-dataset-1> REVISION "5" {
   ?s ?p ?o.
  }
  MINUS {GRAPH <http://test.com/r43ples-dataset-1> REVISION "2" {
   ?s ?p ?o.
  }
}
}

deleted triples

CONSTRUCT {?s ?p ?o.}
WHERE {
  GRAPH <http://test.com/r43ples-dataset-1> REVISION "2" {
   ?s ?p ?o.
  }
MINUS {
GRAPH <http://test.com/r43ples-dataset-1> REVISION "5" {
   ?s ?p ?o.
  }
}
}