2018-08-18 12:44:39 +00:00
|
|
|
theory Attributes
|
|
|
|
imports "../../ontologies/Conceptual"
|
|
|
|
begin
|
|
|
|
|
2018-08-24 19:57:16 +00:00
|
|
|
section\<open>Elementary Creation of DocItems and Access of their Attibutes\<close>
|
|
|
|
|
|
|
|
text\<open>Current status:\<close>
|
2018-08-19 08:17:17 +00:00
|
|
|
print_doc_classes
|
|
|
|
print_doc_items
|
|
|
|
|
2018-08-24 13:49:13 +00:00
|
|
|
(* corresponds to low-level accesses : *)
|
2018-08-18 12:44:39 +00:00
|
|
|
ML\<open>
|
2018-09-03 19:32:13 +00:00
|
|
|
val ({tab = x, ...},y,_)= DOF_core.get_data @{context};
|
2018-08-20 09:36:04 +00:00
|
|
|
Symtab.dest x;
|
2018-08-24 13:49:13 +00:00
|
|
|
"==============================================";
|
2018-08-18 12:44:39 +00:00
|
|
|
Symtab.dest y;
|
|
|
|
\<close>
|
2018-08-24 13:49:13 +00:00
|
|
|
|
|
|
|
text*[dfgdfg::B, Conceptual.B.x ="''f''", y = "[''sdf'']"]\<open> sdfsdfs sdfsdf sdfsdf @{thm refl} \<close>
|
|
|
|
|
|
|
|
typ "C"
|
2018-08-24 14:58:06 +00:00
|
|
|
typ "D"
|
|
|
|
ML\<open>val Type("Conceptual.B.B_ext",[Type("Conceptual.C.C_ext",t)]) = @{typ "C"};
|
|
|
|
val @{typ "D"} = ODL_Command_Parser.cid_2_cidType "Conceptual.D" @{theory};
|
|
|
|
val @{typ "E"}= ODL_Command_Parser.cid_2_cidType "Conceptual.E" @{theory};
|
|
|
|
\<close>
|
|
|
|
|
2018-08-24 13:49:13 +00:00
|
|
|
text*[dfgdfg2::C, z = "None"]\<open> sdfsdfs sdfsdf sdfsdf @{thm refl} \<close>
|
|
|
|
|
2018-08-24 19:57:16 +00:00
|
|
|
text*[omega::E, x = "''def''"]\<open> sdfsdfs sdfsdf sdfsdf @{thm refl} \<close>
|
2018-08-24 13:49:13 +00:00
|
|
|
|
|
|
|
text\<open> @{docitem_ref \<open>dfgdfg\<close>} \<close>
|
|
|
|
|
|
|
|
|
2018-08-20 09:36:04 +00:00
|
|
|
term "A.x (undefined\<lparr>A.x := 3\<rparr>)"
|
|
|
|
term "B.x ((undefined::C)\<lparr>B.y := [''sdf'']\<rparr>)"
|
2018-08-24 14:58:06 +00:00
|
|
|
term "C.z ((undefined::C)\<lparr>B.y := [''sdf''], z:= Some undefined\<rparr>)"
|
2018-08-20 09:36:04 +00:00
|
|
|
|
|
|
|
ML\<open>
|
2018-08-22 20:06:15 +00:00
|
|
|
val SOME {def_occurrence = "Conceptual.A", long_name = "Conceptual.A.x", typ = t, def_pos}
|
2018-08-20 11:54:53 +00:00
|
|
|
= DOF_core.get_attribute_info "Conceptual.A" "x" @{theory};
|
|
|
|
DOF_core.get_attribute_info "Conceptual.B" "x" @{theory};
|
|
|
|
DOF_core.get_attribute_info "Conceptual.B" "y" @{theory};
|
|
|
|
DOF_core.get_attribute_info "Conceptual.C" "x" @{theory};
|
2018-08-22 20:06:15 +00:00
|
|
|
val SOME {def_occurrence = "Conceptual.C", long_name = "Conceptual.B.y", typ = t', def_pos}
|
2018-08-20 11:54:53 +00:00
|
|
|
= DOF_core.get_attribute_info "Conceptual.C" "y" @{theory};
|
|
|
|
(* this is the situation where an attribute is defined in C, but due to inheritance
|
|
|
|
from B, where it is firstly declared which results in a different long_name. *)
|
|
|
|
DOF_core.get_attribute_info "Conceptual.C" "z" @{theory};
|
2018-08-20 09:36:04 +00:00
|
|
|
\<close>
|
|
|
|
|
2018-08-20 11:54:53 +00:00
|
|
|
|
2018-08-20 09:36:04 +00:00
|
|
|
ML\<open>
|
|
|
|
DOF_core.get_value_local "sdf" @{context};
|
|
|
|
DOF_core.get_value_local "sdfg" @{context};
|
|
|
|
DOF_core.get_value_local "xxxy" @{context};
|
|
|
|
DOF_core.get_value_local "dfgdfg" @{context};
|
2018-08-24 14:58:06 +00:00
|
|
|
DOF_core.get_value_local "omega" @{context};
|
2018-08-20 09:36:04 +00:00
|
|
|
\<close>
|
|
|
|
|
2018-08-24 14:58:06 +00:00
|
|
|
text\<open>A not too trivial test: default y -> [].
|
2018-08-24 13:49:13 +00:00
|
|
|
At creation : x -> "f", y -> "sdf".
|
2018-08-24 14:58:06 +00:00
|
|
|
The latter wins at access time.
|
|
|
|
Then @{term "t"}: creation of a multi inheritance object omega,
|
|
|
|
triple updates, the last one wins.\<close>
|
|
|
|
ML\<open>val s = map HOLogic.dest_string (HOLogic.dest_list @{docitem_attr y::dfgdfg});
|
2018-08-24 19:57:16 +00:00
|
|
|
val t = HOLogic.dest_string (@{docitem_attr x::omega}); \<close>
|
2018-08-18 12:44:39 +00:00
|
|
|
|
2018-08-20 18:29:04 +00:00
|
|
|
|
2018-08-22 20:06:15 +00:00
|
|
|
|
|
|
|
|
2018-08-24 19:57:16 +00:00
|
|
|
section\<open>Mutation of Attibutes in DocItems\<close>
|
2018-08-24 13:49:13 +00:00
|
|
|
|
2018-08-24 19:57:16 +00:00
|
|
|
ML\<open> val Const ("Groups.zero_class.zero", @{typ "int"}) = @{docitem_attr a2::omega} \<close>
|
|
|
|
|
|
|
|
update_instance*[omega::E, a2+="1"]
|
2018-08-22 20:06:15 +00:00
|
|
|
|
2018-08-24 19:57:16 +00:00
|
|
|
ML\<open> val Const ("Groups.one_class.one", @{typ "int"})= @{docitem_attr a2::omega} \<close>
|
2018-08-23 09:46:20 +00:00
|
|
|
|
2018-08-24 19:57:16 +00:00
|
|
|
update_instance*[omega::E, a2+="6"]
|
2018-08-23 09:46:20 +00:00
|
|
|
|
2018-08-24 19:57:16 +00:00
|
|
|
ML\<open> @{docitem_attr a2::omega} \<close>
|
|
|
|
ML\<open> HOLogic.dest_number @{docitem_attr a2::omega} \<close>
|
|
|
|
|
|
|
|
update_instance*[omega::E, x+="''inition''"]
|
|
|
|
|
|
|
|
ML\<open> val s = HOLogic.dest_string ( @{docitem_attr x::omega}) \<close>
|
2018-08-27 12:39:34 +00:00
|
|
|
|
2018-08-24 19:57:16 +00:00
|
|
|
update_instance*[omega::E, y+="[''defini'',''tion'']"]
|
|
|
|
|
|
|
|
update_instance*[omega::E, y+="[''en'']"]
|
|
|
|
|
2018-08-28 10:48:07 +00:00
|
|
|
ML\<open> val s = map HOLogic.dest_string (HOLogic.dest_list @{docitem_attr y::omega}); \<close>
|
|
|
|
|
2018-08-27 12:39:34 +00:00
|
|
|
section\<open>Simulation of a Monitor\<close>
|
|
|
|
|
2018-08-28 10:48:07 +00:00
|
|
|
open_monitor*[figs1::figure_group,
|
2018-08-27 12:39:34 +00:00
|
|
|
anchor="''fig-demo''",
|
|
|
|
caption="''Sample ''"]
|
|
|
|
|
|
|
|
figure*[fig_A::figure, spawn_columns=False,relative_width="''90''",
|
|
|
|
src="''figures/A.png''"]
|
|
|
|
\<open> The A train \ldots \<close>
|
2018-08-28 15:35:52 +00:00
|
|
|
update_instance*[figs1::figure_group, trace+="[figure]"](* simulation : will disappear *)
|
2018-08-27 12:39:34 +00:00
|
|
|
|
|
|
|
figure*[fig_B::figure, spawn_columns=False,relative_width="''90''",
|
|
|
|
src="''figures/B.png''"]
|
|
|
|
\<open> The B train \ldots \<close>
|
2018-08-28 15:35:52 +00:00
|
|
|
update_instance*[figs1::figure_group, trace+="[figure]"](* simulation : will disappear *)
|
2018-08-27 12:39:34 +00:00
|
|
|
|
|
|
|
close_monitor*[fig1]
|
|
|
|
|
2018-08-28 10:48:07 +00:00
|
|
|
ML\<open> map (fn Const(s,_) => s) (HOLogic.dest_list @{docitem_attr trace::figs1}) \<close>
|
2018-08-27 12:39:34 +00:00
|
|
|
|
2018-08-28 10:48:07 +00:00
|
|
|
print_doc_items
|
2018-08-27 12:39:34 +00:00
|
|
|
|
2018-08-18 12:44:39 +00:00
|
|
|
end
|