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.
- data/History.txt +10 -5
- data/Manifest.txt +1 -2
- data/Manual.txt +88 -0
- data/README.txt +79 -48
- data/Rakefile +4 -3
- data/lib/ontomde-core/bootstrap_rdfs.rb +36 -37
- data/lib/ontomde-core/clone.rb +72 -73
- data/lib/ontomde-core/context.rb +114 -115
- data/lib/ontomde-core/customERB.rb +72 -72
- data/lib/ontomde-core/custom_method_missing.rb +52 -53
- data/lib/ontomde-core/delayed.rb +9 -9
- data/lib/ontomde-core/demoInstaller.rb +25 -25
- data/lib/ontomde-core/exceptions.rb +27 -28
- data/lib/ontomde-core/fileLoader.rb +191 -163
- data/lib/ontomde-core/fileTypes.rb +145 -133
- data/lib/ontomde-core/helper.rb +547 -538
- data/lib/ontomde-core/log.rb +32 -32
- data/lib/ontomde-core/meta.rb +410 -316
- data/lib/ontomde-core/profil.rb +60 -62
- data/lib/ontomde-core/resource.rb +277 -272
- data/lib/ontomde-core/resourceSet.rb +185 -173
- data/lib/ontomde-core/triplet.rb +159 -161
- data/lib/ontomde-core/version.rb +5 -5
- data/lib/ontomde-core.rb +26 -35
- data/test/protege/etatCivil.pprj +779 -526
- data/test/protege/etatCivil.rdf +3 -1
- data/test/protege/etatCivil.rdfs +6 -0
- data/test/protege/test_demo.rb +68 -46
- data/test/test_context.rb +88 -88
- data/test/test_ontomde-core.rb +9 -9
- data/test/test_protected.rb +291 -238
- data/test/test_uri.rb +37 -37
- data/test/unit_test_crash.rb +22 -22
- metadata +66 -59
- data/bin/ontomde-core +0 -0
- data/lib/ontomde-core/loader.rb +0 -70
data/test/protege/etatCivil.rdf
CHANGED
@@ -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>
|
data/test/protege/etatCivil.rdfs
CHANGED
@@ -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>
|
data/test/protege/test_demo.rb
CHANGED
@@ -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
|
-
|
17
|
-
|
18
|
-
end
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
end
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
end
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
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)
|
data/test/test_ontomde-core.rb
CHANGED
@@ -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"
|