ontomde-core 1.0.2 → 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.
@@ -23,7 +23,9 @@
23
23
  kb:civilite="Monsieur"
24
24
  kb:nom="Lafleur"
25
25
  kb:prenom="Fernand"
26
- rdfs:label="Fernand Lafleur"/>
26
+ rdfs:label="Fernand Lafleur">
27
+ <kb:sponsoredBy rdf:resource="&kb;SampleModel_Instance_3"/>
28
+ </kb:ClientNonFidelise>
27
29
  <kb:Contrat rdf:about="&kb;etatCivil_Instance_1"
28
30
  rdfs:label="etatCivil_Instance_1"/>
29
31
  </rdf:RDF>
@@ -68,4 +68,10 @@
68
68
  <rdfs:domain rdf:resource="&kb;Client"/>
69
69
  <rdfs:range rdf:resource="&rdfs;Literal"/>
70
70
  </rdf:Property>
71
+ <rdf:Property rdf:about="&kb;sponsoredBy"
72
+ a:maxCardinality="1"
73
+ rdfs:label="sponsoredBy">
74
+ <rdfs:domain rdf:resource="&kb;Client"/>
75
+ <rdfs:range rdf:resource="&kb;ClientFidelise"/>
76
+ </rdf:Property>
71
77
  </rdf:RDF>
