-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathooasp_guess.lp
66 lines (53 loc) · 1.7 KB
/
ooasp_guess.lp
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
% Copyright (c) 2024 Siemens AG Oesterreich
% SPDX-License-Identifier: MIT
#program include(new_object, cls).
% Include for performance
ooasp_isa(cls,new_object).
% Fact used in the UI to identify objects that must be included
ooasp_must_be_included(cls,new_object).
% Has to have a leaf class assigned
:- not ooasp_leafclass(LEAFCLASS):
ooasp_subclass_ref(LEAFCLASS,cls).
#program domain(new_object, cls).
% If an object has a domain, then it could be instanciated
{ ooasp_isa_leaf(LEAFCLASS,new_object):
ooasp_leafclass(LEAFCLASS),
ooasp_subclass_ref(LEAFCLASS,C) } 1:-
ooasp_domain(C,new_object),
guess.
% If is_a appears then it has to be instanciated as leaf
1{ ooasp_isa_leaf(LEAFCLASS,new_object):
ooasp_leafclass(LEAFCLASS),
ooasp_subclass_ref(LEAFCLASS,C) } 1:-
ooasp_isa(C,new_object),
guess.
% % Associations from new_object
{ ooasp_associated(ASSOC,new_object,ID2) } :-
potential_assoc(ASSOC,new_object,ID2,_,_),
guess.
potential_assoc(ASSOC,new_object,ID2,C1,C2):-
ooasp_assoc(ASSOC,C1,C1MIN,C1MAX,C2,C2MIN,C2MAX),
ooasp_isa(C1,new_object),
ID2<new_object,
ooasp_isa(C2,ID2).
{ ooasp_associated(ASSOC,ID1,new_object)} :-
potential_assoc(ASSOC, ID1, new_object,_,_),
guess.
potential_assoc(ASSOC, ID1, new_object,C1,C2):-
ooasp_assoc(ASSOC,C1,C1MIN,C1MAX,C2,C2MIN,C2MAX),
ooasp_isa(C2,new_object),
ID1<new_object,
ooasp_isa(C1,ID1).
% Attributes
1 { ooasp_attr_value(A,new_object,V):
ooasp_attr_enum(C,A,V) } 1 :-
ooasp_isa(C,new_object),
ooasp_attr(C,A,T),
ooasp_attr_enum(C,A,_),
guess.
1 { ooasp_attr_value(A,new_object,V):V=MIN..MAX } 1:-
ooasp_attr(C,A,enumint),
ooasp_isa(C,new_object),
ooasp_attr_minInclusive(C,A,MIN),
ooasp_attr_maxInclusive(C,A,MAX),
guess.