Skip to content

Commit

Permalink
GH-1618: RDF Patch
Browse files Browse the repository at this point in the history
  • Loading branch information
afs committed Nov 15, 2022
1 parent c5eaa72 commit bf5bc4c
Show file tree
Hide file tree
Showing 125 changed files with 13,192 additions and 36 deletions.
58 changes: 43 additions & 15 deletions jena-arq/Grammar/RDF-Thrift/BinaryRDF.thrift
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
// Encoding in Thrift of RDF terms and other items
// for Graph, Datasets, Result Set and Patches

// Versioning considerations?

namespace java org.apache.jena.riot.thrift.wire

// ==== RDF Term Definitions
Expand All @@ -42,7 +40,7 @@ struct RDF_BNode {
1: required string label
}

// Common abbreviations for datatypes and other URIs?
// Common abbreviated for datatypes and other URIs?
// union with additional values.

struct RDF_Literal {
Expand Down Expand Up @@ -77,7 +75,6 @@ union RDF_Term {
7: RDF_UNDEF undefined
8: RDF_REPEAT repeat
9: RDF_Triple tripleTerm # RDF-star

# Value forms of literals.
10: i64 valInteger
11: double valDouble
Expand Down Expand Up @@ -122,17 +119,48 @@ struct RDF_DataTuple {
1: list<RDF_Term> row
}

// // ==== RDF Patch
//
// # Includes
// # Prefix declaration
//
// enum RDF_Patch {
// ADD,
// ADD_NO_OP, // ADD recorded that had no effect
// DELETE,
// DELETE_NO_OP // DELETE recorded that had no effect
// }
// ==== RDF Patch

enum PatchTxn { TX, TC, TA , Segment }

struct Patch_Prefix_Add {
1: optional RDF_Term graphNode;
2: required string prefix;
3: required string iriStr;
}

struct Patch_Prefix_Del {
1: optional RDF_Term graphNode;
2: required string prefix;
}

struct Patch_Header {
1: required string name;
2: required RDF_Term value;
}

struct Patch_Data_Add {
1: required RDF_Term s;
2: required RDF_Term p;
3: required RDF_Term o;
4: optional RDF_Term g;
}

struct Patch_Data_Del {
1: required RDF_Term s;
2: required RDF_Term p;
3: required RDF_Term o;
4: optional RDF_Term g;
}

union RDF_Patch_Row {
1: Patch_Header header;
2: Patch_Data_Add dataAdd;
3: Patch_Data_Del dataDel;
4: Patch_Prefix_Add prefixAdd;
5: Patch_Prefix_Del prefixDel;
6: PatchTxn txn;
}

// Local Variables:
// tab-width: 2
Expand Down
8 changes: 8 additions & 0 deletions jena-arq/Grammar/RDF-Thrift/gen-thrift
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,11 @@ do
perl -i.bak -p -e 's/^\@SuppressWarnings.*$/\@SuppressWarnings("all")/' $f
rm -f $f.bak
done

## PatchTxn.java
F="$PKG/PatchTxn.java"
if [ -e "$F" ]
then
sed -e 's/public int getValue/@Override public int getValue/' < $F > F
mv F $F
fi
23 changes: 16 additions & 7 deletions jena-arq/src/main/java/org/apache/jena/riot/WebContent.java
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public class WebContent {
public static final ContentType ctResultsJSON = ContentType.create(contentTypeResultsJSON);

public static final String contentTypeJSON = "application/json";
public static final ContentType ctJSON = ContentType.create(contentTypeJSON);
public static final ContentType ctJSON = ContentType.create(contentTypeJSON);

// Unofficial
public static final String contentTypeResultsProtobuf = "application/sparql-results+protobuf" ;
Expand All @@ -134,25 +134,34 @@ public class WebContent {
public static final ContentType ctResultsThrift = ContentType.create(contentTypeResultsThrift) ;

public static final String contentTypeSPARQLQuery = "application/sparql-query";
public static final ContentType ctSPARQLQuery = ContentType.create(contentTypeSPARQLQuery);
public static final ContentType ctSPARQLQuery = ContentType.create(contentTypeSPARQLQuery);

public static final String contentTypeSPARQLUpdate = "application/sparql-update";
public static final ContentType ctSPARQLUpdate = ContentType.create(contentTypeSPARQLUpdate);
public static final ContentType ctSPARQLUpdate = ContentType.create(contentTypeSPARQLUpdate);

public static final String contentTypeHTMLForm = "application/x-www-form-urlencoded";
public static final ContentType ctHTMLForm = ContentType.create(contentTypeHTMLForm);
public static final ContentType ctHTMLForm = ContentType.create(contentTypeHTMLForm);

public static final String contentTypeHTML = "text/html";
public static final ContentType ctTextHTML = ContentType.create(contentTypeHTML);

public static final String contentTypeTextCSV = "text/csv";
public static final ContentType ctTextCSV = ContentType.create(contentTypeTextCSV);
public static final ContentType ctTextCSV = ContentType.create(contentTypeTextCSV);

public static final String contentTypeTextTSV = "text/tab-separated-values";
public static final ContentType ctTextTSV = ContentType.create(contentTypeTextTSV);
public static final ContentType ctTextTSV = ContentType.create(contentTypeTextTSV);

// Unofficial
public static final String contentTypeSSE = "text/sse";
public static final ContentType ctSSE = ContentType.create(contentTypeSSE);
public static final ContentType ctSSE = ContentType.create(contentTypeSSE);

// Unofficial
public static final String contentTypePatch = "application/rdf-patch";
public static final ContentType ctPatch = ContentType.create(contentTypePatch);

// Unofficial
public static final String contentTypePatchThrift = "application/rdf-patch+thrift";
public static final ContentType ctPatchThrift = ContentType.create(contentTypePatchThrift);

public static final String charsetUTF8 = "utf-8";
public static final String charsetASCII = "ascii";
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit bf5bc4c

Please sign in to comment.