@Test public void updatesVersionBasedOnPreviousVersion() throws Exception { final int prevVersion = 4; final int newVersion = 5; final String prevRevision = SUBJECT + "/" + prevVersion; final String newRevision = SUBJECT + "/" + newVersion; GraphQlToRdfPatch instance = new GraphQlToRdfPatch(SUBJECT, USER_URI, changeLog); when(quadStore.getQuads(SUBJECT, timPredicate("latestRevision"), Direction.OUT, "")) .thenAnswer(new Answer<Stream<CursorQuad>>() { @Override public Stream<CursorQuad> answer(InvocationOnMock invocation) { List<CursorQuad> quads = newArrayList(); quads.add( CursorQuad.create(SUBJECT, timPredicate("latestRevision"), Direction.OUT, prevRevision, STRING, null, "")); return quads.stream(); } }); when(quadStore.getQuads(prevRevision, timPredicate("version"), Direction.OUT, "")) .thenAnswer(new Answer<Stream<CursorQuad>>() { @Override public Stream<CursorQuad> answer(InvocationOnMock invocation) { List<CursorQuad> quads = newArrayList(); quads.add(CursorQuad .create(prevRevision, timPredicate("version"), Direction.OUT, String.valueOf(prevVersion), INTEGER, null, "")); return quads.stream(); } }); instance.sendQuads(serializer, s -> { }, dataSet); verify(serializer) .addDelQuad(true, newRevision, timPredicate("version"), String.valueOf(newVersion), RdfConstants.INTEGER, null, null); }
@Override public void sendQuads(RdfPatchSerializer saver, Consumer<String> importStatusConsumer, DataSet dataSet) throws LogStorageFailedException { addData(saver, dataSet); String newRevision = addNewRevision(saver, dataSet); String association = addProvenance(saver, dataSet, newRevision); addPlan(saver, dataSet, newRevision, association); }
GraphQlToRdfPatch implements PatchRdfCreator { @Override public void sendQuads(RdfPatchSerializer saver, Consumer<String> importStatusConsumer, DataSet dataSet) throws LogStorageFailedException { addData(saver, dataSet); String newRevision = addNewRevision(saver, dataSet); String association = addProvenance(saver, dataSet, newRevision); addPlan(saver, dataSet, newRevision, association); } }
GraphQlToRdfPatch implements PatchRdfCreator { @Override public void sendQuads(RdfPatchSerializer saver, Consumer<String> importStatusConsumer, DataSet dataSet) throws LogStorageFailedException { addData(saver, dataSet); String newRevision = addNewRevision(saver, dataSet); String association = addProvenance(saver, dataSet, newRevision); addPlan(saver, dataSet, newRevision, association); } @JsonCreator  GraphQlToRdfPatch(
    @JsonProperty("subjectUri") String subjectUri,
    @JsonProperty("userUri") String userUri,
    @JsonProperty("changeLog") ChangeLog changeLog
  ); }
GraphQlToRdfPatch implements PatchRdfCreator { @Override public void sendQuads(RdfPatchSerializer saver, Consumer<String> importStatusConsumer, DataSet dataSet) throws LogStorageFailedException { addData(saver, dataSet); String newRevision = addNewRevision(saver, dataSet); String association = addProvenance(saver, dataSet, newRevision); addPlan(saver, dataSet, newRevision, association); } @JsonCreator  GraphQlToRdfPatch(
    @JsonProperty("subjectUri") String subjectUri,
    @JsonProperty("userUri") String userUri,
    @JsonProperty("changeLog") ChangeLog changeLog
  ); @Override void sendQuads(RdfPatchSerializer saver, Consumer<String> importStatusConsumer, DataSet dataSet); }
GraphQlToRdfPatch implements PatchRdfCreator { @Override public void sendQuads(RdfPatchSerializer saver, Consumer<String> importStatusConsumer, DataSet dataSet) throws LogStorageFailedException { addData(saver, dataSet); String newRevision = addNewRevision(saver, dataSet); String association = addProvenance(saver, dataSet, newRevision); addPlan(saver, dataSet, newRevision, association); } @JsonCreator  GraphQlToRdfPatch(
    @JsonProperty("subjectUri") String subjectUri,
    @JsonProperty("userUri") String userUri,
    @JsonProperty("changeLog") ChangeLog changeLog
  ); @Override void sendQuads(RdfPatchSerializer saver, Consumer<String> importStatusConsumer, DataSet dataSet);  }