-
Notifications
You must be signed in to change notification settings - Fork 0
/
javap.ttl
384 lines (356 loc) · 8.53 KB
/
javap.ttl
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
# stardog data add --named-graph "<http://jbalint/javap>" jora javap.ttl
# stardog data remove --named-graph "<http://jbalint/javap>" jora && stardog data add --named-graph "<http://jbalint/javap>" jora javap.ttl
# baseURI: http://jbalint/javap#
# TODO:
# - some way to represent inner classes
# - lambdas
# - higher level representation of idioms
@prefix javap: <http://jbalint/javap#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
<http://jbalint/javap>
rdf:type owl:Ontology ;
.
#### types
javap:boolean
a javap:PrimitiveType ;
javap:descriptorCode "Z"^^xsd:string ;
.
javap:byte
a javap:PrimitiveType ;
javap:descriptorCode "B"^^xsd:string ;
.
javap:char
a javap:PrimitiveType ;
javap:descriptorCode "C"^^xsd:string ;
.
javap:double
a javap:PrimitiveType ;
javap:descriptorCode "D"^^xsd:string ;
.
javap:float
a javap:PrimitiveType ;
javap:descriptorCode "F"^^xsd:string ;
.
javap:int
a javap:PrimitiveType ;
javap:descriptorCode "I"^^xsd:string ;
.
javap:intArray
a javap:PrimitiveType ;
javap:descriptorCode "[I"^^xsd:string ;
.
javap:intArrayArray
a javap:PrimitiveType ;
javap:descriptorCode "[[I"^^xsd:string ;
.
javap:long
a javap:PrimitiveType ;
javap:descriptorCode "J"^^xsd:string ;
.
javap:short
a javap:PrimitiveType ;
javap:descriptorCode "S"^^xsd:string ;
.
javap:void
a javap:PrimitiveType ;
javap:descriptorCode "V"^^xsd:string ;
.
#### modifiers
javap:abstractMethod
a javap:Modifier ;
.
javap:final
a javap:Modifier ;
.
javap:interface
rdf:type javap:Modifier ;
.
javap:static
a javap:Modifier ;
.
javap:transient
a javap:Modifier ;
.
javap:packagePrivate
a javap:Visibility ;
.
javap:private
a javap:Visibility ;
.
javap:protected
a javap:Visibility ;
.
javap:public
a javap:Visibility ;
.
#### Classes
javap:Argument
a owl:Class ;
rdfs:comment "Argument to a method." ;
.
javap:ArrayType
a owl:Class ;
rdfs:subClassOf javap:Class ;
.
javap:CheckedException
a owl:Class ;
rdfs:subClassOf javap:Exception ;
.
javap:Class
a owl:Class ;
rdfs:subClassOf javap:Type ;
.
javap:Deprecated
a owl:Class ;
.
javap:Exception
rdf:type owl:Class ;
rdfs:subClassOf javap:Class ;
.
javap:Interface
a owl:Class ;
rdfs:subClassOf javap:Class ;
.
javap:Method
a owl:Class ;
.
javap:Modifier
a owl:Class ;
.
javap:Package
a owl:Class ;
.
javap:PrimitiveType
a owl:Class ;
rdfs:comment "Type signatures available at: https://docs.oracle.com/javase/8/docs/technotes/guides/jni/spec/types.html#type_signatures"^^xsd:string ;
rdfs:subClassOf javap:Type ;
.
javap:Type
a owl:Class ;
.
javap:UncheckedException
a owl:Class ;
.
javap:Variable
a owl:Class ;
.
javap:Visibility
a owl:Class ;
.
#### General Properties
javap:hasMember
rdf:type owl:ObjectProperty ;
# rdfs:domain [
# rdf:type owl:Class ;
# owl:unionOf (
# javap:Method
# javap:Class
# ) ;
# ] ;
.
javap:memberOf
a owl:ObjectProperty ;
owl:inverseOf javap:hasMember ;
.
javap:refersTo
a owl:ObjectProperty ;
owl:inverseOf javap:referredToBy ;
.
javap:referredToBy
a owl:ObjectProperty ;
owl:inverseOf javap:refersTo ;
.
#### Methods (and Arguments) Properties
javap:argument
rdf:type owl:ObjectProperty ;
rdfs:domain javap:Method ;
rdfs:range javap:Argument ;
.
javap:arity
rdf:type owl:DatatypeProperty , owl:FunctionalProperty ;
rdfs:domain javap:Method ;
rdfs:range xsd:integer ;
rdfs:comment "The arity (number of arguments) of a method" ;
.
javap:calledBy
a owl:ObjectProperty ;
owl:inverseOf javap:calls ;
owl:subPropertyOf javap:referredToBy ;
.
javap:calls
rdf:type owl:ObjectProperty ;
rdfs:domain javap:Method ;
rdfs:range javap:Method ;
rdfs:comment "The `calls' property indicates that a method calls another method." ;
rdfs:subPropertyOf javap:refersTo ;
.
javap:descriptor
rdf:type owl:DatatypeProperty ;
rdfs:domain javap:Method ;
rdfs:range xsd:string ;
.
javap:position
rdf:type owl:DatatypeProperty ;
rdfs:domain javap:Argument ;
rdfs:range xsd:int ;
rdfs:comment "Position of an argument in a method's argument list" ;
.
javap:returns
a owl:ObjectProperty, owl:FunctionalProperty ;
rdfs:subPropertyOf javap:refersTo ;
rdfs:domain javap:Method ;
rdfs:range javap:Type
.
javap:thrownBy
a owl:ObjectProperty ;
rdfs:subPropertyOf javap:referredToBy ;
rdfs:range javap:Method ;
rdfs:domain javap:Exception ;
owl:inverseOf javap:throws ;
.
javap:throws
a owl:ObjectProperty ;
rdfs:domain javap:Method ;
rdfs:range javap:Exception ;
rdfs:subPropertyOf javap:refersTo ;
owl:inverseOf javap:thrownBy
.
#### Package Properties
javap:dependsUpon
a owl:ObjectProperty ;
owl:inverseOf javap:usedBy ;
rdfs:domain javap:Package ;
rdfs:range javap:Package ;
rdfs:command "The `dependsUpon' property indicates that some classes in a package directly refer to some classes in another package." ;
## TODO : owl:propertyChainAxiom ()
.
javap:usedBy
a owl:ObjectProperty ;
owl:inverseOf javap:dependsUpon ;
rdfs:domain javap:Package ;
rdfs:range javap:Package ;
rdfs:command "The `usedBy' property indicates that some classes in a package directly are referred to by some classes in another package." ;
.
#### Type Properties
javap:arrayOf
rdf:type owl:ObjectProperty , owl:FunctionalProperty ;
rdfs:domain javap:ArrayType ;
rdfs:range javap:Type ;
rdfs:comment "The type of elements in the array" ;
.
javap:descriptorCode
rdf:type owl:DatatypeProperty ;
rdfs:domain javap:Type ;
rdfs:range xsd:string ;
.
javap:dimensions
rdfs:type owl:DatatypeProperty ;
rdfs:domain javap:ArrayType ;
rdfs:range xsd:integer ;
rdfs:comment "The number of dimensions of an array" ;
.
#### Class Properties
javap:sourceFile
rdf:type owl:DatatypeProperty ;
rdfs:domain javap:Class ;
rdfs:range xsd:string ;
rdfs:comment "The source filename that this class was compiled from" ;
.
javap:implements
rdf:type owl:ObjectProperty ;
rdfs:domain javap:Class ;
rdfs:range javap:Interface ;
.
javap:subClassOf
a owl:TransitiveProperty ;
rdfs:domain javap:Class ;
rdfs:range javap:Class ;
owl:inverseOf javap:hasSubClass ;
rdfs:subPropertyOf javap:refersTo ;
.
javap:hasSubClass
a owl:TransitiveProperty ;
rdfs:domain javap:Class ;
rdfs:range javap:Class ;
owl:inverseOf javap:subClassOf ;
rdfs:subPropertyOf javap:referredToBy ;
.
######################
javap:initialValue
rdf:type rdf:Property ;
rdfs:domain javap:Variable ;
.
javap:modifier
rdf:type owl:DatatypeProperty ;
# rdfs:domain [
# rdf:type owl:Class ;
# owl:unionOf (
# javap:Method
# javap:Variable
# javap:Class
# ) ;
# ] ;
rdfs:range javap:Modifier ;
.
javap:name
rdf:type owl:DatatypeProperty ;
# rdfs:domain [
# rdf:type owl:Class ;
# owl:unionOf (
# javap:Class
# javap:Method
# javap:Package
# javap:Variable
# ) ;
# ] ;
rdfs:range xsd:string ;
.
javap:hasType
rdf:type owl:ObjectProperty ;
# rdfs:domain [
# rdf:type owl:Class ;
# owl:unionOf (
# javap:Method
# javap:Variable
# ) ;
# ] ;
rdfs:range javap:Type ;
.
javap:typeParameters
rdf:type owl:ObjectProperty ;
.
# How do classes refer to other classes?
# 1. Member variable type (class or instance member)
# 2. Method local variable type
# 3. Method argument type
# 4. Method call on type
# 5. Method declares it may throw a type
#####################
# inheritance rules #
#####################
# https://localhost/mediawiki/index.php/JCFL#Inheritance_Rules
# INHERIT 1: Propagate members to subclasses
javap:hasMember
owl:propertyChainAxiom (javap:subClassOf javap:hasMember) ;
.
# INHERIT 2: Propagate "implements" relationships
javap:implements
owl:propertyChainAxiom (javap:subClassOf javap:implements) ;
.
#########################################
# lifting from granular to coarse types #
#########################################
# javap:refersTo
# owl:propertyChainAxiom (javap:refersTo javap:memberOf)
# .
# # COMPOSITION 1: Propagate domain of refersTo from granular members to coarse members
# javap:refersTo
# owl:propertyChainAxiom (javap:hasMember javap:refersTo) ;
# .
# # COMPOSITION 2: Propagate range of refersTo from granular members to coarse members
# javap:refersTo
# owl:propertyChainAxiom (javap:refersTo javap:memberOf) ;
# .