@@ -1,46 +1,68 @@
1
- require "ontomde-core"
2
-
3
- #module Mmtk_Profil::FT2006_GesCli
4
- module Mrdf_Resource
5
- def disp
6
- return ""
7
- end
8
- end
9
- module Mkb_Client
10
- def disp
11
- return <<FIN
12
- ***************************************************
13
- ** Bonjour civ:#{kb_civilite}
14
- ** nom:#{kb_nom}
15
- ** prenom:#{kb_prenom}
16
- FIN
17
- end
18
- end
19
- module Mkb_ClientFidelise
20
- def disp
21
- super+<<FIN
22
- ** Vous avez:#{kb_nombrePointDeFidelite} points !
23
- FIN
24
- end
25
- end
26
- module Mkb_ClientNonFidelise
27
- def disp
28
- super+<<FIN
29
- ** Vous ne beneficiez pas ENCORE de notre programme de fidelisation.
30
- FIN
31
- end
32
- end
33
- #end
34
-
35
- DATADIR=File.dirname(__FILE__)
36
-
37
- @@model=Crdf_Model.new
38
- @@model.loadMetaModelFromFile("#{DATADIR}/etatCivil.rdfs",true)
39
- @@model.loadModelFromFile("#{DATADIR}/etatCivil.rdf",true)
40
-
41
- puts "+++++++++++++++++++++++++++++++++"
42
- @@model.each { |k,c|
43
- print c.disp
44
- }
45
- puts "++++++++++++++++++++"
46
-
1
+ require "ontomde-core"
2
+
3
+ #module Mmtk_Profil::FT2006_GesCli
4
+ module Mrdf_Resource
5
+ def disp
6
+ return ""
7
+ end
8
+ end
9
+ module Mkb_Client
10
+ def disp
11
+ return <<FIN
12
+ ***************************************************
13
+ ** Bonjour civ:#{kb_civilite}
14
+ ** nom:#{kb_nom}
15
+ ** prenom:#{kb_prenom}#{%{
16
+ ** sponsored by:#{kb_sponsoredBy_one.kb_nom}} unless kb_sponsoredBy.empty? }
17
+ FIN
18
+ end
19
+ end
20
+ module Mkb_ClientFidelise
21
+ def disp
22
+ super+<<FIN
23
+ ** Vous avez:#{kb_nombrePointDeFidelite} points !
24
+ FIN
25
+ end
26
+ end
27
+ module Mkb_ClientNonFidelise
28
+ def disp
29
+ super+<<FIN
30
+ ** Vous ne beneficiez pas ENCORE de notre programme de fidelisation.
31
+ FIN
32
+ end
33
+ end
34
+ #end
35
+
36
+ DATADIR=File.dirname(__FILE__)
37
+
38
+ # load meta-model from file
39
+ model=Crdf_Model.new
40
+ model.loadMetaModelFromFile("#{DATADIR}/etatCivil.rdfs",true)
41
+
42
+ # load model from file
43
+ model.loadModelFromFile("#{DATADIR}/etatCivil.rdf",true)
44
+
45
+ # create additional model element from file
46
+ dubois=Ckb_ClientNonFidelise.new(model,"1233")
47
+ dubois.kb_nom="Dubois"
48
+
49
+ martin=Ckb_ClientFidelise.new(model,"1234")
50
+ #martin.kb_civilite=
51
+ martin.kb_nom="Martin"
52
+ martin.kb_prenom="Jean"
53
+ martin.kb_nombrePointDeFidelite="1000"
54
+ martin.kb_sponsoredBy=martin
55
+
56
+ begin
57
+ martin.kb_sponsoredBy=dubois
58
+ rescue Exception => e
59
+ #dubois does not have correct type
60
+ end
61
+
62
+
63
+ puts "+++++++++++++++++++++++++++++++++"
64
+ model.each { |k,c|
65
+ print c.disp
66
+ }
67
+ puts "++++++++++++++++++++"
68
+
data/test/test_context.rb CHANGED
@@ -1,88 +1,88 @@
1
- require 'test/unit'
2
- require 'ontomde-core'
3
-
4
-
5
- class TC_context_tc1 < Test::Unit::TestCase
6
- def setup
7
- @@model=Crdf_Model.new
8
- end
9
-
10
- def test_context_sur_resource
11
- res=@@model['rdf_Resource']
12
- assert(res.context.get(:build).nil?)
13
- res.mtk_context( :build=>"c:/tmp") {
14
- #log.debug "build=#{res.context[:build]}"
15
- assert(res.context[:build]=='c:/tmp')
16
- }
17
- assert(res.context.get(:build).nil?)
18
- assert(res.context.get(:anything).nil?)
19
- end
20
-
21
- def test_ajout_retrait_context_vide
22
- assert(@@model.context.get(:build).nil?)
23
- @@model.mtk_context( :build=>"c:/tmp") {
24
- #log.debug "build=#{@@model.context[:build]}"
25
- assert(@@model.context[:build]=='c:/tmp')
26
- }
27
- assert(@@model.context.get(:build).nil?)
28
- assert(@@model.context.get(:anything).nil?)
29
- end
30
-
31
- def test_redefinition
32
- assert(@@model.context.get(:build).nil?)
33
- test_done=false
34
- @@model.mtk_context( :build=>"c:/tmp") {
35
- #log.debug "build=#{@@model.context[:build]}"
36
- assert(!@@model.context.get(:build).nil?)
37
- assert(@@model.context[:build]=='c:/tmp')
38
- @@model.mtk_context( :build=>"h:/Z") {
39
- assert(@@model.context[:build]=='h:/Z')
40
- test_done=true
41
- }
42
- assert(@@model.context[:build]=='c:/tmp')
43
- }
44
- assert(@@model.context.get(:build).nil?)
45
- assert(test_done,"Test non execute")
46
- end
47
-
48
- def test_multiple_context
49
- assert(@@model.context.get(:build).nil?)
50
- assert(@@model.context.get(:lang).nil?)
51
- test_done=false
52
- @@model.mtk_context(:build=>"d:/tmp",:lang=>"fr",:opt=>1) {
53
- assert(!@@model.context.get(:build).nil?)
54
- assert(@@model.context.get(:build)==="d:/tmp")
55
- assert(@@model.context.get(:lang)=="fr")
56
- assert(@@model.context.get(:opt)==1)
57
- @@model.mtk_context(:lang=>"en") {
58
- assert(@@model.context[:build]=="d:/tmp")
59
- assert(@@model.context[:lang]=="en")
60
- assert(@@model.context[:opt]==1)
61
- @@model.mtk_context(:lang=>"us",:ww2=>1939) {
62
- assert(@@model.context[:build]=="d:/tmp")
63
- assert(@@model.context[:lang]=="us")
64
- assert(@@model.context[:opt]==1)
65
- assert(@@model.context[:ww2]==1939)
66
- test_done=true
67
- }
68
- assert(@@model.context[:build]=="d:/tmp")
69
- assert(@@model.context[:lang]=="en")
70
- assert(@@model.context[:opt]==1)
71
- }
72
- }
73
-
74
- assert(@@model.context.get(:build).nil?)
75
- assert(@@model.context.get(:lang).nil?)
76
- assert(test_done,"Test non execute")
77
- end
78
-
79
-
80
-
81
- def test_load_simple
82
- end
83
-
84
-
85
- end
86
-
87
- require 'test/unit/ui/console/testrunner'
88
- Test::Unit::UI::Console::TestRunner.run(TC_context_tc1)
1
+ require 'test/unit'
2
+ require 'ontomde-core'
3
+
4
+
5
+ class TC_context_tc1 < Test::Unit::TestCase
6
+ def setup
7
+ @@model=Crdf_Model.new
8
+ end
9
+
10
+ def test_context_sur_resource
11
+ res=@@model['rdf_Resource']
12
+ assert(res.context.get(:build).nil?)
13
+ res.mtk_context( :build=>"c:/tmp") {
14
+ #log.debug "build=#{res.context[:build]}"
15
+ assert(res.context[:build]=='c:/tmp')
16
+ }
17
+ assert(res.context.get(:build).nil?)
18
+ assert(res.context.get(:anything).nil?)
19
+ end
20
+
21
+ def test_ajout_retrait_context_vide
22
+ assert(@@model.context.get(:build).nil?)
23
+ @@model.mtk_context( :build=>"c:/tmp") {
24
+ #log.debug "build=#{@@model.context[:build]}"
25
+ assert(@@model.context[:build]=='c:/tmp')
26
+ }
27
+ assert(@@model.context.get(:build).nil?)
28
+ assert(@@model.context.get(:anything).nil?)
29
+ end
30
+
31
+ def test_redefinition
32
+ assert(@@model.context.get(:build).nil?)
33
+ test_done=false
34
+ @@model.mtk_context( :build=>"c:/tmp") {
35
+ #log.debug "build=#{@@model.context[:build]}"
36
+ assert(!@@model.context.get(:build).nil?)
37
+ assert(@@model.context[:build]=='c:/tmp')
38
+ @@model.mtk_context( :build=>"h:/Z") {
39
+ assert(@@model.context[:build]=='h:/Z')
40
+ test_done=true
41
+ }
42
+ assert(@@model.context[:build]=='c:/tmp')
43
+ }
44
+ assert(@@model.context.get(:build).nil?)
45
+ assert(test_done,"Test non execute")
46
+ end
47
+
48
+ def test_multiple_context
49
+ assert(@@model.context.get(:build).nil?)
50
+ assert(@@model.context.get(:lang).nil?)
51
+ test_done=false
52
+ @@model.mtk_context(:build=>"d:/tmp",:lang=>"fr",:opt=>1) {
53
+ assert(!@@model.context.get(:build).nil?)
54
+ assert(@@model.context.get(:build)==="d:/tmp")
55
+ assert(@@model.context.get(:lang)=="fr")
56
+ assert(@@model.context.get(:opt)==1)
57
+ @@model.mtk_context(:lang=>"en") {
58
+ assert(@@model.context[:build]=="d:/tmp")
59
+ assert(@@model.context[:lang]=="en")
60
+ assert(@@model.context[:opt]==1)
61
+ @@model.mtk_context(:lang=>"us",:ww2=>1939) {
62
+ assert(@@model.context[:build]=="d:/tmp")
63
+ assert(@@model.context[:lang]=="us")
64
+ assert(@@model.context[:opt]==1)
65
+ assert(@@model.context[:ww2]==1939)
66
+ test_done=true
67
+ }
68
+ assert(@@model.context[:build]=="d:/tmp")
69
+ assert(@@model.context[:lang]=="en")
70
+ assert(@@model.context[:opt]==1)
71
+ }
72
+ }
73
+
74
+ assert(@@model.context.get(:build).nil?)
75
+ assert(@@model.context.get(:lang).nil?)
76
+ assert(test_done,"Test non execute")
77
+ end
78
+
79
+
80
+
81
+ def test_load_simple
82
+ end
83
+
84
+
85
+ end
86
+
87
+ require 'test/unit/ui/console/testrunner'
88
+ Test::Unit::UI::Console::TestRunner.run(TC_context_tc1)
@@ -1,9 +1,9 @@
1
-
2
- require 'ontomde-core'
3
-
4
- puts "begin test logs"
5
- log.error("test log error")
6
- log.warn("test log warn")
7
- log.info("test log info")
8
- log.debug("test log debug")
9
- puts "end test logs"
1
+
2
+ require 'ontomde-core'
3
+
4
+ puts "begin test logs"
5
+ log.error("test log error")
6
+ log.warn("test log warn")
7
+ log.info("test log info")
8
+ log.debug("test log debug")
9
+ puts "end test logs"