ontomde-uml2 1.0.6 → 2.0.0
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/Manifest.txt +38 -22
- data/README.txt +21 -2
- data/Rakefile +1 -1
- data/bin/ontomde-umlToProtege +4 -0
- data/lib/ontomde-uml2.rb +19 -17
- data/lib/ontomde-uml2/UMLdatatypeMapping.rb +441 -0
- data/lib/ontomde-uml2/autoImplement.rb +170 -166
- data/lib/ontomde-uml2/check.rb +1 -1
- data/lib/ontomde-uml2/component.rb +45 -0
- data/lib/ontomde-uml2/createAndAdd.rb +32 -20
- data/lib/ontomde-uml2/dotDiagram.rb +1 -1
- data/lib/ontomde-uml2/kb.rb +4 -0
- data/lib/ontomde-uml2/kb/MYMODEL_kb.pprj +2377 -0
- data/lib/ontomde-uml2/kb/MYMODEL_kb.rdf +2 -0
- data/lib/ontomde-uml2/kb/MYMODEL_kb.rdfs +441 -0
- data/lib/ontomde-uml2/kb/MYMODEL_meta.pprj +874 -0
- data/lib/ontomde-uml2/kb/command.rb +143 -0
- data/lib/ontomde-uml2/kb/datatypeMapping.rb +99 -0
- data/lib/ontomde-uml2/kb/protege.rb +687 -0
- data/lib/ontomde-uml2/multipleInheritance.rb +1 -1
- data/lib/ontomde-uml2/salvageErrors.rb +1 -1
- data/lib/ontomde-uml2/select.rb +83 -5
- data/lib/ontomde-uml2/shortcut.rb +23 -8
- data/lib/ontomde-uml2/uml2.pprj +943 -0
- data/lib/ontomde-uml2/uml2.rb +62 -29
- data/lib/ontomde-uml2/uml2.rdf +768 -0
- data/lib/ontomde-uml2/uml2.rdfs +3233 -0
- data/lib/ontomde-uml2/umlx.rb +31 -9
- data/lib/ontomde-uml2/version.rb +1 -1
- data/lib/ontomde-uml2/versionSignature.rb +1 -1
- data/lib/ontomde-uml2/xsd.pprj +1063 -0
- data/lib/ontomde-uml2/xsd.rdf +2 -0
- data/lib/ontomde-uml2/xsd.rdfs +17 -0
- data/test/_test_dot.rb +1 -1
- data/test/_test_perf.rb +1 -1
- data/test/test_base.rb +1 -1
- data/test/test_clone.rb +5 -5
- data/test/test_misc.rb +3 -3
- metadata +47 -29
@@ -0,0 +1,143 @@
|
|
1
|
+
#Command line front end for ontomde knowledge base generator.
|
2
|
+
|
3
|
+
require 'optparse'
|
4
|
+
|
5
|
+
require 'ontomde-uml2/kb'
|
6
|
+
|
7
|
+
#Rubygems allow a specific script version to be passed on command line.
|
8
|
+
#Version is passed as a first parameter like : _1.0.1_
|
9
|
+
#
|
10
|
+
#For testing purposes, this script may be called directly (not through gem).
|
11
|
+
#We have to remove the version number which was not removed by gem.
|
12
|
+
def removeVersionInARGV
|
13
|
+
return if ARGV.empty?
|
14
|
+
return unless ARGV[0]=~/^_[.0-9]*_$/
|
15
|
+
puts "** WARNING: command line parameter #{ARGV[0]} ignored.\n"
|
16
|
+
ARGV.delete_at(0)
|
17
|
+
end
|
18
|
+
|
19
|
+
removeVersionInARGV
|
20
|
+
|
21
|
+
options = {}
|
22
|
+
options[:target]="./build/"
|
23
|
+
options[:load]={}
|
24
|
+
options[:selfTestAndExit]=false
|
25
|
+
|
26
|
+
#cf: http://www.ruby-doc.org/core/classes/OptionParser.html
|
27
|
+
OptionParser.new do |opts|
|
28
|
+
opts.banner =<<ENDHELP
|
29
|
+
------------------------------------------------------
|
30
|
+
#{File.basename(__FILE__)} converts a UML2/RDF model file into a protege 2000 knowledge base.
|
31
|
+
(cf: http://protege.stanford.edu)
|
32
|
+
|
33
|
+
Example:
|
34
|
+
$ #{File.basename(__FILE__)} --nt myUmlModel.emx.nt
|
35
|
+
will generate these Protege files:
|
36
|
+
* myUmlModel.emx.nt_kb.pprj
|
37
|
+
* myUmlModel.emx.nt_kb.rdf
|
38
|
+
* myUmlModel.emx.nt_kb.rdfs
|
39
|
+
------------------------------------------------------
|
40
|
+
Usage: #{File.basename(__FILE__)} [options]
|
41
|
+
ENDHELP
|
42
|
+
|
43
|
+
opts.on("-v", "--[no|-verbose", "Run in verbose mode") do |v|
|
44
|
+
options[:verbose] = v
|
45
|
+
end
|
46
|
+
|
47
|
+
opts.on("-n","--nt FILE1.nt,FILE2.nt, ...",Array,"source UML2 model","(exported from a UML case tool)") do |v|
|
48
|
+
options[:nt] = v
|
49
|
+
end
|
50
|
+
|
51
|
+
opts.on("-l","--load FILE1.rb,File2.rb,..",Array,"option ruby file to load","used for generator customisation such as new datatype declaration") do |v|
|
52
|
+
options[:load]=v
|
53
|
+
end
|
54
|
+
|
55
|
+
opts.on("-t","--target DIRECTORY","Destination directory for generated files","default: --target #{options[:target]}") do |v|
|
56
|
+
options[:target] = v
|
57
|
+
end
|
58
|
+
|
59
|
+
opts.on("--[no-]selfTestAndExit", "self test and exit.","(loads every dependencies)","(Note: option used by binary generator)",%{default: --#{options[:selfTestAndExit]?"":"no-"}selfTestAndExit}) do |v|
|
60
|
+
options[:selfTestAndExit] = v
|
61
|
+
end
|
62
|
+
|
63
|
+
opts.separator ""
|
64
|
+
opts.separator "Common options:"
|
65
|
+
|
66
|
+
# No argument, shows at tail. This will print an options summary.
|
67
|
+
# Try it and see!
|
68
|
+
opts.on_tail("-h", "--help", "Show this message") do
|
69
|
+
puts opts
|
70
|
+
exit
|
71
|
+
end
|
72
|
+
|
73
|
+
end.parse!
|
74
|
+
|
75
|
+
if ARGV.length > 0
|
76
|
+
raise Exception.new("Command line processing at #{ARGV}")
|
77
|
+
end
|
78
|
+
|
79
|
+
if options[:selfTestAndExit ]
|
80
|
+
# load every depencies
|
81
|
+
# (used for rubyscript2exe to force loading of depencies)
|
82
|
+
# no dynamic load to perform
|
83
|
+
exit 0
|
84
|
+
end
|
85
|
+
|
86
|
+
options[:load].each { |f|
|
87
|
+
puts "INFO : Loading custom transformation from #{f} in #{FileUtils.pwd}" if options[:verbose]
|
88
|
+
begin
|
89
|
+
# if require is used add "./" to avoid
|
90
|
+
# file not found from binary generated with rubyscript2exe
|
91
|
+
require "./#{f}"
|
92
|
+
rescue Exception => e
|
93
|
+
log.error %{
|
94
|
+
*************** ERROR ***************
|
95
|
+
** Error processing
|
96
|
+
** --load #{f}
|
97
|
+
** (pwd=#{FileUtils.pwd})
|
98
|
+
** Exception:
|
99
|
+
** #{e}
|
100
|
+
*************** ERROR ***************
|
101
|
+
|
102
|
+
}
|
103
|
+
raise e
|
104
|
+
|
105
|
+
end
|
106
|
+
}
|
107
|
+
|
108
|
+
[:nt,:target].each { |p|
|
109
|
+
puts "--#{p}=#{options[p]}" if options[:verbose]
|
110
|
+
next unless options[p].nil?
|
111
|
+
m="--#{p} parameter is mandatory"
|
112
|
+
log.error("")
|
113
|
+
log.error(m)
|
114
|
+
log.error("For command syntax :")
|
115
|
+
log.error("#{File.basename(__FILE__)} --help")
|
116
|
+
log.error("")
|
117
|
+
raise Exception.new(m)
|
118
|
+
}
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
def say(x)
|
123
|
+
puts("# #{File.basename(__FILE__)} #{x}")
|
124
|
+
end
|
125
|
+
|
126
|
+
model=Crdf_Repository.new
|
127
|
+
model.loadUml2
|
128
|
+
say "Chargement du modele"
|
129
|
+
i=0
|
130
|
+
modelName=""
|
131
|
+
options[:nt].each { |f|
|
132
|
+
i=i+1
|
133
|
+
modelName=f # Last one
|
134
|
+
say "Chargement de #{f}" if options[:verbose]
|
135
|
+
model.loadModelFromFile(f)
|
136
|
+
}
|
137
|
+
say "Nombre de fichiers charges: #{i}" if options[:verbose]
|
138
|
+
say "Generation du code" if options[:verbose]
|
139
|
+
model.mtk_context(:build=>options[:target],:logFileWrite=>false) {
|
140
|
+
model.generateRDFS(modelName)
|
141
|
+
}
|
142
|
+
say "done"
|
143
|
+
|
@@ -0,0 +1,99 @@
|
|
1
|
+
class DatatypeMapping
|
2
|
+
def prot_getProtegeType
|
3
|
+
return nil # no protege mapping defined
|
4
|
+
end
|
5
|
+
end
|
6
|
+
|
7
|
+
class DatatypeMappingText < DatatypeMapping
|
8
|
+
def prot_getProtegeType
|
9
|
+
return Muml_PrimitiveType::PROTEGE_STRING_DATATYPE
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
class DatatypeMappingLargeText < DatatypeMappingText
|
14
|
+
end
|
15
|
+
|
16
|
+
class DatatypeMappingMimeType < DatatypeMappingText
|
17
|
+
end
|
18
|
+
|
19
|
+
class DatatypeMappingOrdinal < DatatypeMappingText
|
20
|
+
end
|
21
|
+
|
22
|
+
class DatatypeMappingInteger < DatatypeMappingOrdinal
|
23
|
+
def prot_getProtegeType
|
24
|
+
return Muml_PrimitiveType::PROTEGE_INTEGER_DATATYPE
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
class DatatypeMappingLong < DatatypeMappingOrdinal
|
29
|
+
def prot_getProtegeType
|
30
|
+
return Muml_PrimitiveType::PROTEGE_INTEGER_DATATYPE
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
class DatatypeMappingLongObject < DatatypeMappingOrdinal
|
35
|
+
def prot_getProtegeType
|
36
|
+
return Muml_PrimitiveType::PROTEGE_INTEGER_DATATYPE
|
37
|
+
end
|
38
|
+
end
|
39
|
+
class DatatypeMappingFile < DatatypeMapping
|
40
|
+
end
|
41
|
+
|
42
|
+
class DatatypeMappingBoolean < DatatypeMapping
|
43
|
+
def prot_getProtegeType
|
44
|
+
return Muml_PrimitiveType::PROTEGE_BOOLEAN_DATATYPE
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
class DatatypeMappingTimeStamp < DatatypeMapping
|
49
|
+
def prot_getProtegeType
|
50
|
+
return Muml_PrimitiveType::PROTEGE_STRING_DATATYPE
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
class DatatypeMappingCalendar < DatatypeMapping
|
55
|
+
def prot_getProtegeType
|
56
|
+
return Muml_PrimitiveType::PROTEGE_STRING_DATATYPE
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
class DatatypeMappingGenericClass < DatatypeMapping
|
64
|
+
#def prot_getProtegeType
|
65
|
+
# not applicatble
|
66
|
+
#end
|
67
|
+
end
|
68
|
+
|
69
|
+
class DatatypeMappingGenericEnum < DatatypeMapping
|
70
|
+
#def prot_getProtegeType
|
71
|
+
# not applicatble
|
72
|
+
#end
|
73
|
+
end
|
74
|
+
|
75
|
+
class DatatypeMappingURL < DatatypeMappingText
|
76
|
+
end
|
77
|
+
|
78
|
+
class DatatypeMappingBLOB < DatatypeMapping
|
79
|
+
#def prot_getProtegeType
|
80
|
+
# return PROTEGE_STRING_DATATYPE
|
81
|
+
#end
|
82
|
+
end
|
83
|
+
|
84
|
+
class DatatypeMappingIMG < DatatypeMappingBLOB
|
85
|
+
#def prot_getProtegeType
|
86
|
+
# return PROTEGE_STRING_DATATYPE
|
87
|
+
#end
|
88
|
+
end
|
89
|
+
|
90
|
+
class DatatypeMappingGRAPHVIZ < DatatypeMappingLargeText
|
91
|
+
end
|
92
|
+
|
93
|
+
class DatatypeMappingPassword < DatatypeMappingText
|
94
|
+
end
|
95
|
+
|
96
|
+
class DatatypeMappingEmailAddress < DatatypeMappingText
|
97
|
+
end
|
98
|
+
|
99
|
+
|
@@ -0,0 +1,687 @@
|
|
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
|
+
#URI prefix of soa knowledge base
|
25
|
+
NS_SOA_CLASS="http://protege.stanford.edu/soa"
|
26
|
+
|
27
|
+
|
28
|
+
#Name of the protege slot containing the name of an instance
|
29
|
+
#Name change should be propagated to bootstrap protege model
|
30
|
+
PROTEGE_INSTANCE_ALIAS_URI_SUFFIX="UML_INSTANCE_ALIAS"
|
31
|
+
|
32
|
+
#Name of the protege slot containing the name of a use case sub-instance.
|
33
|
+
#(
|
34
|
+
PROTEGE_USE_CASE_ENV_URI_SUFFIX="UML_DATA_SET_NAME"
|
35
|
+
|
36
|
+
end
|
37
|
+
|
38
|
+
class String
|
39
|
+
#insert space between camelcase
|
40
|
+
#Example:
|
41
|
+
# unCamelCase("abcDef") returns "abc Def"
|
42
|
+
def unCamelCase
|
43
|
+
return gsub(/([a-z])([A-Z])/,'\1 \2')
|
44
|
+
end
|
45
|
+
|
46
|
+
#returns string after
|
47
|
+
def nt_escape
|
48
|
+
#TODO: gestion generique de l'unicode
|
49
|
+
return self.to_s.
|
50
|
+
gsub(/\\n/,'<br>').
|
51
|
+
gsub(/\\u0085/,''). # next line ???
|
52
|
+
gsub(/\\u00EE/,'i'). # i acute
|
53
|
+
gsub(/\\u00F4/,'o'). # o circ
|
54
|
+
gsub(/\\u00E7/,'c'). # c cedil
|
55
|
+
gsub(/\\u00E0/,'a'). # a grav
|
56
|
+
gsub(/\\u00E8/,'e'). # e grav
|
57
|
+
gsub(/\\u00E9/,'e'). # e acute
|
58
|
+
gsub(/\\u00C9/,'E'). # E acute
|
59
|
+
gsub(/\\u00EA/,'e'). # e circ
|
60
|
+
tr("^\#*a-zA-Z0-9 ,.!?:_\'\/<>-",'_').
|
61
|
+
gsub(/<br>/,'\\n')
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
module Mrdf_Resource
|
66
|
+
|
67
|
+
attr :kb_exported
|
68
|
+
|
69
|
+
def prot_safe(str)
|
70
|
+
return str.to_s.nt_escape.tr('^a-zA-Z0-9_','_')
|
71
|
+
end
|
72
|
+
|
73
|
+
#protege 2000 uri used for a resource
|
74
|
+
#(redefined for sub-classes)
|
75
|
+
def prot_uri
|
76
|
+
UriNamespace.instance.unalias(rdf_uri)
|
77
|
+
end
|
78
|
+
|
79
|
+
#label used in protege 2000
|
80
|
+
def prot_label
|
81
|
+
return "#{NS_UML_CLASS}##{prot_safe(uri)}"
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
module Muml_Element
|
86
|
+
#writes uml comment as and rdf comment
|
87
|
+
def append_comment
|
88
|
+
c=""
|
89
|
+
uml_ownedComment.each { |comment|
|
90
|
+
if comment.uml_body_one
|
91
|
+
c=c+comment.uml_body_one
|
92
|
+
end
|
93
|
+
}
|
94
|
+
write("<#{self.prot_uri}> <#{NS_RDF_2000}rdf-schema#comment> \"#{c.nt_escape}\".\n") if c!=""
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
|
99
|
+
module Muml_Classifier
|
100
|
+
ProtegeURI=Hash.new
|
101
|
+
|
102
|
+
#label used in protege 2000
|
103
|
+
def prot_label
|
104
|
+
return "#{prot_uri_local}"
|
105
|
+
end
|
106
|
+
|
107
|
+
def prot_uri_local
|
108
|
+
b="#{prot_safe(uml_name)}"
|
109
|
+
s=b
|
110
|
+
i=1
|
111
|
+
while true
|
112
|
+
if ProtegeURI[s].nil?
|
113
|
+
ProtegeURI[s]=self
|
114
|
+
return s
|
115
|
+
end
|
116
|
+
return s if ProtegeURI[s]==self
|
117
|
+
i=i+1
|
118
|
+
s=b+"_"+i.to_s
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
122
|
+
#writes sub class of rdf instructions
|
123
|
+
def prot_writeSubClassOf
|
124
|
+
uml_generalization.each { |g|
|
125
|
+
write("<#{prot_uri}> <#{RDF_SUBCLASSOF_URI}> <#{g.uml_general_one.prot_uri}> .\n")
|
126
|
+
}
|
127
|
+
end
|
128
|
+
|
129
|
+
#RDF metaclass for a classifier
|
130
|
+
RDF_METACLASS_URI="#{NS_UML_CLASS}#UML_METACLASS"
|
131
|
+
|
132
|
+
def mainSubClassOfURI
|
133
|
+
return "#{NS_UML_CLASS}#UML_CLASS"
|
134
|
+
end
|
135
|
+
|
136
|
+
#writes RDF triple elements describing this classifier element.
|
137
|
+
def prot_writeNTriple
|
138
|
+
e=self
|
139
|
+
write("<#{e.prot_uri}> <#{RDF_TYPE_URI}> <#{RDF_METACLASS_URI}> .\n")
|
140
|
+
write("<#{e.prot_uri}> <#{NS_RDF_2000}rdf-schema#label> \"#{e.uml_name.to_s.nt_escape}\" .\n")
|
141
|
+
if e.uml_isAbstract? || e.kind_of?(Muml_Interface) #|| e.kind_of?(Muml_UseCase)
|
142
|
+
write("<#{e.prot_uri}> <http://protege.stanford.edu/system#role> \"abstract\" .\n")
|
143
|
+
end
|
144
|
+
e.append_comment
|
145
|
+
e.prot_writeSubClassOf
|
146
|
+
|
147
|
+
write("<#{e.prot_uri}> <#{RDF_SUBCLASSOF_URI}> <#{mainSubClassOfURI}> .\n")
|
148
|
+
write("<#{e.prot_uri}> <#{NS_UML_CLASS}#UML_LABEL> \"#{prot_label}\" .\n")
|
149
|
+
write("<#{e.prot_uri}> <#{NS_UML_CLASS}#UML_URI> \"#{UriNamespace.instance.unalias(e.rdf_uri)}\" .\n")
|
150
|
+
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
module Muml_PrimitiveType
|
155
|
+
#protege uri for a primitive type
|
156
|
+
def prot_uri
|
157
|
+
return "#{NS_RDF_2000}rdf-schema#Literal"
|
158
|
+
end
|
159
|
+
|
160
|
+
#Protege 2000 predefined type string
|
161
|
+
PROTEGE_STRING_DATATYPE="string"
|
162
|
+
|
163
|
+
#Protege 2000 predefined type boolean
|
164
|
+
PROTEGE_BOOLEAN_DATATYPE="boolean"
|
165
|
+
|
166
|
+
#Protege 2000 predefined type integer
|
167
|
+
PROTEGE_INTEGER_DATATYPE="integer"
|
168
|
+
|
169
|
+
#returns protege primitive type for this datatype
|
170
|
+
def prot_primitive_type
|
171
|
+
r=DatatypeMapping.instance.getMapping(self).prot_getProtegeType
|
172
|
+
return r unless r.nil?
|
173
|
+
|
174
|
+
msg="No protege mapping for primitive type \"#{uml_name}\" (uri=#{rdf_uri})"
|
175
|
+
log.warn(msg) unless log_already_displayed?(msg)
|
176
|
+
return PROTEGE_STRING_DATATYPE
|
177
|
+
end
|
178
|
+
|
179
|
+
end
|
180
|
+
|
181
|
+
module Muml_TypedElement
|
182
|
+
#returns true if an homonym property exists in model
|
183
|
+
def otherWithSameName?
|
184
|
+
n= cardWithSameName(uml_name.to_s)
|
185
|
+
return false if n==1
|
186
|
+
return true if n>1
|
187
|
+
log.error "Error: #{n} #{uml_name.to_s}"
|
188
|
+
end
|
189
|
+
|
190
|
+
#check model for homonym properties
|
191
|
+
def cardWithSameName(str)
|
192
|
+
@@otherWithSameName_cache||=nil
|
193
|
+
return @@otherWithSameName_cache[str] if @@otherWithSameName_cache
|
194
|
+
@@otherWithSameName_cache=Hash.new(0)
|
195
|
+
|
196
|
+
rdf_Repository.uml_Class_all.each {|c| c.uml_ownedAttribute.each {|e|
|
197
|
+
str2=e.uml_name.to_s
|
198
|
+
@@otherWithSameName_cache[str2]+=1
|
199
|
+
}}
|
200
|
+
@@otherWithSameName_cache.each { |k,v|
|
201
|
+
log.warn "WARNING: UML Model contains homonyms property : #{k} (#{v} times)" if v>1 && !k.include?("$")
|
202
|
+
}
|
203
|
+
return @@otherWithSameName_cache[str]
|
204
|
+
end
|
205
|
+
|
206
|
+
#returns protege label for this property
|
207
|
+
def prot_label
|
208
|
+
return "#{prot_safe(uml_name)}" unless uml_name.to_s.empty?
|
209
|
+
oe=umlx_otherEnd
|
210
|
+
return "inv_#{prot_safe(oe.uml_name)}" unless oe.uml_name.to_s.empty?
|
211
|
+
return "#{prot_safe(uri)}"
|
212
|
+
end
|
213
|
+
|
214
|
+
#Metaclass URI used for a property in Protege
|
215
|
+
RDF_METACLASS_URI="http://protege.stanford.edu/kb#UML_SLOT"
|
216
|
+
|
217
|
+
end
|
218
|
+
module Muml_Parameter
|
219
|
+
def prot_writeNTriple_parameter(owner)
|
220
|
+
o=self
|
221
|
+
# e=owner
|
222
|
+
# write("<#{o.prot_uri}> <#{NS_RDF_2000}rdf-schema#domain> <#{e.prot_uri}> .\n");
|
223
|
+
# append_comment
|
224
|
+
# o.uml_type.each { |t|
|
225
|
+
# if (t.kind_of?(Cuml_PrimitiveType))
|
226
|
+
# write("<#{o.prot_uri}> <#{NS_RDF_2000}rdf-schema#range> <#{t.prot_uri}> .\n")
|
227
|
+
# write(%{<#{o.prot_uri}> <http://protege.stanford.edu/system#range> "#{t.prot_primitive_type}" .\n})
|
228
|
+
# elsif t.kind_of?(Cuml_Enumeration)
|
229
|
+
# write("<#{o.prot_uri}> <#{NS_RDF_2000}rdf-schema#range> <#{NS_RDF_2000}rdf-schema#Literal> .\n")
|
230
|
+
# write(%{<#{o.prot_uri}> <http://protege.stanford.edu/system#range> "symbol" .\n})
|
231
|
+
# t.uml_ownedLiteral.each {|c|
|
232
|
+
# write(%{<#{o.prot_uri}> <http://protege.stanford.edu/system#allowedValues> "#{c}" .\n})
|
233
|
+
# }
|
234
|
+
# else
|
235
|
+
# write("<#{o.prot_uri}> <#{NS_RDF_2000}rdf-schema#range> <#{t.prot_uri}> .\n")
|
236
|
+
# end
|
237
|
+
# }
|
238
|
+
write("<#{o.prot_uri}> <#{NS_RDF_1999}22-rdf-syntax-ns#type> <http://protege.stanford.edu/kb#UML_SLOT> .\n")
|
239
|
+
write("<#{o.prot_uri}> <http://protege.stanford.edu/kb#UML_LABEL> \"#{o.prot_label} (#{owner.prot_label} from #{owner.umlx_owner_one.prot_label})\".\n")
|
240
|
+
write("<#{o.prot_uri}> <#{NS_UML_CLASS}#UML_URI> \"#{UriNamespace.instance.unalias(o.rdf_uri)}\" .\n")
|
241
|
+
write("<#{o.prot_uri}> <#{RDF_LABEL_URI}> \"#{o.uml_name.to_s.nt_escape}\" .\n")
|
242
|
+
|
243
|
+
cardUp=umlx_upperValueIsOne? ? "1" : "*"
|
244
|
+
cardLow=umlx_lowerValueIsZero? ? "0" : "1"
|
245
|
+
|
246
|
+
# if ! uml_qualifier.empty?
|
247
|
+
# #qualifiers changes cardinality semantics
|
248
|
+
# cardLow="0"
|
249
|
+
# cardUp="*"
|
250
|
+
# end
|
251
|
+
|
252
|
+
#if isComposition
|
253
|
+
# log.debug "est une composition"
|
254
|
+
# cardLow="1"
|
255
|
+
#end
|
256
|
+
|
257
|
+
if cardLow!="0"
|
258
|
+
write("<#{o.prot_uri}> <http://protege.stanford.edu/system#minCardinality> \"#{cardLow}\" .\n")
|
259
|
+
end
|
260
|
+
|
261
|
+
if cardUp!="-1"
|
262
|
+
write("<#{o.prot_uri}> <http://protege.stanford.edu/system#maxCardinality> \"#{cardUp}\" .\n")
|
263
|
+
end
|
264
|
+
end
|
265
|
+
end
|
266
|
+
module Muml_Property
|
267
|
+
|
268
|
+
|
269
|
+
#writes this property as RDF triples
|
270
|
+
def prot_writeNTriple
|
271
|
+
# against infinite loop
|
272
|
+
return unless @kb_exported.nil?
|
273
|
+
@kb_exported=true
|
274
|
+
|
275
|
+
if (uml_association.length==0)
|
276
|
+
prot_writeNTriple_common
|
277
|
+
#prot_writeNTriple_attribute
|
278
|
+
else
|
279
|
+
prot_writeNTriple_common
|
280
|
+
prot_writeNTriple_association
|
281
|
+
end
|
282
|
+
end
|
283
|
+
|
284
|
+
#writes property elements common to association and attribute as RDF triples
|
285
|
+
def prot_writeNTriple_common
|
286
|
+
o=self
|
287
|
+
e=o.umlx_class_one
|
288
|
+
#e=o.uml_ownedAttribute_inv
|
289
|
+
#e=uml_class_one if e.nil?
|
290
|
+
if e.nil?
|
291
|
+
#log.debug "null!!!!"
|
292
|
+
return
|
293
|
+
end
|
294
|
+
|
295
|
+
write("<#{o.prot_uri}> <#{NS_RDF_2000}rdf-schema#domain> <#{e.prot_uri}> .\n");
|
296
|
+
append_comment
|
297
|
+
o.uml_type.each { |t|
|
298
|
+
if (t.kind_of?(Cuml_PrimitiveType))
|
299
|
+
write("<#{o.prot_uri}> <#{NS_RDF_2000}rdf-schema#range> <#{t.prot_uri}> .\n")
|
300
|
+
write(%{<#{o.prot_uri}> <http://protege.stanford.edu/system#range> "#{t.prot_primitive_type}" .\n})
|
301
|
+
elsif t.kind_of?(Cuml_Enumeration)
|
302
|
+
write("<#{o.prot_uri}> <#{NS_RDF_2000}rdf-schema#range> <#{NS_RDF_2000}rdf-schema#Literal> .\n")
|
303
|
+
write(%{<#{o.prot_uri}> <http://protege.stanford.edu/system#range> "symbol" .\n})
|
304
|
+
t.uml_ownedLiteral.each {|c|
|
305
|
+
write(%{<#{o.prot_uri}> <http://protege.stanford.edu/system#allowedValues> "#{c}" .\n})
|
306
|
+
}
|
307
|
+
else
|
308
|
+
write("<#{o.prot_uri}> <#{NS_RDF_2000}rdf-schema#range> <#{t.prot_uri}> .\n")
|
309
|
+
end
|
310
|
+
}
|
311
|
+
write("<#{o.prot_uri}> <#{NS_RDF_1999}22-rdf-syntax-ns#type> <http://protege.stanford.edu/kb#UML_SLOT> .\n")
|
312
|
+
write("<#{o.prot_uri}> <http://protege.stanford.edu/kb#UML_LABEL> \"#{o.prot_label}\".\n")
|
313
|
+
write("<#{o.prot_uri}> <#{NS_UML_CLASS}#UML_URI> \"#{UriNamespace.instance.unalias(o.rdf_uri)}\" .\n")
|
314
|
+
write("<#{o.prot_uri}> <#{RDF_LABEL_URI}> \"#{o.uml_name.to_s.nt_escape}\" .\n")
|
315
|
+
|
316
|
+
cardUp=umlx_upperValueIsOne? ? "1" : "*"
|
317
|
+
cardLow=umlx_lowerValueIsZero? ? "0" : "1"
|
318
|
+
|
319
|
+
if ! uml_qualifier.empty?
|
320
|
+
#qualifiers changes cardinality semantics
|
321
|
+
cardLow="0"
|
322
|
+
cardUp="*"
|
323
|
+
end
|
324
|
+
|
325
|
+
##if isComposition
|
326
|
+
# log.debug "est une composition"
|
327
|
+
# cardLow="1"
|
328
|
+
#end
|
329
|
+
|
330
|
+
if cardLow!="0"
|
331
|
+
write("<#{o.prot_uri}> <http://protege.stanford.edu/system#minCardinality> \"#{cardLow}\" .\n")
|
332
|
+
end
|
333
|
+
|
334
|
+
if cardUp!="-1"
|
335
|
+
write("<#{o.prot_uri}> <http://protege.stanford.edu/system#maxCardinality> \"#{cardUp}\" .\n")
|
336
|
+
end
|
337
|
+
end
|
338
|
+
|
339
|
+
def prot_writeNTriple_association
|
340
|
+
write("<#{prot_uri}> <http://protege.stanford.edu/system#inverseProperty> <#{umlx_otherEnd.prot_uri}> .\n");
|
341
|
+
# make sure other end is exported when it is not navigable.
|
342
|
+
umlx_otherEnd.prot_writeNTriple unless umlx_otherEnd.umlx_isNavigable?
|
343
|
+
end
|
344
|
+
end
|
345
|
+
|
346
|
+
|
347
|
+
module Muml_Class
|
348
|
+
#writes sub class of rdf instructions
|
349
|
+
def prot_writeSubClassOf
|
350
|
+
super # Classifier
|
351
|
+
uml_implementation.each { |g|
|
352
|
+
write("<#{prot_uri}> <#{RDF_SUBCLASSOF_URI}> <#{g.uml_supplier_one.prot_uri}> .\n")
|
353
|
+
}
|
354
|
+
end
|
355
|
+
end
|
356
|
+
|
357
|
+
|
358
|
+
|
359
|
+
module Muml_UseCase
|
360
|
+
def mainSubClassOfURI
|
361
|
+
return "#{NS_UML_CLASS}#UML_TEST_DATA_SET"
|
362
|
+
end
|
363
|
+
end
|
364
|
+
|
365
|
+
module Mrdf_Repository
|
366
|
+
# generates Meta editor project for protege 2000
|
367
|
+
def generateMetaEditor(targetFile)
|
368
|
+
#log.debug "targetFile=#{targetFile}"
|
369
|
+
s=UML2_RDFS_NT_FILE
|
370
|
+
t="#{targetFile}_meta.rdfs.nt"
|
371
|
+
|
372
|
+
FileUtils.copy(s,t)
|
373
|
+
if File.exist?(targetFile+"_meta.rdfs")
|
374
|
+
log.info "Overwriting existing file: #{targetFile}_meta.rdfs"
|
375
|
+
end
|
376
|
+
translateToXML(targetFile+"_meta.rdfs.nt",targetFile+"_meta.rdfs")
|
377
|
+
|
378
|
+
if File.exist?(targetFile+"_meta.rdf")
|
379
|
+
log.info "Using already existing file: #{targetFile}_meta.rdf"
|
380
|
+
else
|
381
|
+
translateToXML(targetFile.to_s,targetFile+"_meta.rdf")
|
382
|
+
end
|
383
|
+
|
384
|
+
if File.exist?(targetFile+"_meta.pprj")
|
385
|
+
log.info "Using already existing file: #{targetFile}_meta.pprj"
|
386
|
+
else
|
387
|
+
ext="pprj"
|
388
|
+
log.info "creating .#{ext}"
|
389
|
+
mtk_writeSession(targetFile+"_meta.#{ext}") {
|
390
|
+
File.open("#{File.dirname(__FILE__)}/MYMODEL_meta.#{ext}",'r') { |src|
|
391
|
+
src.each {|line|
|
392
|
+
x=line.gsub(/MYMODEL_meta/,"#{File.basename(targetFile)}_meta")
|
393
|
+
write(x)
|
394
|
+
}
|
395
|
+
}
|
396
|
+
}
|
397
|
+
end
|
398
|
+
end
|
399
|
+
|
400
|
+
#generates protege 2000 knowledge base project files
|
401
|
+
def generateRDFS(targetFile)
|
402
|
+
#generateMetaEditor(targetFile)
|
403
|
+
generateProtegeKbProject(targetFile)
|
404
|
+
generateProtegeKbRDFS(targetFile)
|
405
|
+
end
|
406
|
+
|
407
|
+
PROJECT_FILE_SUFFIX=""
|
408
|
+
|
409
|
+
#generates protege 2000 knowledge base project file and RDF file.
|
410
|
+
#internal used
|
411
|
+
def generateProtegeKbProject(targetFile)
|
412
|
+
["pprj","rdf"].each { |ext|
|
413
|
+
if File.exist?(targetFile+"#{PROJECT_FILE_SUFFIX}.#{ext}")
|
414
|
+
log.debug { "Using already existing file: #{ext}" }
|
415
|
+
next
|
416
|
+
end
|
417
|
+
log.info "creating .#{ext}"
|
418
|
+
mtk_writeSession(targetFile+"#{PROJECT_FILE_SUFFIX}.#{ext}") {
|
419
|
+
File.open("#{File.dirname(__FILE__)}/MYMODEL_kb.#{ext}",'r') { |src|
|
420
|
+
src.each {|line|
|
421
|
+
x=line.gsub(/MYMODEL_kb/,"#{File.basename(targetFile)}#{PROJECT_FILE_SUFFIX}")
|
422
|
+
write(x)
|
423
|
+
}
|
424
|
+
}
|
425
|
+
}
|
426
|
+
}
|
427
|
+
end
|
428
|
+
|
429
|
+
|
430
|
+
#generates Protege 2000 RDFS file of a knowledge base project.
|
431
|
+
def generateProtegeKbRDFS(targetFile)
|
432
|
+
targetFileRDFS=targetFile+"#{PROJECT_FILE_SUFFIX}.rdfs.nt"
|
433
|
+
targetFileXML=targetFile+"#{PROJECT_FILE_SUFFIX}.rdfs"
|
434
|
+
|
435
|
+
#mark temporary file for deletion
|
436
|
+
mtk_addTempFileToDelete(targetFileRDFS)
|
437
|
+
|
438
|
+
mtk_writeSession(targetFileRDFS) {
|
439
|
+
write(kbRDFS_header)
|
440
|
+
uml_Model_all.each { |m|
|
441
|
+
m.uml_Class_all.each {|c|
|
442
|
+
next if c.kind_of?(Muml_Enumeration)
|
443
|
+
c.prot_writeNTriple
|
444
|
+
c.uml_ownedAttribute.each {|a|
|
445
|
+
a.prot_writeNTriple
|
446
|
+
}
|
447
|
+
c.uml_ownedOperation.each {|a|
|
448
|
+
(a.uml_ownedParameter+a.uml_returnResult).each {|param|
|
449
|
+
# puts "--> param: #{param}"
|
450
|
+
param.prot_writeNTriple_parameter(a)
|
451
|
+
}
|
452
|
+
}
|
453
|
+
}
|
454
|
+
m.uml_UseCase_all.each {|uc|
|
455
|
+
uc.prot_writeNTriple
|
456
|
+
}
|
457
|
+
}
|
458
|
+
kbRDFS_writeComponents
|
459
|
+
write(kbRDFS_footer)
|
460
|
+
}
|
461
|
+
translateToXML(targetFileRDFS.to_s,targetFileXML)
|
462
|
+
end
|
463
|
+
|
464
|
+
# Protege 2000 RDFS knowledge base file footer
|
465
|
+
def kbRDFS_footer
|
466
|
+
return "# end\n"
|
467
|
+
end
|
468
|
+
|
469
|
+
SOA_URI="#{NS_SOA_CLASS}#soa"
|
470
|
+
DATAFILTER_URI="#{NS_SOA_CLASS}#dataFilter"
|
471
|
+
DATAFILTERNAME_URI="#{NS_SOA_CLASS}#dataFilterName"
|
472
|
+
SERVICE_URI="#{NS_SOA_CLASS}#service"
|
473
|
+
ROOT_URI="#{NS_RDF_2000}rdf-schema#Resource"
|
474
|
+
PREDEF_DATAFILTER_URI="#{NS_SOA_CLASS}#predefinedDataFilter"
|
475
|
+
CUSTOM_DATAFILTER_URI="#{NS_SOA_CLASS}#customDataFilter"
|
476
|
+
DATAFILTER_RULE_URI="#{NS_SOA_CLASS}#dataFilterRule"
|
477
|
+
DATAFILTER_PROPERTY_RULE_URI="#{NS_SOA_CLASS}#dataPropertyFilterRule"
|
478
|
+
DATAFILTER_PARAMETER_RULE_URI="#{NS_SOA_CLASS}#dataParameterFilterRule"
|
479
|
+
TARGETDATAFILTER_URI="#{NS_SOA_CLASS}#useDataFilter"
|
480
|
+
SOURCEDATAFILTER_URI="#{NS_SOA_CLASS}#sourceDataFilter"
|
481
|
+
FILTERED_FIELD_URI="#{NS_SOA_CLASS}#filteredProperty"
|
482
|
+
|
483
|
+
#list of SOA URI for use in exclusion list in rdfToJava
|
484
|
+
SOA_URI_SET=[
|
485
|
+
PREDEF_DATAFILTER_URI,
|
486
|
+
CUSTOM_DATAFILTER_URI,
|
487
|
+
DATAFILTER_RULE_URI,
|
488
|
+
DATAFILTER_PROPERTY_RULE_URI,
|
489
|
+
DATAFILTER_PARAMETER_RULE_URI,
|
490
|
+
TARGETDATAFILTER_URI,
|
491
|
+
SOURCEDATAFILTER_URI,
|
492
|
+
FILTERED_FIELD_URI
|
493
|
+
]
|
494
|
+
|
495
|
+
# Protege 2000 RDFS knowledge base file header
|
496
|
+
def kbRDFS_header
|
497
|
+
nt_top='# debut\n'
|
498
|
+
['UML_CLASS','UML_TEST_DATA_SET'].each {|c|
|
499
|
+
nt_top=nt_top+<<END2
|
500
|
+
<#{NS_UML_CLASS}##{c}> <http://protege.stanford.edu/system#role> "abstract" .
|
501
|
+
<#{NS_UML_CLASS}##{c}> <#{NS_RDF_2000}rdf-schema#label> "" .
|
502
|
+
<#{NS_UML_CLASS}##{c}> <#{NS_RDF_2000}rdf-schema#subClassOf> <#{ROOT_URI}> .
|
503
|
+
<#{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\\nStep#{""}hane Car#{""}rie".
|
504
|
+
<#{NS_UML_CLASS}##{c}> <#{NS_RDF_1999}22-rdf-syntax-ns#type> <http://protege.stanford.edu/kb#UML_METACLASS> .
|
505
|
+
END2
|
506
|
+
}
|
507
|
+
|
508
|
+
|
509
|
+
nt_top=nt_top+<<END_SOA
|
510
|
+
<#{SOA_URI}> <http://protege.stanford.edu/system#role> "abstract" .
|
511
|
+
<#{SOA_URI}> <#{NS_RDF_2000}rdf-schema#label> "" .
|
512
|
+
<#{SOA_URI}> <#{NS_RDF_2000}rdf-schema#subClassOf> <#{ROOT_URI}> .
|
513
|
+
<#{SOA_URI}> <#{NS_RDF_2000}rdf-schema#comment> "SOA sub-model root element. \\nMay 2008 - FTRD/BIZZ/CIL\\nStep#{""}hane Car#{""}rie".
|
514
|
+
<#{SOA_URI}> <#{NS_RDF_1999}22-rdf-syntax-ns#type> <http://protege.stanford.edu/kb#UML_METACLASS> .
|
515
|
+
END_SOA
|
516
|
+
|
517
|
+
|
518
|
+
nt_top=nt_top+<<END_SOA
|
519
|
+
<#{DATAFILTER_URI}> <#{NS_RDF_2000}rdf-schema#label> "" .
|
520
|
+
<#{DATAFILTER_URI}> <http://protege.stanford.edu/system#role> "abstract" .
|
521
|
+
<#{DATAFILTER_URI}> <#{NS_RDF_2000}rdf-schema#subClassOf> <#{SOA_URI}> .
|
522
|
+
<#{DATAFILTER_URI}> <#{NS_RDF_2000}rdf-schema#comment> "SOA data filter rule inventory. \\nMay 2008 - FTRD/BIZZ/CIL\\nStep#{""}hane Car#{""}rie".
|
523
|
+
<#{DATAFILTER_URI}> <#{NS_RDF_1999}22-rdf-syntax-ns#type> <http://protege.stanford.edu/kb#UML_METACLASS> .
|
524
|
+
<#{DATAFILTER_URI}> <#{NS_UML_CLASS}#UML_URI> "#{DATAFILTER_URI}" .
|
525
|
+
|
526
|
+
<#{DATAFILTERNAME_URI}> <#{NS_RDF_1999}22-rdf-syntax-ns#type> <#{NS_RDF_1999}22-rdf-syntax-ns#Property> .
|
527
|
+
<#{DATAFILTERNAME_URI}> <http://protege.stanford.edu/system#maxCardinality> "1" .
|
528
|
+
<#{DATAFILTERNAME_URI}> <#{NS_RDF_2000}rdf-schema#label> "dataFilterName" .
|
529
|
+
<#{DATAFILTERNAME_URI}> <#{NS_RDF_2000}rdf-schema#domain> <#{DATAFILTER_URI}> .
|
530
|
+
<#{DATAFILTERNAME_URI}> <#{NS_RDF_2000}rdf-schema#range> <#{NS_RDF_2000}rdf-schema#Literal> .
|
531
|
+
<#{DATAFILTERNAME_URI}> <#{NS_RDF_2000}rdf-schema#comment> "SOA dataFilter name\\nMay 2008 - FTRD/BIZZ/CIL\\nStep#{""}hane Pie#{""}rre Car#{""}rie" .
|
532
|
+
|
533
|
+
<#{PREDEF_DATAFILTER_URI}> <#{NS_RDF_2000}rdf-schema#label> "" .
|
534
|
+
<#{PREDEF_DATAFILTER_URI}> <#{NS_RDF_2000}rdf-schema#subClassOf> <#{DATAFILTER_URI}> .
|
535
|
+
<#{PREDEF_DATAFILTER_URI}> <#{NS_RDF_2000}rdf-schema#comment> "SOA predefined data filter rule. \\nMay 2008 - FTRD/BIZZ/CIL\\nStep#{""}hane Car#{""}rie" .
|
536
|
+
<#{PREDEF_DATAFILTER_URI}> <#{NS_RDF_1999}22-rdf-syntax-ns#type> <http://protege.stanford.edu/kb#UML_METACLASS> .
|
537
|
+
<#{PREDEF_DATAFILTER_URI}> <#{NS_UML_CLASS}#UML_URI> "#{PREDEF_DATAFILTER_URI}" .
|
538
|
+
|
539
|
+
<#{CUSTOM_DATAFILTER_URI}> <#{NS_RDF_2000}rdf-schema#label> "" .
|
540
|
+
<#{CUSTOM_DATAFILTER_URI}> <#{NS_RDF_2000}rdf-schema#subClassOf> <#{DATAFILTER_URI}> .
|
541
|
+
<#{CUSTOM_DATAFILTER_URI}> <#{NS_RDF_2000}rdf-schema#comment> "SOA custom data filter rule. \\nMay 2008 - FTRD/BIZZ/CIL\\nStep#{""}hane Car#{""}rie" .
|
542
|
+
<#{CUSTOM_DATAFILTER_URI}> <#{NS_RDF_1999}22-rdf-syntax-ns#type> <http://protege.stanford.edu/kb#UML_METACLASS> .
|
543
|
+
<#{CUSTOM_DATAFILTER_URI}> <#{NS_UML_CLASS}#UML_URI> "#{CUSTOM_DATAFILTER_URI}" .
|
544
|
+
|
545
|
+
<#{DATAFILTER_RULE_URI}> <#{NS_RDF_2000}rdf-schema#label> "" .
|
546
|
+
<#{DATAFILTER_RULE_URI}> <http://protege.stanford.edu/system#role> "abstract" .
|
547
|
+
<#{DATAFILTER_RULE_URI}> <#{NS_RDF_2000}rdf-schema#subClassOf> <#{SOA_URI}> .
|
548
|
+
<#{DATAFILTER_RULE_URI}> <#{NS_RDF_2000}rdf-schema#comment> "SOA data filter rule inventory. \\nMay 2008 - FTRD/BIZZ/CIL\\nStep#{""}hane Car#{""}rie".
|
549
|
+
<#{DATAFILTER_RULE_URI}> <#{NS_RDF_1999}22-rdf-syntax-ns#type> <http://protege.stanford.edu/kb#UML_METACLASS> .
|
550
|
+
<#{DATAFILTER_RULE_URI}> <#{NS_UML_CLASS}#UML_URI> "#{DATAFILTER_RULE_URI}" .
|
551
|
+
|
552
|
+
<#{DATAFILTER_PROPERTY_RULE_URI}> <#{NS_RDF_2000}rdf-schema#label> "" .
|
553
|
+
<#{DATAFILTER_PROPERTY_RULE_URI}> <#{NS_RDF_2000}rdf-schema#subClassOf> <#{DATAFILTER_RULE_URI}> .
|
554
|
+
<#{DATAFILTER_PROPERTY_RULE_URI}> <#{NS_RDF_2000}rdf-schema#comment> "SOA data filter property rule. \\nMay 2008 - FTRD/BIZZ/CIL\\nStep#{""}hane Car#{""}rie".
|
555
|
+
<#{DATAFILTER_PROPERTY_RULE_URI}> <#{NS_RDF_1999}22-rdf-syntax-ns#type> <http://protege.stanford.edu/kb#UML_METACLASS> .
|
556
|
+
<#{DATAFILTER_PROPERTY_RULE_URI}> <#{NS_UML_CLASS}#UML_URI> "#{DATAFILTER_PROPERTY_RULE_URI}" .
|
557
|
+
|
558
|
+
<#{SOURCEDATAFILTER_URI}> <#{NS_RDF_1999}22-rdf-syntax-ns#type> <#{NS_RDF_1999}22-rdf-syntax-ns#Property> .
|
559
|
+
<#{SOURCEDATAFILTER_URI}> <http://protege.stanford.edu/system#maxCardinality> "1" .
|
560
|
+
<#{SOURCEDATAFILTER_URI}> <#{NS_RDF_2000}rdf-schema#label> "sourceDataFilter" .
|
561
|
+
<#{SOURCEDATAFILTER_URI}> <#{NS_RDF_2000}rdf-schema#domain> <#{DATAFILTER_RULE_URI}> .
|
562
|
+
<#{SOURCEDATAFILTER_URI}> <#{NS_RDF_2000}rdf-schema#range> <#{DATAFILTER_URI}> .
|
563
|
+
<#{SOURCEDATAFILTER_URI}> <#{NS_RDF_2000}rdf-schema#comment> "SOA sourceDataFilter name\\nMay 2008 - FTRD/BIZZ/CIL\\nStep#{""}hane Pie#{""}rre Car#{""}rie".
|
564
|
+
|
565
|
+
<#{TARGETDATAFILTER_URI}> <#{NS_RDF_1999}22-rdf-syntax-ns#type> <#{NS_RDF_1999}22-rdf-syntax-ns#Property> .
|
566
|
+
<#{TARGETDATAFILTER_URI}> <http://protege.stanford.edu/system#maxCardinality> "1" .
|
567
|
+
<#{TARGETDATAFILTER_URI}> <#{NS_RDF_2000}rdf-schema#label> "targetDataFilter" .
|
568
|
+
<#{TARGETDATAFILTER_URI}> <#{NS_RDF_2000}rdf-schema#domain> <#{DATAFILTER_RULE_URI}> .
|
569
|
+
<#{TARGETDATAFILTER_URI}> <#{NS_RDF_2000}rdf-schema#range> <#{DATAFILTER_URI}> .
|
570
|
+
<#{TARGETDATAFILTER_URI}> <#{NS_RDF_2000}rdf-schema#comment> "SOA sourceDataFilter name\\nMay 2008 - FTRD/BIZZ/CIL\\nStep#{""}hane Pie#{""}rre Car#{""}rie".
|
571
|
+
|
572
|
+
<#{FILTERED_FIELD_URI}> <#{NS_RDF_1999}22-rdf-syntax-ns#type> <#{NS_RDF_1999}22-rdf-syntax-ns#Property> .
|
573
|
+
<#{FILTERED_FIELD_URI}> <http://protege.stanford.edu/system#maxCardinality> "1" .
|
574
|
+
<#{FILTERED_FIELD_URI}> <#{NS_RDF_2000}rdf-schema#label> "filteredProperty" .
|
575
|
+
<#{FILTERED_FIELD_URI}> <#{NS_RDF_2000}rdf-schema#domain> <#{DATAFILTER_RULE_URI}> .
|
576
|
+
<#{FILTERED_FIELD_URI}> <#{NS_RDF_2000}rdf-schema#range> <http://protege.stanford.edu/kb#UML_SLOT> .
|
577
|
+
<#{FILTERED_FIELD_URI}> <#{NS_RDF_2000}rdf-schema#comment> "SOA sourceDataFilter name\\nMay 2008 - FTRD/BIZZ/CIL\\nStep#{""}hane Pie#{""}rre Car#{""}rie".
|
578
|
+
|
579
|
+
<#{DATAFILTER_PARAMETER_RULE_URI}> <#{NS_RDF_2000}rdf-schema#label> "" .
|
580
|
+
<#{DATAFILTER_PARAMETER_RULE_URI}> <#{NS_RDF_2000}rdf-schema#subClassOf> <#{DATAFILTER_RULE_URI}> .
|
581
|
+
<#{DATAFILTER_PARAMETER_RULE_URI}> <#{NS_RDF_2000}rdf-schema#comment> "SOA data filter parameter rule. \\nMay 2008 - FTRD/BIZZ/CIL\\nStep#{""}hane Car#{""}rie".
|
582
|
+
<#{DATAFILTER_PARAMETER_RULE_URI}> <#{NS_RDF_1999}22-rdf-syntax-ns#type> <http://protege.stanford.edu/kb#UML_METACLASS> .
|
583
|
+
<#{DATAFILTER_PARAMETER_RULE_URI}> <#{NS_UML_CLASS}#UML_URI> "#{DATAFILTER_PARAMETER_RULE_URI}" .
|
584
|
+
|
585
|
+
END_SOA
|
586
|
+
|
587
|
+
|
588
|
+
nt_top=nt_top+<<END3
|
589
|
+
<#{NS_UML_CLASS}#UML_METACLASS> <#{NS_RDF_1999}22-rdf-syntax-ns#type> <#{NS_RDF_2000}rdf-schema#Class> .
|
590
|
+
<#{NS_UML_CLASS}#UML_METACLASS> <#{NS_RDF_2000}rdf-schema#label> "UML_METACLASS" .
|
591
|
+
<#{NS_UML_CLASS}#UML_METACLASS> <#{NS_RDF_2000}rdf-schema#subClassOf> <#{NS_RDF_2000}rdf-schema#Class> .
|
592
|
+
<#{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\\nStep#{""}hane Pie#{""}rre Car#{""}rie".
|
593
|
+
<http://protege.stanford.edu/kb#UML_SLOT> <#{NS_RDF_1999}22-rdf-syntax-ns#type> <#{NS_RDF_2000}rdf-schema#Class> .
|
594
|
+
<http://protege.stanford.edu/kb#UML_SLOT> <#{NS_RDF_2000}rdf-schema#subClassOf> <#{NS_RDF_1999}22-rdf-syntax-ns#Property> .
|
595
|
+
<#{NS_UML_CLASS}##{PROTEGE_INSTANCE_ALIAS_URI_SUFFIX}> <#{NS_RDF_1999}22-rdf-syntax-ns#type> <#{NS_RDF_1999}22-rdf-syntax-ns#Property> .
|
596
|
+
<#{NS_UML_CLASS}##{PROTEGE_INSTANCE_ALIAS_URI_SUFFIX}> <http://protege.stanford.edu/system#maxCardinality> "1" .
|
597
|
+
<#{NS_UML_CLASS}##{PROTEGE_INSTANCE_ALIAS_URI_SUFFIX}> <#{NS_RDF_2000}rdf-schema#label> "#{PROTEGE_INSTANCE_ALIAS_URI_SUFFIX}" .
|
598
|
+
<#{NS_UML_CLASS}##{PROTEGE_INSTANCE_ALIAS_URI_SUFFIX}> <#{NS_RDF_2000}rdf-schema#domain> <http://protege.stanford.edu/kb#UML_CLASS> .
|
599
|
+
<#{NS_UML_CLASS}##{PROTEGE_INSTANCE_ALIAS_URI_SUFFIX}> <#{NS_RDF_2000}rdf-schema#range> <#{NS_RDF_2000}rdf-schema#Literal> .
|
600
|
+
<#{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\\nStep#{""}hane Pie#{""}rre Car#{""}rie".
|
601
|
+
END3
|
602
|
+
|
603
|
+
nt_top=nt_top+<<END
|
604
|
+
<#{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> .
|
605
|
+
<#{NS_UML_CLASS}##{PROTEGE_USE_CASE_ENV_URI_SUFFIX}> <http://protege.stanford.edu/system#maxCardinality> "1" .
|
606
|
+
<#{NS_UML_CLASS}##{PROTEGE_USE_CASE_ENV_URI_SUFFIX}> <#{NS_RDF_2000}rdf-schema#label> "#{PROTEGE_USE_CASE_ENV_URI_SUFFIX}" .
|
607
|
+
<#{NS_UML_CLASS}##{PROTEGE_USE_CASE_ENV_URI_SUFFIX}> <#{NS_RDF_2000}rdf-schema#domain> <http://protege.stanford.edu/kb#UML_TEST_DATA_SET> .
|
608
|
+
<#{NS_UML_CLASS}##{PROTEGE_USE_CASE_ENV_URI_SUFFIX}> <#{NS_RDF_2000}rdf-schema#range> <#{NS_RDF_2000}rdf-schema#Literal> .
|
609
|
+
<#{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\\nStep#{""}hane Pier#{""}re Car#{""}rie".
|
610
|
+
END
|
611
|
+
|
612
|
+
|
613
|
+
|
614
|
+
|
615
|
+
['UML_LABEL', 'UML_URI'].each{ |k|
|
616
|
+
nt_top=nt_top+<<END
|
617
|
+
<#{NS_UML_CLASS}##{k}> <#{NS_RDF_1999}22-rdf-syntax-ns#type> <#{NS_RDF_1999}22-rdf-syntax-ns#Property> .
|
618
|
+
<#{NS_UML_CLASS}##{k}> <http://protege.stanford.edu/system#maxCardinality> "1" .
|
619
|
+
<#{NS_UML_CLASS}##{k}> <#{NS_RDF_2000}rdf-schema#label> "#{k}" .
|
620
|
+
<#{NS_UML_CLASS}##{k}> <#{NS_RDF_2000}rdf-schema#domain> <http://protege.stanford.edu/kb#UML_METACLASS> .
|
621
|
+
<#{NS_UML_CLASS}##{k}> <#{NS_RDF_2000}rdf-schema#domain> <http://protege.stanford.edu/kb#UML_SLOT> .
|
622
|
+
<#{NS_UML_CLASS}##{k}> <#{NS_RDF_2000}rdf-schema#range> <#{NS_RDF_2000}rdf-schema#Literal> .
|
623
|
+
END
|
624
|
+
}
|
625
|
+
#<#{NS_UML_CLASS}##{k}> <http://protege.stanford.edu/system#range> "cls" .
|
626
|
+
#<#{NS_UML_CLASS}##{k}> <#{NS_RDF_2000}rdf-schema#range> <http://www.w3.org/2000/01/rdf-schema#Class> .
|
627
|
+
#<#{NS_UML_CLASS}##{k}> <http://protege.stanford.edu/system#allowedParents> <#{NS_UML_CLASS}#UML_TEST_DATA_SET> .
|
628
|
+
|
629
|
+
['UML_REFERENCED_USE_CASE'].each{ |k|
|
630
|
+
inv="UML_DATA"
|
631
|
+
nt_top=nt_top+<<END
|
632
|
+
<#{NS_UML_CLASS}##{k}> <#{NS_RDF_1999}22-rdf-syntax-ns#type> <#{NS_RDF_1999}22-rdf-syntax-ns#Property> .
|
633
|
+
<#{NS_UML_CLASS}##{k}> <#{NS_RDF_2000}rdf-schema#label> "#{k}" .
|
634
|
+
<#{NS_UML_CLASS}##{k}> <#{NS_RDF_2000}rdf-schema#range> <#{NS_UML_CLASS}#UML_TEST_DATA_SET> .
|
635
|
+
<#{NS_UML_CLASS}##{k}> <#{NS_RDF_2000}rdf-schema#domain> <#{NS_UML_CLASS}#UML_CLASS> .
|
636
|
+
<#{NS_UML_CLASS}##{k}> <http://protege.stanford.edu/system#inverseProperty> <#{NS_UML_CLASS}##{inv}> .
|
637
|
+
<#{NS_UML_CLASS}##{inv}> <#{NS_RDF_1999}22-rdf-syntax-ns#type> <#{NS_RDF_1999}22-rdf-syntax-ns#Property> .
|
638
|
+
<#{NS_UML_CLASS}##{inv}> <#{NS_RDF_2000}rdf-schema#label> "{k}" .
|
639
|
+
<#{NS_UML_CLASS}##{inv}> <http://protege.stanford.edu/system#inverseProperty> <#{NS_UML_CLASS}##{k}> .
|
640
|
+
<#{NS_UML_CLASS}##{inv}> <#{NS_RDF_2000}rdf-schema#range> <#{NS_UML_CLASS}#UML_CLASS> .
|
641
|
+
<#{NS_UML_CLASS}##{inv}> <#{NS_RDF_2000}rdf-schema#domain> <#{NS_UML_CLASS}#UML_TEST_DATA_SET> .
|
642
|
+
END
|
643
|
+
}
|
644
|
+
return nt_top
|
645
|
+
end
|
646
|
+
|
647
|
+
def kbRDFS_writeComponents
|
648
|
+
uml_Component_all.each { |c|
|
649
|
+
c.kb_writeComponent
|
650
|
+
}
|
651
|
+
end
|
652
|
+
end
|
653
|
+
|
654
|
+
module Muml_Component
|
655
|
+
def kb_writeComponent
|
656
|
+
uml_ownedOperation.each {|op|
|
657
|
+
op.kb_writeComponentOperation
|
658
|
+
}
|
659
|
+
end
|
660
|
+
end
|
661
|
+
module Muml_Operation
|
662
|
+
|
663
|
+
def kb_writeComponentOperation
|
664
|
+
u="#{rdf_uri}_soaOp"
|
665
|
+
write <<END
|
666
|
+
<#{u}> <#{NS_RDF_2000}rdf-schema#label> "" .
|
667
|
+
<#{u}> <#{NS_RDF_2000}rdf-schema#subClassOf> <#{Mrdf_Repository::SERVICE_URI}> .
|
668
|
+
<#{u}> <#{NS_RDF_2000}rdf-schema#comment> "Definition for service #{uml_name}" .
|
669
|
+
<#{u}> <#{NS_RDF_1999}22-rdf-syntax-ns#type> <http://protege.stanford.edu/kb#UML_METACLASS> .
|
670
|
+
END
|
671
|
+
|
672
|
+
(uml_ownedParameter+uml_returnResult).each { |p|
|
673
|
+
up="#{p.rdf_uri}-soaMapping"
|
674
|
+
write <<END
|
675
|
+
<#{up}> <#{NS_RDF_1999}22-rdf-syntax-ns#type> <#{NS_RDF_1999}22-rdf-syntax-ns#Property> .
|
676
|
+
<#{up}> <http://protege.stanford.edu/system#maxCardinality> "1" .
|
677
|
+
<#{up}> <#{NS_RDF_2000}rdf-schema#label> "param#{p}" .
|
678
|
+
<#{up}> <#{NS_RDF_2000}rdf-schema#domain> <#{u}> .
|
679
|
+
<#{up}> <#{NS_RDF_2000}rdf-schema#range> <#{Mrdf_Repository::DATAFILTER_URI}> .
|
680
|
+
<#{up}> <#{NS_RDF_2000}rdf-schema#comment> "service" .
|
681
|
+
END
|
682
|
+
}
|
683
|
+
|
684
|
+
|
685
|
+
end
|
686
|
+
end
|
687
|
+
|