-
Notifications
You must be signed in to change notification settings - Fork 647
/
BinaryRDF.thrift
139 lines (114 loc) · 3.13 KB
/
BinaryRDF.thrift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// 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: