Abstract |
---|
A multi-lingual knowledge matrix having knowledge packets represents mutually-exclusive knowledge at high level of abstraction. One aspect of the innovation is a method for encapsulating multi-lingual knowledge packets of an element and its components in a multi-lingual knowledge matrix having a plurality of dimensions. Another aspect of the innovation is a multi-lingual system having language-independent algorithms to compile knowledge packets by a correct-by-construction matrix operation. The knowledge matrix compiler comprises a language processor which separates languages, and a knowledge packet parser which processes knowledge by concatenating lines, sorting lines, removing duplicates, and parsing selectively. |
------------------------------------------------------------------------ [Element|Élément]Components|Composants ------------------------------------------------------------------------ Component (Subject)|Composant (Sujet)
Properties|Propriétés * Verb:|Verbe: * Complement|Complément ------------------------------------------------------------------------
------------------------------------------------------------------------ [Element|Élément]= [Property.1|Propriété.1 Property.1|Propriété.1] * [Component.1|Composant.1] [Property.2|Propriété.2 Property.2|Propriété.2] [Component.2|Composant.2] ------------------------------------------------------------------------
------------------------------------------------------------------------ [Element]= [(Property.1 * Component.1) + (Property.1 * Component.2)] [(Property.2 * Component.1) + (Property.2 * Component.2)] ------------------------------------------------------------------------ [Élément]
= [(Propriété.1 * Composant.1) + (Propriété.1 * Composant.2)] [(Propriété.2 * Composant.1) + (Propriété.2 * Composant.2)] ------------------------------------------------------------------------
------------------------------------------------------------------------ [Garlic|Ail]Components|Composants * Ajoene|Ajoene * Allicin|Allicin * SAC|SAC
General|Générales * Is:|Est: * an allium family vegetable|un légume de la famille de l'allium ------------------------------------------------------------------------
------------------------------------------------------------------------ Ajoene|AjoeneHelpful|Utiles * Inhibits:|Empêche: * clotting of blood|la coagulation du sang * Prevents:|Prévient: * heart attack|attaque * stroke|crise cardiaque ------------------------------------------------------------------------ Allicin|Allicin
Helpful|Utiles * Inhibits:|Empêche: * clotting of blood|la coagulation du sang * Lowers:|S'abaisse: * level of blood cholesterol|niveau de cholestérol dans le sang * level of blood pressure|niveau de tension artérielle * Prevents:|Prévient: * infection|infection ------------------------------------------------------------------------
------------------------------------------------------------------------ [Garlic|Ail]= [General|Générales General|Générales General|Générales] * [Ajoene|Ajoene ] [Helpful|Utiles Helpful|Utiles Helpful|Utiles ] [Allicin|Allicin] [Harmful|Nocives Harmful|Nocives Harmful|Nocives ] [SAC|SAC ] ------------------------------------------------------------------------
------------------------------------------------------------------------ [Garlic]= [(General * Ajoene) + (General * Allicin) + (General * SAC)] [(Helpful * Ajoene) + (Helpful * Allicin) + (Helpful * SAC)] [(Harmful * Ajoene) + (Harmful * Allicin) + (Harmful * SAC)] ------------------------------------------------------------------------ [Ail]
= [(Générales * Ajoene) + (Générales * Allicin) + (Générales * SAC)] [(Utiles * Ajoene) + (Utiles * Allicin) + (Utiles * SAC)] [(Nocives * Ajoene) + (Nocives * Allicin) + (Nocives * SAC)] ------------------------------------------------------------------------
------------------------------------------------------------------------ [Garlic]This Element contains the following Components: * Ajoene * Allicin * SAC
General Properties of the Components: * Is: * an allium family vegetable
Helpful Properties of the Components: * Inhibits clotting of blood. * Lowers: * level of blood cholesterol * level of blood pressure * Prevents: * heart attack * infection * stroke ------------------------------------------------------------------------ [Ail]
Cet Élément contient les Composants suivants: * Ajoene * Allicin * SAC
Propriétés Générales des Composants: * Est: * un légume de la famille de l'allium
Propriétés Utiles des Composants: * Empêche la coagulation du sang. * Prévient: * attaque * crise cardiaque * infection * S'abaisse: * niveau de cholestérol dans le sang * niveau de tension artérielle ------------------------------------------------------------------------
------------------------------------------------------------------------ function knowledgeMatrix n,theLanguage set the cursor to "busy" put "" into theTitle put "" into theGeneral put "" into theHelpful put "" into theHarmful put "" into theScript if (there is a cd n) then put the itemDelimiter into oldDelimiter -- -- Collect Components used in an Element, Collect Properties -- if (bg fld "General" of cd n <> "") then put (bg fld "General" of cd n) & return after theGeneral end if if (bg fld "Helpful" of cd n <> "") then put (bg fld "Helpful" of cd n) & return after theHelpful end if if (bg fld "Harmful" of cd n <> "") then put (bg fld "Harmful" of cd n) & return after theHarmful end if repeat with i = 1 to the number of lines of bg fld "Contents" of cd n put line i of bg fld "Contents" of cd n into o if (there is a cd o) then if ((first char of the short name of cd o <> "{") or (last char of the short name of cd o <> "}")) then put (bg fld "Title" of cd o) & return after theTitle end if if (bg fld "General" of cd o <> "") then put (bg fld "General" of cd o) & return after theGeneral end if if (bg fld "Helpful" of cd o <> "") then put (bg fld "Helpful" of cd o) & return after theHelpful end if if (bg fld "Harmful" of cd o <> "") then put (bg fld "Harmful" of cd o) & return after theHarmful end if repeat with j = 1 to the number of lines of bg fld "Contents" of cd o put line j of bg fld "Contents" of cd o into p if (there is a cd p) then if ((first char of the short name of cd p <> "{") or (last char of the short name of cd p <> "}")) then put (bg fld "Title" of cd p) & return after theTitle end if if (bg fld "General" of cd p <> "") then put (bg fld "General" of cd p) & return after theGeneral end if if (bg fld "Helpful" of cd p <> "") then put (bg fld "Helpful" of cd p) & return after theHelpful end if if (bg fld "Harmful" of cd p <> "") then put (bg fld "Harmful" of cd p) & return after theHarmful end if repeat with k = 1 to the number of lines of bg fld "Contents" of cd p put line k of bg fld "Contents" of cd p into q if (there is a cd q) then if ((first char of the short name of cd q <> "{") or (last char of the short name of cd q <> "}")) then put (bg fld "Title" of cd q) & return after theTitle end if if (bg fld "General" of cd q <> "") then put (bg fld "General" of cd q) & return after theGeneral end if if (bg fld "Helpful" of cd q <> "") then put (bg fld "Helpful" of cd q) & return after theHelpful end if if (bg fld "Harmful" of cd q <> "") then put (bg fld "Harmful" of cd q) & return after theHarmful end if end if end repeat end if end repeat end if end repeat -- -- Collect Elements used by a Component -- if ((first char of the short name of cd n <> "[") or (last char of the short name of cd n <> "]")) then repeat with i = 3 to the number of cds if (return & (bg fld "Title" of cd n) & return is in return & (bg fld "Contents" of cd i) & return) then if ((first char of the short name of cd i = "{") and (last char of the short name of cd i = "}")) then repeat with j = 3 to the number of cds if (return & (bg fld "Title" of cd i) & return is in return & (bg fld "Contents" of cd j) & return) then put (bg fld "Title" of cd j) & return after theScript end if end repeat else put (bg fld "Title" of cd i) & return after theScript end if end if end repeat end if -- -- Filter Language, Parse Knowledge Packet and Present Output -- set the itemDelimiter to "|" put return into bg fld "Script" of cd n if (theTitle <> "") then put \ "This Elements contains the following Components:" & "|" & \ "Cet Élément contient les Composants suivants:" into theHeading put (item theLanguage of theHeading) & return & return & \ knowledgePacket(theTitle,theLanguage) & return & \ "------------------------------------------------------------------------" & return & return after bg fld "Script" of cd n end if if (theGeneral <> "") then put \ "General Properties of the Components:" & "|" & \ "Propriétés Générales des Composants:" into theHeading put (item theLanguage of theHeading) & return & return & \ knowledgePacket(theGeneral,theLanguage) & return & \ "------------------------------------------------------------------------" & return & return after bg fld "Script" of cd n end if if (theHelpful <> "") then put \ "Helpful Properties of the Components:" & "|" & \ "Propriétés Utiles des Composants:" into theHeading put (item theLanguage of theHeading) & return & return & \ knowledgePacket(theHelpful,theLanguage) & return & \ "------------------------------------------------------------------------" & return & return after bg fld "Script" of cd n end if if (theHarmful <> "") then put \ "Harmful Properties of the Components:" & "|" & \ "Propriétés Nocif des Composants:" into theHeading put (item theLanguage of theHeading) & return & return & \ knowledgePacket(theHarmful,theLanguage) & return & \ "------------------------------------------------------------------------" & return & return after bg fld "Script" of cd n end if if (theScript <> "") then put \ "This Component is contained in the following Elements:" & "|" & \ "Cet Composant est contenu dans les Éléments suivants:" into theHeading put (item theLanguage of theHeading) & return & return & \ knowledgePacket(theScript,theLanguage) & return & \ "------------------------------------------------------------------------" & return & return after bg fld "Script" of cd n end if repeat with i = 1 to the number of lines of bg fld "Script" of cd n if (char 1 of line i of bg fld "Script" of cd n = "-") then set the textSize of line i of bg fld "Script" of cd n to "10" set the textStyle of line i of bg fld "Script" of cd n to "plain" else if (char 1 of line i of bg fld "Script" of cd n = "¥") then set the textSize of line i of bg fld "Script" of cd n to "10" set the textStyle of line i of bg fld "Script" of cd n to "bold" else if (char 1 of line i of bg fld "Script" of cd n <> " ") then set the textSize of line i of bg fld "Script" of cd n to "12" set the textStyle of line i of bg fld "Script" of cd n to "bold" else set the textSize of line i of bg fld "Script" of cd n to "10" set the textStyle of line i of bg fld "Script" of cd n to "plain" end if end repeat -- set the itemDelimiter to oldDelimiter end if end knowledgeMatrix ------------------------------------------------------------------------
------------------------------------------------------------------------ * Inhibits:|Empêche: * clotting of blood|la coagulation du sang * Prevents:|Prévient: * heart attack|attaque * stroke|crise cardiaque * Inhibits:|Empêche: * clotting of blood|la coagulation du sang * Lowers:|S'abaisse: * level of blood cholesterol|niveau de cholestérol dans le sang * level of blood pressure|niveau de tension artérielle * Prevents:|Prévient: * infection|infection ------------------------------------------------------------------------
------------------------------------------------------------------------ * Inhibits: * clotting of blood * Prevents: * heart attack * stroke * Inhibits: * clotting of blood * Lowers: * level of blood cholesterol * level of blood pressure * Prevents: * infection ------------------------------------------------------------------------ * Empêche: * la coagulation du sang * Prévient: * attaque * crise cardiaque * Empêche: * la coagulation du sang * S'abaisse: * niveau de cholestérol dans le sang * niveau de tension artérielle * Prévient: * infection ------------------------------------------------------------------------
------------------------------------------------------------------------ * Inhibits:clotting of blood * Prevents:heart attack * Prevents:stroke * Inhibits:clotting of blood * Lowers:level of blood cholesterol * Lowers:level of blood pressure * Prevents:infection ------------------------------------------------------------------------ * Empêche:la coagulation du sang * Prévient:attaque * Prévient:crise cardiaque * Empêche:la coagulation du sang * S'abaisse:niveau de cholestérol dans le sang * S'abaisse:niveau de tension artérielle * Prévient:infection ------------------------------------------------------------------------
------------------------------------------------------------------------ * Inhibits:clotting of blood * Inhibits:clotting of blood * Lowers:level of blood cholesterol * Lowers:level of blood pressure * Prevents:heart attack * Prevents:infection * Prevents:stroke ------------------------------------------------------------------------ * Empêche:la coagulation du sang * Empêche:la coagulation du sang * Prévient:attaque * Prévient:crise cardiaque * Prévient:infection * S'abaisse:niveau de cholestérol dans le sang * S'abaisse:niveau de tension artérielle ------------------------------------------------------------------------
------------------------------------------------------------------------ * Inhibits:clotting of blood * Lowers:level of blood cholesterol * Lowers:level of blood pressure * Prevents:heart attack * Prevents:infection * Prevents:stroke ------------------------------------------------------------------------ * Empêche:la coagulation du sang * Prévient:attaque * Prévient:crise cardiaque * Prévient:infection * S'abaisse:niveau de cholestérol dans le sang * S'abaisse:niveau de tension artérielle ------------------------------------------------------------------------
------------------------------------------------------------------------ * Inhibits clotting of blood. * Lowers: * level of blood cholesterol * level of blood pressure * Prevents: * heart attack * infection * stroke ------------------------------------------------------------------------ * Empêche: * la coagulation du sang * Prévient: * attaque * crise cardiaque * infection * S'abaisse: * niveau de cholestérol dans le sang * niveau de tension artérielle ------------------------------------------------------------------------
------------------------------------------------------------------------ function knowledgePacket theMulti,theLanguage put "" into theText if (theMulti <> "") then put the itemDelimiter into oldDelimiter -- -- Separate Languages -- set the itemDelimiter to "|" put "" into theUni repeat with i = 1 to the number of lines of theMulti put line i of theMulti into theLine if (char 1 to 2 of theLine = "¥ ") then put (char 3 to (the number of chars of theLine) of theLine) into theLine put "¥ " & (item theLanguage of theLine) & return after theUni else if (char 1 to 4 of theLine = " ¥ ") then put (char 5 to (the number of chars of theLine) of theLine) into theLine put " ¥ " & (item theLanguage of theLine) & return after theUni else if (("[" is in theLine) and ("]" is in theLine)) then delete first char of theLine delete last char of theLine put "¥ [" & (item theLanguage of theLine) & "]" & return after theUni else if (theLine <> "") then put "¥ " & (item theLanguage of theLine) & return after theUni end if end repeat -- -- Concatenate Lines with ":" -- set the itemDelimiter to ":" put "" into theSort repeat with i = 1 to the number of lines of theUni put line i of theUni into theI if (theI <> "") then if (":" is in theI) then put item 1 of theI into the1 else if (char 1 of theI = " ") then put the1 & ":" & theI into theI end if put theI & return after theSort end if end if end repeat -- -- Sort Lines, Remove Duplicates, Parse Selectively with ":" or "." -- sort theSort ascending international repeat with i = 1 to the number of lines of theSort put line i of theSort into theI put line (i + 1) of theSort into theJ if (theI <> theJ) then if (":" is in theI) then put item 1 of theI into the1 put item 1 of theJ into the2 if ((the1 <> the0) and (the1 <> the2)) then put (item 1 of theI) & " " & (char 5 to (the number of chars of item 2 of theI) of (item 2 of theI)) & "." & return after theText else if ((the1 <> the0) and (the1 = the2)) then put the1 into the0 put (item 1 of theI) & ":" & return after theText put (item 2 of theI) & return after theText else put (item 2 of theI) & return after theText end if else put theI & return after theText end if end if end repeat -- set the itemDelimiter to oldDelimiter end if return theText end knowledgePacket ------------------------------------------------------------------------