Author: andy
Date: Sun Aug 31 10:03:19 2014
New Revision: 1621576
URL: http://svn.apache.org/r1621576
Log:
JENA-774 : Compile Thrift description to java code
Added:
jena/trunk/jena-arq/Grammar/BinaryRDF.thrift
jena/trunk/jena-arq/Grammar/gen-thrift (with props)
Added: jena/trunk/jena-arq/Grammar/BinaryRDF.thrift
URL:
http://svn.apache.org/viewvc/jena/trunk/jena-arq/Grammar/BinaryRDF.thrift?rev=1621576&view=auto
==============================================================================
--- jena/trunk/jena-arq/Grammar/BinaryRDF.thrift (added)
+++ jena/trunk/jena-arq/Grammar/BinaryRDF.thrift Sun Aug 31 10:03:19 2014
@@ -0,0 +1,121 @@
+// Encoding in Thrift iof 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
+
+struct RDF_IRI {
+1: required string iri
+}
+
+# A prefix name (abbrev for an IRI)
+struct RDF_PrefixName {
+1: required string prefix ;
+2: required string localName ;
+}
+
+struct RDF_BNode {
+ // Maybe support (or even insist) on a global unique identifier e.g. UUID
+ // long mostSig
+ // long leastSig
+1: required string label
+}
+
+// Common abbreviated for datatypes and other URIs?
+// union with additional values.
+
+struct RDF_Literal {
+1: required string lex ;
+2: optional string langtag ;
+3: optional string datatype ; // Either 3 or 4 but UNION is heavy.
+4: optional RDF_PrefixName dtPrefix ; // datatype as prefix name
+}
+
+struct RDF_Decimal {
+1: required i64 value ;
+2: required i32 scale ;
+}
+
+struct RDF_VAR {
+1: required string name ;
+}
+
+struct RDF_ANY { }
+
+struct RDF_UNDEF { }
+
+struct RDF_REPEAT { }
+
+union RDF_Term {
+1: RDF_IRI iri
+2: RDF_BNode bnode
+3: RDF_Literal literal # Full form lexical form/datattype/langtag
+4: RDF_PrefixName prefixName
+5: RDF_VAR variable
+6: RDF_ANY any
+7: RDF_UNDEF undefined
+8: RDF_REPEAT repeat
+# Value forms of literals.
+10: i64 valInteger
+11: double valDouble
+12: RDF_Decimal valDecimal
+}
+
+// === Stream RDF items
+
+struct RDF_Triple {
+1: required RDF_Term S
+2: required RDF_Term P
+3: required RDF_Term O
+}
+
+struct RDF_Quad {
+1: required RDF_Term S
+2: required RDF_Term P
+3: required RDF_Term O
+4: optional RDF_Term G
+}
+
+# Prefix declaration
+struct RDF_PrefixDecl {
+1: required string prefix ;
+2: required string uri ;
+}
+
+union RDF_StreamRow {
+# No base - no relative URI resolution.
+1: RDF_PrefixDecl prefixDecl
+2: RDF_Triple triple
+3: RDF_Quad quad
+}
+
+// ==== SPARQL Result Sets
+
+struct RDF_VarTuple {
+1: list<RDF_VAR> vars
+}
+
+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
+// }
+
+// Local Variables:
+// tab-width: 2
+// indent-tabs-mode: nil
+// comment-default-style: "//"
+// End:
Added: jena/trunk/jena-arq/Grammar/gen-thrift
URL:
http://svn.apache.org/viewvc/jena/trunk/jena-arq/Grammar/gen-thrift?rev=1621576&view=auto
==============================================================================
--- jena/trunk/jena-arq/Grammar/gen-thrift (added)
+++ jena/trunk/jena-arq/Grammar/gen-thrift Sun Aug 31 10:03:19 2014
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+if [ "$#" != 1 ]
+then
+ echo "Usage: $(basename $0) FILE" 2>&1
+ exit 1
+fi
+
+
+# Find the namespace
+PKG=../src/main/java/org/apache/jena/riot/thrift/wire
+rm -f "$PKG"/*.java
+
+thrift -r -out ../src/main/java -gen java "$@"
+
+for f in "$PKG"/*.java
+do
+ perl -i.bak -p -e 's/^public
(class|enum)/\@SuppressWarnings("all")\npublic $1/' $f
+ rm -f $f.bak
+done
Propchange: jena/trunk/jena-arq/Grammar/gen-thrift
------------------------------------------------------------------------------
svn:executable = *