ontomde-uml2-kb 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +13 -0
- data/Manifest.txt +14 -0
- data/README.txt +73 -0
- data/Rakefile +21 -0
- data/bin/ontomde-umlToProtege +4 -0
- data/lib/ontomde-uml2-kb/MYMODEL_kb.pprj +1502 -0
- data/lib/ontomde-uml2-kb/MYMODEL_kb.rdf +2 -0
- data/lib/ontomde-uml2-kb/MYMODEL_kb.rdfs +337 -0
- data/lib/ontomde-uml2-kb/command.rb +105 -0
- data/lib/ontomde-uml2-kb/datatypeMapping.rb +6 -0
- data/lib/ontomde-uml2-kb/protege.rb +499 -0
- data/lib/ontomde-uml2-kb/version.rb +7 -0
- data/lib/ontomde-uml2-kb.rb +10 -0
- data/test/test_ontomde-uml2-kb.rb +0 -0
- metadata +86 -0
@@ -0,0 +1,499 @@
|
|
1
|
+
#UML2 to protege 2000 translator
|
2
|
+
#xMDA-2006-2007 - Stephane (Pierre) Carrié
|
3
|
+
#
|
4
|
+
require 'set'
|
5
|
+
class Object
|
6
|
+
#URI of RDF version 2000
|
7
|
+
NS_RDF_2000="http://www.w3.org/2000/01/"
|
8
|
+
|
9
|
+
#URI of RDF version 1999
|
10
|
+
NS_RDF_1999="http://www.w3.org/1999/02/"
|
11
|
+
|
12
|
+
#URI of RDF type property
|
13
|
+
RDF_TYPE_URI="#{NS_RDF_1999}22-rdf-syntax-ns#type"
|
14
|
+
|
15
|
+
#URI of RDFS label property
|
16
|
+
RDF_LABEL_URI="#{NS_RDF_2000}rdf-schema#label"
|
17
|
+
|
18
|
+
#URI of RDFS sub class of property
|
19
|
+
RDF_SUBCLASSOF_URI="#{NS_RDF_2000}rdf-schema#subClassOf"
|
20
|
+
|
21
|
+
#URI prefix of protege knowledge base
|
22
|
+
NS_UML_CLASS="http://protege.stanford.edu/kb"
|
23
|
+
|
24
|
+
#Name of the protege slot containing the name of an instance
|
25
|
+
#Name change should be propagated to bootstrap protege model
|
26
|
+
PROTEGE_INSTANCE_ALIAS_URI_SUFFIX="UML_INSTANCE_ALIAS"
|
27
|
+
|
28
|
+
#Name of the protege slot containing the name of a use case sub-instance.
|
29
|
+
#(
|
30
|
+
PROTEGE_USE_CASE_ENV_URI_SUFFIX="UML_DATA_SET_NAME"
|
31
|
+
|
32
|
+
end
|
33
|
+
|
34
|
+
class String
|
35
|
+
#insert space between camelcase
|
36
|
+
#Example:
|
37
|
+
# unCamelCase("abcDef") returns "abc Def"
|
38
|
+
def unCamelCase
|
39
|
+
return gsub(/([a-z])([A-Z])/,'\1 \2')
|
40
|
+
end
|
41
|
+
|
42
|
+
#returns string after
|
43
|
+
def nt_escape
|
44
|
+
#TODO: gestion generique de l'unicode
|
45
|
+
return self.to_s.
|
46
|
+
gsub(/\\n/,'<br>').
|
47
|
+
gsub(/\\u0085/,''). # next line ???
|
48
|
+
gsub(/\\u00EE/,'i'). # i acute
|
49
|
+
gsub(/\\u00F4/,'o'). # o circ
|
50
|
+
gsub(/\\u00E7/,'c'). # c cedil
|
51
|
+
gsub(/\\u00E0/,'a'). # a grav
|
52
|
+
gsub(/\\u00E8/,'e'). # e grav
|
53
|
+
gsub(/\\u00E9/,'e'). # e acute
|
54
|
+
gsub(/\\u00C9/,'E'). # E acute
|
55
|
+
gsub(/\\u00EA/,'e'). # e circ
|
56
|
+
tr("^\#*a-zA-Z0-9 ,.!?:_\'\/<>-",'_').
|
57
|
+
gsub(/<br>/,'\\n')
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
module Mrdf_Resource
|
62
|
+
|
63
|
+
attr :kb_exported
|
64
|
+
|
65
|
+
def prot_safe(str)
|
66
|
+
return str.to_s.nt_escape.tr('^a-zA-Z0-9_','_')
|
67
|
+
end
|
68
|
+
|
69
|
+
#protege 2000 uri used for a resource
|
70
|
+
#(redefined for sub-classes)
|
71
|
+
def prot_uri
|
72
|
+
UriNamespace.instance.unalias(rdf_uri)
|
73
|
+
end
|
74
|
+
|
75
|
+
#label used in protege 2000
|
76
|
+
def prot_label
|
77
|
+
return "#{NS_UML_CLASS}##{prot_safe(uri)}"
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
module Muml_Element
|
82
|
+
#writes uml comment as and rdf comment
|
83
|
+
def append_comment
|
84
|
+
c=""
|
85
|
+
uml_ownedComment.each { |comment|
|
86
|
+
if comment.uml_body_one
|
87
|
+
c=c+comment.uml_body_one
|
88
|
+
end
|
89
|
+
}
|
90
|
+
write("<#{self.prot_uri}> <#{NS_RDF_2000}rdf-schema#comment> \"#{c.nt_escape}\".\n") if c!=""
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
|
95
|
+
module Muml_Classifier
|
96
|
+
ProtegeURI=Hash.new
|
97
|
+
|
98
|
+
#label used in protege 2000
|
99
|
+
def prot_label
|
100
|
+
return "#{prot_uri_local}"
|
101
|
+
end
|
102
|
+
|
103
|
+
def prot_uri_local
|
104
|
+
b="#{prot_safe(uml_name)}"
|
105
|
+
s=b
|
106
|
+
i=1
|
107
|
+
while true
|
108
|
+
if ProtegeURI[s].nil?
|
109
|
+
ProtegeURI[s]=self
|
110
|
+
return s
|
111
|
+
end
|
112
|
+
return s if ProtegeURI[s]==self
|
113
|
+
i=i+1
|
114
|
+
s=b+"_"+i.to_s
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
module Muml_PrimitiveType
|
120
|
+
#protege uri for a primitive type
|
121
|
+
def prot_uri
|
122
|
+
return "#{NS_RDF_2000}rdf-schema#Literal"
|
123
|
+
end
|
124
|
+
|
125
|
+
#Protege 2000 predefined type string
|
126
|
+
PROTEGE_STRING_DATATYPE="string"
|
127
|
+
|
128
|
+
#Protege 2000 predefined type boolean
|
129
|
+
PROTEGE_BOOLEAN_DATATYPE="boolean"
|
130
|
+
|
131
|
+
#Protege 2000 predefined type integer
|
132
|
+
PROTEGE_INTEGER_DATATYPE="integer"
|
133
|
+
|
134
|
+
# UML to Protege 2000 datatypes mappings.
|
135
|
+
UML_TO_PROTEGE_DATATYPE_MAPPING= {
|
136
|
+
"MimeType" => PROTEGE_STRING_DATATYPE,
|
137
|
+
"Password" => PROTEGE_STRING_DATATYPE,
|
138
|
+
"URL" => PROTEGE_STRING_DATATYPE,
|
139
|
+
"LargeText" => PROTEGE_STRING_DATATYPE,
|
140
|
+
"TimeStamp" => PROTEGE_STRING_DATATYPE,
|
141
|
+
"Calendar" => PROTEGE_STRING_DATATYPE,
|
142
|
+
"Boolean"=>PROTEGE_BOOLEAN_DATATYPE,
|
143
|
+
"boolean"=>PROTEGE_BOOLEAN_DATATYPE,
|
144
|
+
"Integer"=>PROTEGE_INTEGER_DATATYPE,
|
145
|
+
"String"=>PROTEGE_STRING_DATATYPE,
|
146
|
+
"stringstring "=>PROTEGE_STRING_DATATYPE,
|
147
|
+
"integerinteger " => PROTEGE_INTEGER_DATATYPE,
|
148
|
+
"datedate " => PROTEGE_STRING_DATATYPE,
|
149
|
+
"string" => PROTEGE_STRING_DATATYPE,
|
150
|
+
"integer" => PROTEGE_INTEGER_DATATYPE,
|
151
|
+
"decimal" => PROTEGE_INTEGER_DATATYPE,
|
152
|
+
"short" => PROTEGE_INTEGER_DATATYPE
|
153
|
+
}
|
154
|
+
|
155
|
+
#returns protege primitive type for this datatype
|
156
|
+
KB_NO_PROT_MAPPING_MSG_DISPLAYED=Set.new
|
157
|
+
def prot_primitive_type
|
158
|
+
r=UML_TO_PROTEGE_DATATYPE_MAPPING[uml_name.to_s]
|
159
|
+
return r if r
|
160
|
+
if !KB_NO_PROT_MAPPING_MSG_DISPLAYED.include?(uml_name.to_s)
|
161
|
+
KB_NO_PROT_MAPPING_MSG_DISPLAYED << uml_name.to_s
|
162
|
+
log.warn { "No protege mapping for primitive type \"#{uml_name}\" (uri=#{rdf_uri})" }
|
163
|
+
end
|
164
|
+
return PROTEGE_STRING_DATATYPE
|
165
|
+
end
|
166
|
+
|
167
|
+
end
|
168
|
+
|
169
|
+
module Muml_Property
|
170
|
+
#returns true if an homonym property exists in model
|
171
|
+
def otherWithSameName?
|
172
|
+
n= cardWithSameName(uml_name.to_s)
|
173
|
+
return false if n==1
|
174
|
+
return true if n>1
|
175
|
+
log.error "Error: #{n} #{uml_name.to_s}"
|
176
|
+
end
|
177
|
+
|
178
|
+
#check model for homonym properties
|
179
|
+
def cardWithSameName(str)
|
180
|
+
@@otherWithSameName_cache||=nil
|
181
|
+
return @@otherWithSameName_cache[str] if @@otherWithSameName_cache
|
182
|
+
@@otherWithSameName_cache=Hash.new(0)
|
183
|
+
|
184
|
+
rdf_model.uml_Class_all.each {|c| c.uml_ownedAttribute.each {|e|
|
185
|
+
str2=e.uml_name.to_s
|
186
|
+
@@otherWithSameName_cache[str2]+=1
|
187
|
+
}}
|
188
|
+
@@otherWithSameName_cache.each { |k,v|
|
189
|
+
log.warn "WARNING: UML Model contains homonyms property : #{k} (#{v} times)" if v>1 && !k.include?("$")
|
190
|
+
}
|
191
|
+
return @@otherWithSameName_cache[str]
|
192
|
+
end
|
193
|
+
|
194
|
+
#returns protege label for this property
|
195
|
+
def prot_label
|
196
|
+
return "#{prot_safe(uml_name)}" unless uml_name.to_s.empty?
|
197
|
+
oe=umlx_otherEnd
|
198
|
+
return "inv_#{prot_safe(oe.uml_name)}" unless oe.uml_name.to_s.empty?
|
199
|
+
return "#{prot_safe(uri)}"
|
200
|
+
end
|
201
|
+
end
|
202
|
+
|
203
|
+
|
204
|
+
module Muml_Class
|
205
|
+
#writes sub class of rdf instructions
|
206
|
+
def prot_writeSubClassOf
|
207
|
+
super # Classifier
|
208
|
+
uml_implementation.each { |g|
|
209
|
+
write("<#{prot_uri}> <#{RDF_SUBCLASSOF_URI}> <#{g.uml_supplier_one.prot_uri}> .\n")
|
210
|
+
}
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
module Muml_Classifier
|
215
|
+
#writes sub class of rdf instructions
|
216
|
+
def prot_writeSubClassOf
|
217
|
+
uml_generalization.each { |g|
|
218
|
+
write("<#{prot_uri}> <#{RDF_SUBCLASSOF_URI}> <#{g.uml_general_one.prot_uri}> .\n")
|
219
|
+
}
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
module Muml_UseCase
|
224
|
+
def mainSubClassOfURI
|
225
|
+
return "#{NS_UML_CLASS}#UML_TEST_DATA_SET"
|
226
|
+
end
|
227
|
+
end
|
228
|
+
|
229
|
+
module Muml_Classifier
|
230
|
+
#RDF metaclass for a classifier
|
231
|
+
RDF_METACLASS_URI="#{NS_UML_CLASS}#UML_METACLASS"
|
232
|
+
|
233
|
+
def mainSubClassOfURI
|
234
|
+
return "#{NS_UML_CLASS}#UML_CLASS"
|
235
|
+
end
|
236
|
+
|
237
|
+
#writes RDF triple elements describing this classifier element.
|
238
|
+
def prot_writeNTriple
|
239
|
+
e=self
|
240
|
+
write("<#{e.prot_uri}> <#{RDF_TYPE_URI}> <#{RDF_METACLASS_URI}> .\n")
|
241
|
+
write("<#{e.prot_uri}> <#{NS_RDF_2000}rdf-schema#label> \"#{e.uml_name.to_s.nt_escape}\" .\n")
|
242
|
+
if e.uml_isAbstract? || e.kind_of?(Muml_Interface) #|| e.kind_of?(Muml_UseCase)
|
243
|
+
write("<#{e.prot_uri}> <http://protege.stanford.edu/system#role> \"abstract\" .\n")
|
244
|
+
end
|
245
|
+
e.append_comment
|
246
|
+
e.prot_writeSubClassOf
|
247
|
+
|
248
|
+
write("<#{e.prot_uri}> <#{RDF_SUBCLASSOF_URI}> <#{mainSubClassOfURI}> .\n")
|
249
|
+
write("<#{e.prot_uri}> <#{NS_UML_CLASS}#UML_LABEL> \"#{prot_label}\" .\n")
|
250
|
+
write("<#{e.prot_uri}> <#{NS_UML_CLASS}#UML_URI> \"#{UriNamespace.instance.unalias(e.rdf_uri)}\" .\n")
|
251
|
+
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
module Muml_Property
|
256
|
+
#Metaclass URI used for a property in Protege
|
257
|
+
RDF_METACLASS_URI="http://protege.stanford.edu/kb#UML_SLOT"
|
258
|
+
|
259
|
+
#writes this property as RDF triples
|
260
|
+
def prot_writeNTriple
|
261
|
+
# against infinite loop
|
262
|
+
return unless @kb_exported.nil?
|
263
|
+
@kb_exported=true
|
264
|
+
|
265
|
+
if (uml_association.length==0)
|
266
|
+
prot_writeNTriple_common
|
267
|
+
#prot_writeNTriple_attribute
|
268
|
+
else
|
269
|
+
prot_writeNTriple_common
|
270
|
+
prot_writeNTriple_association
|
271
|
+
end
|
272
|
+
end
|
273
|
+
|
274
|
+
#writes property elements common to association and attribute as RDF triples
|
275
|
+
def prot_writeNTriple_common
|
276
|
+
o=self
|
277
|
+
e=o.umlx_class_one
|
278
|
+
#e=o.uml_ownedAttribute_inv
|
279
|
+
#e=uml_class_one if e.nil?
|
280
|
+
if e.nil?
|
281
|
+
#log.debug "null!!!!"
|
282
|
+
return
|
283
|
+
end
|
284
|
+
|
285
|
+
write("<#{o.prot_uri}> <#{NS_RDF_2000}rdf-schema#domain> <#{e.prot_uri}> .\n");
|
286
|
+
append_comment
|
287
|
+
o.uml_type.each { |t|
|
288
|
+
if (t.kind_of?(Cuml_PrimitiveType))
|
289
|
+
write("<#{o.prot_uri}> <#{NS_RDF_2000}rdf-schema#range> <#{t.prot_uri}> .\n")
|
290
|
+
write(%{<#{o.prot_uri}> <http://protege.stanford.edu/system#range> "#{t.prot_primitive_type}" .\n})
|
291
|
+
elsif t.kind_of?(Cuml_Enumeration)
|
292
|
+
write("<#{o.prot_uri}> <#{NS_RDF_2000}rdf-schema#range> <#{NS_RDF_2000}rdf-schema#Literal> .\n")
|
293
|
+
write(%{<#{o.prot_uri}> <http://protege.stanford.edu/system#range> "symbol" .\n})
|
294
|
+
t.uml_ownedLiteral.each {|c|
|
295
|
+
write(%{<#{o.prot_uri}> <http://protege.stanford.edu/system#allowedValues> "#{c}" .\n})
|
296
|
+
}
|
297
|
+
else
|
298
|
+
write("<#{o.prot_uri}> <#{NS_RDF_2000}rdf-schema#range> <#{t.prot_uri}> .\n")
|
299
|
+
end
|
300
|
+
}
|
301
|
+
write("<#{o.prot_uri}> <#{NS_RDF_1999}22-rdf-syntax-ns#type> <http://protege.stanford.edu/kb#UML_SLOT> .\n")
|
302
|
+
write("<#{o.prot_uri}> <http://protege.stanford.edu/kb#UML_LABEL> \"#{o.prot_label}\".\n")
|
303
|
+
write("<#{o.prot_uri}> <#{NS_UML_CLASS}#UML_URI> \"#{UriNamespace.instance.unalias(o.rdf_uri)}\" .\n")
|
304
|
+
write("<#{o.prot_uri}> <#{RDF_LABEL_URI}> \"#{o.uml_name.to_s.nt_escape}\" .\n")
|
305
|
+
|
306
|
+
cardUp=umlx_upperValueIsOne? ? "1" : "*"
|
307
|
+
cardLow=umlx_lowerValueIsZero? ? "0" : "1"
|
308
|
+
|
309
|
+
if ! uml_qualifier.empty?
|
310
|
+
#qualifiers changes cardinality semantics
|
311
|
+
cardLow="0"
|
312
|
+
cardUp="*"
|
313
|
+
end
|
314
|
+
|
315
|
+
##if isComposition
|
316
|
+
# log.debug "est une composition"
|
317
|
+
# cardLow="1"
|
318
|
+
#end
|
319
|
+
|
320
|
+
if cardLow!="0"
|
321
|
+
write("<#{o.prot_uri}> <http://protege.stanford.edu/system#minCardinality> \"#{cardLow}\" .\n")
|
322
|
+
end
|
323
|
+
|
324
|
+
if cardUp!="-1"
|
325
|
+
write("<#{o.prot_uri}> <http://protege.stanford.edu/system#maxCardinality> \"#{cardUp}\" .\n")
|
326
|
+
end
|
327
|
+
end
|
328
|
+
|
329
|
+
def prot_writeNTriple_association
|
330
|
+
write("<#{prot_uri}> <http://protege.stanford.edu/system#inverseProperty> <#{umlx_otherEnd.prot_uri}> .\n");
|
331
|
+
# make sure other end is exported when it is not navigable.
|
332
|
+
umlx_otherEnd.prot_writeNTriple unless umlx_otherEnd.umlx_isNavigable?
|
333
|
+
end
|
334
|
+
end
|
335
|
+
|
336
|
+
module Mrdf_Model
|
337
|
+
# generates Meta editor project for protege 2000
|
338
|
+
def generateMetaEditor(targetFile)
|
339
|
+
#log.debug "targetFile=#{targetFile}"
|
340
|
+
s=UML2_RDFS_NT_FILE
|
341
|
+
t="#{targetFile}_meta.rdfs.nt"
|
342
|
+
|
343
|
+
FileUtils.copy(s,t)
|
344
|
+
if File.exist?(targetFile+"_meta.rdfs")
|
345
|
+
log.info "Overwriting existing file: #{targetFile}_meta.rdfs"
|
346
|
+
end
|
347
|
+
translateToXML(targetFile+"_meta.rdfs.nt",targetFile+"_meta.rdfs")
|
348
|
+
|
349
|
+
if File.exist?(targetFile+"_meta.rdf")
|
350
|
+
log.info "Using already existing file: #{targetFile}_meta.rdf"
|
351
|
+
else
|
352
|
+
translateToXML(targetFile.to_s,targetFile+"_meta.rdf")
|
353
|
+
end
|
354
|
+
|
355
|
+
if File.exist?(targetFile+"_meta.pprj")
|
356
|
+
log.info "Using already existing file: #{targetFile}_meta.pprj"
|
357
|
+
else
|
358
|
+
ext="pprj"
|
359
|
+
log.info "creating .#{ext}"
|
360
|
+
mtk_writeSession(targetFile+"_meta.#{ext}") {
|
361
|
+
File.open("#{File.dirname(__FILE__)}/MYMODEL_meta.#{ext}",'r') { |src|
|
362
|
+
src.each {|line|
|
363
|
+
x=line.gsub(/MYMODEL_meta/,"#{File.basename(targetFile)}_meta")
|
364
|
+
write(x)
|
365
|
+
}
|
366
|
+
}
|
367
|
+
}
|
368
|
+
end
|
369
|
+
end
|
370
|
+
|
371
|
+
#generates protege 2000 knowledge base project files
|
372
|
+
def generateRDFS(targetFile)
|
373
|
+
#generateMetaEditor(targetFile)
|
374
|
+
generateProtegeKbProject(targetFile)
|
375
|
+
generateProtegeKbRDFS(targetFile)
|
376
|
+
end
|
377
|
+
|
378
|
+
#generates protege 2000 knowledge base project file and RDF file.
|
379
|
+
#internal used
|
380
|
+
def generateProtegeKbProject(targetFile)
|
381
|
+
["pprj","rdf"].each { |ext|
|
382
|
+
if File.exist?(targetFile+"_kb.#{ext}")
|
383
|
+
log.debug { "Using already existing file: #{ext}" }
|
384
|
+
next
|
385
|
+
end
|
386
|
+
log.info "creating .#{ext}"
|
387
|
+
mtk_writeSession(targetFile+"_kb.#{ext}") {
|
388
|
+
File.open("#{File.dirname(__FILE__)}/MYMODEL_kb.#{ext}",'r') { |src|
|
389
|
+
src.each {|line|
|
390
|
+
x=line.gsub(/MYMODEL_kb/,"#{File.basename(targetFile)}_kb")
|
391
|
+
write(x)
|
392
|
+
}
|
393
|
+
}
|
394
|
+
}
|
395
|
+
}
|
396
|
+
end
|
397
|
+
|
398
|
+
|
399
|
+
#generates Protege 2000 RDFS file of a knowledge base project.
|
400
|
+
def generateProtegeKbRDFS(targetFile)
|
401
|
+
targetFileRDFS=targetFile+"_kb.rdfs.nt"
|
402
|
+
targetFileXML=targetFile+"_kb.rdfs"
|
403
|
+
mtk_writeSession(targetFileRDFS) {
|
404
|
+
write(kbRDFS_header)
|
405
|
+
uml_Model_all.each { |m|
|
406
|
+
m.uml_Class_all.each {|c|
|
407
|
+
next if c.kind_of?(Muml_Enumeration)
|
408
|
+
c.prot_writeNTriple
|
409
|
+
c.uml_ownedAttribute.each {|a|
|
410
|
+
a.prot_writeNTriple
|
411
|
+
}
|
412
|
+
}
|
413
|
+
m.uml_UseCase_all.each {|uc|
|
414
|
+
uc.prot_writeNTriple
|
415
|
+
}
|
416
|
+
}
|
417
|
+
write(kbRDFS_footer)
|
418
|
+
}
|
419
|
+
translateToXML(targetFileRDFS.to_s,targetFileXML)
|
420
|
+
end
|
421
|
+
|
422
|
+
# Protege 2000 RDFS knowledge base file footer
|
423
|
+
def kbRDFS_footer
|
424
|
+
return "# end\n"
|
425
|
+
end
|
426
|
+
|
427
|
+
# Protege 2000 RDFS knowledge base file header
|
428
|
+
def kbRDFS_header
|
429
|
+
nt_top='# debut\n'
|
430
|
+
['UML_CLASS','UML_TEST_DATA_SET'].each {|c|
|
431
|
+
nt_top=nt_top+<<END2
|
432
|
+
<#{NS_UML_CLASS}##{c}> <http://protege.stanford.edu/system#role> "abstract" .
|
433
|
+
<#{NS_UML_CLASS}##{c}> <#{NS_RDF_2000}rdf-schema#label> "" .
|
434
|
+
<#{NS_UML_CLASS}##{c}> <#{NS_RDF_2000}rdf-schema#subClassOf> <#{NS_RDF_2000}rdf-schema#Resource> .
|
435
|
+
<#{NS_UML_CLASS}##{c}> <#{NS_RDF_2000}rdf-schema#comment> "Cette classe est la racine des classes de type UML. \\nFevrier 2006 - FTRD/BIZZ/CIL\\nStephane Carrie".
|
436
|
+
<#{NS_UML_CLASS}##{c}> <#{NS_RDF_1999}22-rdf-syntax-ns#type> <http://protege.stanford.edu/kb#UML_METACLASS> .
|
437
|
+
END2
|
438
|
+
}
|
439
|
+
|
440
|
+
nt_top=nt_top+<<END3
|
441
|
+
<#{NS_UML_CLASS}#UML_METACLASS> <#{NS_RDF_1999}22-rdf-syntax-ns#type> <#{NS_RDF_2000}rdf-schema#Class> .
|
442
|
+
<#{NS_UML_CLASS}#UML_METACLASS> <#{NS_RDF_2000}rdf-schema#label> "UML_METACLASS" .
|
443
|
+
<#{NS_UML_CLASS}#UML_METACLASS> <#{NS_RDF_2000}rdf-schema#subClassOf> <#{NS_RDF_2000}rdf-schema#Class> .
|
444
|
+
<#{NS_UML_CLASS}#UML_METACLASS> <#{NS_RDF_2000}rdf-schema#comment> "Cette classe est la metaclasse des classes de type UML. \\nFevrier 2006 - FTRD/BIZZ/CIL\\nStephane Pierre Carrie".
|
445
|
+
<http://protege.stanford.edu/kb#UML_SLOT> <#{NS_RDF_1999}22-rdf-syntax-ns#type> <#{NS_RDF_2000}rdf-schema#Class> .
|
446
|
+
<http://protege.stanford.edu/kb#UML_SLOT> <#{NS_RDF_2000}rdf-schema#subClassOf> <#{NS_RDF_1999}22-rdf-syntax-ns#Property> .
|
447
|
+
<#{NS_UML_CLASS}##{PROTEGE_INSTANCE_ALIAS_URI_SUFFIX}> <#{NS_RDF_1999}22-rdf-syntax-ns#type> <#{NS_RDF_1999}22-rdf-syntax-ns#Property> .
|
448
|
+
<#{NS_UML_CLASS}##{PROTEGE_INSTANCE_ALIAS_URI_SUFFIX}> <http://protege.stanford.edu/system#maxCardinality> "1" .
|
449
|
+
<#{NS_UML_CLASS}##{PROTEGE_INSTANCE_ALIAS_URI_SUFFIX}> <#{NS_RDF_2000}rdf-schema#label> "#{PROTEGE_INSTANCE_ALIAS_URI_SUFFIX}" .
|
450
|
+
<#{NS_UML_CLASS}##{PROTEGE_INSTANCE_ALIAS_URI_SUFFIX}> <#{NS_RDF_2000}rdf-schema#domain> <http://protege.stanford.edu/kb#UML_CLASS> .
|
451
|
+
<#{NS_UML_CLASS}##{PROTEGE_INSTANCE_ALIAS_URI_SUFFIX}> <#{NS_RDF_2000}rdf-schema#range> <#{NS_RDF_2000}rdf-schema#Literal> .
|
452
|
+
<#{NS_UML_CLASS}##{PROTEGE_INSTANCE_ALIAS_URI_SUFFIX}> <#{NS_RDF_2000}rdf-schema#comment> "UML Alias used as key in other tools (xmda java junit, ...)\\n - FTRD/BIZZ/CIL\\nStephane Pierre Carrie".
|
453
|
+
END3
|
454
|
+
|
455
|
+
nt_top=nt_top+<<END
|
456
|
+
<#{NS_UML_CLASS}##{PROTEGE_USE_CASE_ENV_URI_SUFFIX}> <#{NS_RDF_1999}22-rdf-syntax-ns#type> <#{NS_RDF_1999}22-rdf-syntax-ns#Property> .
|
457
|
+
<#{NS_UML_CLASS}##{PROTEGE_USE_CASE_ENV_URI_SUFFIX}> <http://protege.stanford.edu/system#maxCardinality> "1" .
|
458
|
+
<#{NS_UML_CLASS}##{PROTEGE_USE_CASE_ENV_URI_SUFFIX}> <#{NS_RDF_2000}rdf-schema#label> "#{PROTEGE_USE_CASE_ENV_URI_SUFFIX}" .
|
459
|
+
<#{NS_UML_CLASS}##{PROTEGE_USE_CASE_ENV_URI_SUFFIX}> <#{NS_RDF_2000}rdf-schema#domain> <http://protege.stanford.edu/kb#UML_TEST_DATA_SET> .
|
460
|
+
<#{NS_UML_CLASS}##{PROTEGE_USE_CASE_ENV_URI_SUFFIX}> <#{NS_RDF_2000}rdf-schema#range> <#{NS_RDF_2000}rdf-schema#Literal> .
|
461
|
+
<#{NS_UML_CLASS}##{PROTEGE_USE_CASE_ENV_URI_SUFFIX}> <#{NS_RDF_2000}rdf-schema#comment> "UML Alias used as key in other tools (xmda java junit, ...)\\n - FTRD/BIZZ/CIL\\nStephane Pierre Carrie".
|
462
|
+
END
|
463
|
+
|
464
|
+
|
465
|
+
|
466
|
+
|
467
|
+
['UML_LABEL', 'UML_URI'].each{ |k|
|
468
|
+
nt_top=nt_top+<<END
|
469
|
+
<#{NS_UML_CLASS}##{k}> <#{NS_RDF_1999}22-rdf-syntax-ns#type> <#{NS_RDF_1999}22-rdf-syntax-ns#Property> .
|
470
|
+
<#{NS_UML_CLASS}##{k}> <http://protege.stanford.edu/system#maxCardinality> "1" .
|
471
|
+
<#{NS_UML_CLASS}##{k}> <#{NS_RDF_2000}rdf-schema#label> "#{k}" .
|
472
|
+
<#{NS_UML_CLASS}##{k}> <#{NS_RDF_2000}rdf-schema#domain> <http://protege.stanford.edu/kb#UML_METACLASS> .
|
473
|
+
<#{NS_UML_CLASS}##{k}> <#{NS_RDF_2000}rdf-schema#domain> <http://protege.stanford.edu/kb#UML_SLOT> .
|
474
|
+
<#{NS_UML_CLASS}##{k}> <#{NS_RDF_2000}rdf-schema#range> <#{NS_RDF_2000}rdf-schema#Literal> .
|
475
|
+
END
|
476
|
+
}
|
477
|
+
#<#{NS_UML_CLASS}##{k}> <http://protege.stanford.edu/system#range> "cls" .
|
478
|
+
#<#{NS_UML_CLASS}##{k}> <#{NS_RDF_2000}rdf-schema#range> <http://www.w3.org/2000/01/rdf-schema#Class> .
|
479
|
+
#<#{NS_UML_CLASS}##{k}> <http://protege.stanford.edu/system#allowedParents> <#{NS_UML_CLASS}#UML_TEST_DATA_SET> .
|
480
|
+
|
481
|
+
['UML_REFERENCED_USE_CASE'].each{ |k|
|
482
|
+
inv="UML_DATA"
|
483
|
+
nt_top=nt_top+<<END
|
484
|
+
<#{NS_UML_CLASS}##{k}> <#{NS_RDF_1999}22-rdf-syntax-ns#type> <#{NS_RDF_1999}22-rdf-syntax-ns#Property> .
|
485
|
+
<#{NS_UML_CLASS}##{k}> <#{NS_RDF_2000}rdf-schema#label> "#{k}" .
|
486
|
+
<#{NS_UML_CLASS}##{k}> <#{NS_RDF_2000}rdf-schema#range> <#{NS_UML_CLASS}#UML_TEST_DATA_SET> .
|
487
|
+
<#{NS_UML_CLASS}##{k}> <#{NS_RDF_2000}rdf-schema#domain> <#{NS_UML_CLASS}#UML_CLASS> .
|
488
|
+
<#{NS_UML_CLASS}##{k}> <http://protege.stanford.edu/system#inverseProperty> <#{NS_UML_CLASS}##{inv}> .
|
489
|
+
<#{NS_UML_CLASS}##{inv}> <#{NS_RDF_1999}22-rdf-syntax-ns#type> <#{NS_RDF_1999}22-rdf-syntax-ns#Property> .
|
490
|
+
<#{NS_UML_CLASS}##{inv}> <#{NS_RDF_2000}rdf-schema#label> "{k}" .
|
491
|
+
<#{NS_UML_CLASS}##{inv}> <http://protege.stanford.edu/system#inverseProperty> <#{NS_UML_CLASS}##{k}> .
|
492
|
+
<#{NS_UML_CLASS}##{inv}> <#{NS_RDF_2000}rdf-schema#range> <#{NS_UML_CLASS}#UML_CLASS> .
|
493
|
+
<#{NS_UML_CLASS}##{inv}> <#{NS_RDF_2000}rdf-schema#domain> <#{NS_UML_CLASS}#UML_TEST_DATA_SET> .
|
494
|
+
END
|
495
|
+
}
|
496
|
+
return nt_top
|
497
|
+
end
|
498
|
+
end
|
499
|
+
|
File without changes
|
metadata
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ontomde-uml2-kb
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.4
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Stephane (Pierre) Carrie
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-03-03 00:00:00 +01:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: ontomde-uml2
|
17
|
+
version_requirement:
|
18
|
+
version_requirements: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - "="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 1.0.4
|
23
|
+
version:
|
24
|
+
- !ruby/object:Gem::Dependency
|
25
|
+
name: hoe
|
26
|
+
version_requirement:
|
27
|
+
version_requirements: !ruby/object:Gem::Requirement
|
28
|
+
requirements:
|
29
|
+
- - ">="
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: 1.5.0
|
32
|
+
version:
|
33
|
+
description: "Converts a UML2 model into a Prot\xE9g\xE9 2000 RDF/RDFS model. UML2 classes are converted into RDFS classes to allow data instances to be created. This tool is primarily used to create data test editors. == FEATURES/PROBLEMS: This Protege 2000 export tool supports: * single and incremental use. * transparent update of name changes from source to target mode. * class * abstract class * interface * enumerated types * generalization links * implementation links * property, association, composition and aggregation * single and multivalued properties * mandatory fields (cardinaly=0 or >0) * UML documentation notes export to Protege 2000 for easy reference."
|
34
|
+
email: stephanepierre.carrie@orange-ftgroup.com
|
35
|
+
executables:
|
36
|
+
- ontomde-umlToProtege
|
37
|
+
extensions: []
|
38
|
+
|
39
|
+
extra_rdoc_files:
|
40
|
+
- History.txt
|
41
|
+
- Manifest.txt
|
42
|
+
- README.txt
|
43
|
+
files:
|
44
|
+
- History.txt
|
45
|
+
- Manifest.txt
|
46
|
+
- README.txt
|
47
|
+
- Rakefile
|
48
|
+
- lib/ontomde-uml2-kb/MYMODEL_kb.pprj
|
49
|
+
- lib/ontomde-uml2-kb/MYMODEL_kb.rdf
|
50
|
+
- lib/ontomde-uml2-kb/MYMODEL_kb.rdfs
|
51
|
+
- lib/ontomde-uml2-kb.rb
|
52
|
+
- lib/ontomde-uml2-kb/version.rb
|
53
|
+
- lib/ontomde-uml2-kb/protege.rb
|
54
|
+
- lib/ontomde-uml2-kb/command.rb
|
55
|
+
- lib/ontomde-uml2-kb/datatypeMapping.rb
|
56
|
+
- test/test_ontomde-uml2-kb.rb
|
57
|
+
- bin/ontomde-umlToProtege
|
58
|
+
has_rdoc: true
|
59
|
+
homepage: http://ontomde.rubyforge.org
|
60
|
+
post_install_message:
|
61
|
+
rdoc_options:
|
62
|
+
- --main
|
63
|
+
- README.txt
|
64
|
+
require_paths:
|
65
|
+
- lib
|
66
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: 1.8.6
|
71
|
+
version:
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 1.0.0
|
77
|
+
version:
|
78
|
+
requirements: []
|
79
|
+
|
80
|
+
rubyforge_project: ontomde
|
81
|
+
rubygems_version: 1.0.1
|
82
|
+
signing_key:
|
83
|
+
specification_version: 2
|
84
|
+
summary: OntoMDE UML2 / protege2000integration cartridge
|
85
|
+
test_files:
|
86
|
+
- test/test_ontomde-uml2-kb.rb
|