ORE-private-repo / 5.1 Constraint extraction from Tables / 5.1.3 Approach for constraint extraction from tables / Code - Constraint extraction from tables .ipynb
Code - Constraint extraction from tables .ipynb
Raw
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Brief overview of the approach and key aspects "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "This algorithm helps to extract constraint information from tables and formulates them into rules in natural langugage representation. This experiment and the results obtained from extracting constraint information from tables is like an initial step which further helps in automating the constraint extraction process from entire industrial standard documents aimed in the later part of this research.\n",
    "- Firstly, all the tables from a PDF document are extracted as shown in Step 1\n",
    "- The next important step is to categorize the table-types that are targeted for this initial experiment and extract the constraint information from them, dealing with one tabletype at a time.\n",
    "- Hence, Step 2 and Step 3 occur simulatenously in such a way that whenever we need to segregate tables of a certain type and extract constraints from these segregated tables into rules, each time we perform this process on the list of all tables obtained from PDF in step 1.\n",
    "\n",
    "There are 10 table types chosen for this experiment and some of these chosen tabletypes are processed based on their structural differences and categorized as sub-types within the main type and extraction values are summed up at the end. This is a way to deal with inconsistencies in table structures to some extent and maximize the performance of code for extraction while making the code dynamically suitable to any new companion specification. This might still need many changes and additions which is a future work.\n",
    "\n",
    "Tables types and cases observed in each of them considered so far -\n",
    "- ObjectType TypeDefinition: have 9 (sub)types/cases  \n",
    "- ReferenceType TypeDefinition: have 3 types\n",
    "- MethodAddressSpace TypeDefinition: 2 types\n",
    "- DataType Structure: 3 types\n",
    "- Enumeration Type: 8 types\n",
    "- Method ResultCode Type: 2 types\n",
    "- Method Parameter Type: 1 type\n",
    "- Transition Type: 1 type\n",
    "- NamespaceType- NamespaceURI,NamespaceMetadata: 3 types\n",
    "- ProfileURI Type: 2 types\n",
    "\n",
    "\n",
    "\n",
    "Same process repeats whenever we are looking to extract a particular tabletype, hence the same logic repeats throughout the code. Only thing is the variables, lists of indicative and non-indicative strings for respective tabletypes, and few minor tabletype specific things change with repect to each tabletype and these changes are inclusive and dynamically adopted."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Importing necessary dependencies and packages:\n",
    "- Camelot is python package used for extracting tables out of pdf files\n",
    "- pandas is used to put extracted tables into dataframe format and deal with dataframes in the data\n",
    "- os provides operating system dependant functionality for the python code\n",
    "- numpy and matplotlib are the additional dependancies not exactly used here but might be of need\n",
    "- They deal with numerical data and plotting graphs and figures for analysis, respectively"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:03:43.838050Z",
     "start_time": "2021-08-04T07:03:42.521136Z"
    }
   },
   "outputs": [],
   "source": [
    "import camelot.io as camelot   \n",
    "import pandas as pd\n",
    "import os\n",
    "import matplotlib.pyplot as plt\n",
    "import numpy as np\n",
    "import csv\n",
    "from openpyxl import *\n",
    "import xlsxwriter\n",
    "import re\n",
    "from pandas import ExcelWriter"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Step 1 - Extracting the tables from PDF using camelot"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "filepath = \"C:\\\\Users\\\\Z0049YKJ\\\\OPC 40100-1 - UA Companion Specification Part 1 for Machine Vision 1.pdf\"\n",
    "\n",
    "#local file path from the saved location of file in PC"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:05:40.757973Z",
     "start_time": "2021-08-04T07:03:45.152150Z"
    }
   },
   "outputs": [],
   "source": [
    "tables = camelot.read_pdf(filepath,line_scale = 80, shift_text = [''], pages='all',kind = 'joint', lattice=True, suppress_stdout = True)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "- tables variable : with the help of camelot reads the imported pdf file with following parameters \n",
    "- filepath : str, Filepath or URL of the PDF file\n",
    "- line_scale : int, Line size scaling factor. The larger the value the smaller the detected lines. Making it very large will lead to text being detected as lines. Hence sometimes figures also get identifies as tables \n",
    "- shift_text : list, optional (default: ['l', 't']) {'l', 'r', 't', 'b'}, controls the direction in which text in a spanning    cell will flow.\n",
    "- pages : all , extracts tables from all pages\n",
    "- kind : joint , helps to detect and extract intersection points inside the tables\n",
    "- Lattice : used to parse tables that have demarcated lines between cells, and it can automatically parse multiple tables present on a page.\n",
    "- suppress_stdout : bool, optional (default: True), Print all logs and warnings"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "camelot.core.TableList"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(tables)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:06:41.386980Z",
     "start_time": "2021-08-04T07:06:41.380983Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Number of tables extracted from this companion specification : 322\n"
     ]
    }
   ],
   "source": [
    "print(\"Number of tables extracted from this companion specification :\",len(tables))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "- len(tables) - gives the count of number of tables (along with some figures due to line_scale as 80) detected and extracted out"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Observing each individual table that got extracted from PDF\n",
    "\n",
    "#for i in tables:\n",
    "    #print(i.df, \"\\n________________________________________________________________________________________________\\n\")\n",
    "    #prints all the extracted tables"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Extracting and forumlating constraints of ObjectType TypeDefintion tables"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#### Calling functions for defining ObjectType TypeDefinition table constraints "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "- Functions called to assign constraint statement templates to the values extracted out of table cells. Here the functions called are - \n",
    "- Args : \n",
    "1. Datatype_const(Datatype) - Datatype object gives datatype constraints\n",
    "2. Cardinality_existance(Other) - Other object gives modelling rule based constraints\n",
    "3. DomainRange(BrowseName=None) - BrowseName object gives domain-range constraints\n",
    "\n",
    "- Returns: \n",
    "1. Datatype constraint gives datatypes allowed for the Browsenames, based on the lexical templates  given below\n",
    "2. Modelling rule based constraints like cardinality and exsistence constraints or cardinality constraints, \n",
    "   Other is the other column name for modelling rule present in tables hence its defined with variable name other\n",
    "3. Domain-range constraint that gives Range of Browsenames allowed for a SourceNode with reference to its property"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:06:43.561120Z",
     "start_time": "2021-08-04T07:06:43.530442Z"
    }
   },
   "outputs": [],
   "source": [
    "def Datatype_const(Datatype):\n",
    "    if Datatype == \"DataType\" or Datatype == \"Data Type\" or Datatype == \"DataTy\\npe\" or Datatype == \"Datatype\":\n",
    "        return (\" \")\n",
    "    elif Datatype :             \n",
    "        return (\"The \"+ Sourcenode + \" \" + References + \" \" +  BrowseName + \" which should be of datatype \" + Datatype + \".\")\n",
    "    else:               \n",
    "        return (\"  \")          "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "- Sourcenode : is generally the main Node present usually in (1, 1) i.e., row index 1 and col index 1 of Type definition tables.These tables talk about the constraints that are allowed for this Sourcenode. It is present with the name BrowseName in table.\n",
    "- BrowseName : is the allowed target node to that particular Sourcenode. It is also present with the name Browsename in table but its usually in (3,2) i.e., row index 3 and column index 2, unlike Sourcenode\n",
    "- Datatype : is the allowed datatype value under Datatype column in these type definiton type tables that give the datatype of respective Browsename"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:06:44.191376Z",
     "start_time": "2021-08-04T07:06:44.175379Z"
    }
   },
   "outputs": [],
   "source": [
    "def Cardinality_existance(Other):  \n",
    "    \n",
    "    if Other == \"Other\" or Other == \"ModellingRule\" or Other == \"Modelling Rule\" or Other == \"Modelling-\\nRule\" or Other == \"Modelling\\nRule\" or Other == \"Modelling\\nRule\\nAccessLevel\" or Other == \"ModelingRule\":\n",
    "        \n",
    "        return (\"  \")\n",
    "    \n",
    "    elif Other.lower().strip() == \"mandatory\":\n",
    "        \n",
    "        return (\"The \"+ Sourcenode + \" \" + References + \" \" + BrowseName + \" \" + NodeClass + \" which is \" + Other + \".\")\n",
    "                        \n",
    "    elif Other.lower().strip() == \"optional\":\n",
    "                   \n",
    "        return (\"The \"+ Sourcenode + \" \" + References + \" \" + BrowseName + \" \" + NodeClass  + \" which is \" + Other + \".\")\n",
    "                    \n",
    "    elif Other == \"M, RO\":\n",
    "        \n",
    "        return (\"The \"+ Sourcenode + \" \" + References + \" \" + BrowseName + \" \" + NodeClass  + \" which is \" + Other + \". \"+ NodeClass +\" NodeClass is Read-Only. \")\n",
    "    elif Other == \"M\":\n",
    "        \n",
    "        return (\"The \"+ Sourcenode + \" \" + References + \" \" + BrowseName + \" \" + NodeClass + \" which is \" + Other + \".\")\n",
    "                                    \n",
    "                    \n",
    "    elif Other == \"O, RO\" or Other == \"O, R\":\n",
    "        \n",
    "        return (\"The \"+ Sourcenode + \"  \" + References + \" \" + BrowseName + \" \" + NodeClass + \" which is \" + Other + \". \"+ NodeClass +\" NodeClass is Read-Only. \")\n",
    "                        \n",
    "    \n",
    "                        \n",
    "    elif Other == \"O\":\n",
    "        \n",
    "        return(\"The \"+ Sourcenode + \" \" + References + \" \" + BrowseName + \" \" + NodeClass + \" which is \" + Other + \".\")\n",
    "            \n",
    "    elif Other == \"M, RO\" or Other == \"M, R\":\n",
    "        \n",
    "        return (\"The \"+ Sourcenode + \" \" + References + \" \" + BrowseName + \" \" + NodeClass + \" which is \" + Other + \". \"+ NodeClass + \" NodeClass is Read-Only. \")\n",
    "                \n",
    "    elif Other == \"OP\":\n",
    "                \n",
    "        return (\"The \"+ Sourcenode + \" \" + References + \" \" + BrowseName + \" \" + NodeClass + \" which is  \" + Other + \".\")\n",
    "                        \n",
    "    elif Other == \"MP\":\n",
    "        \n",
    "      \n",
    "        return  (\"The \"+ Sourcenode + \"  \" + References + \" \" + BrowseName + \" \" + NodeClass  + \" which is  \" + Other + \".\")\n",
    "                 \n",
    "    elif Other.lower().strip() == \"mandatoryplaceholder\" or Other.lower().strip() == \"mandatory\\nplaceholder\":\n",
    "        \n",
    "        \n",
    "        return (\"The \"+ Sourcenode + \"  \" + References + \"  \" + BrowseName + \" \" + NodeClass + \" which is \" + Other + \".\")\n",
    "                        \n",
    "    elif Other.lower().strip() == \"optionalplaceholder\" or Other.lower().strip() == \"optional\\nplaceholder\":\n",
    "               \n",
    "        return (\"The \"+ Sourcenode + \" \"  + References + \" \" + BrowseName + \" \" + NodeClass + \" which is \" + Other + \".\")\n",
    "    \n",
    "    elif Other.lower().strip() == \"nomodellingrule\":\n",
    "        print(\"Other: \"+ Other)\n",
    "\n",
    "    else:\n",
    "        return (\"  \")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "- Other is bascially the variable assigned to the name of column with Modelling Rule values in it\n",
    "- Mandatory,Optional,MandatoryPlaceholder,OptionalPlaceholder,M,O,MP,OP,RO-Read only,RW-Read Write,WO-Write only are all the allowed and\n",
    "  appeared values in tables, in ModellingRule column, to formulate modelling rule based constraints - Cardinality constraint, Cardinality and exsistence constraint\n",
    "  along with their access level constraint sometimes like for example - if there is M , RO in the same cell of Modelling Rule or Other similar column\n",
    "  it tells the Mandatory cardinality(at least one for sure) and existence(mandatory presence of atleast one) of that Browsename of its respective\n",
    "  nodeclass allowed for that Sourcenode, with a given targettype definition value and reference to the type of property. It also gives\n",
    "  access level rule as it gives, for example RO - meaning read only\n",
    "  the if-elif-else conditions in this function check for different forms of strings that give modelling rule value and return the constraint statements.\n",
    "- lower() - controls case sensitivity of the string\n",
    "- strip() - removed unwanted spaces in between the required string"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:06:44.794105Z",
     "start_time": "2021-08-04T07:06:44.788022Z"
    }
   },
   "outputs": [],
   "source": [
    "def DomainRange(BrowseName=None):\n",
    "    \n",
    "    if BrowseName == \"BrowseName\":\n",
    "        \n",
    "        return (\" \")\n",
    "    \n",
    "    if BrowseName :\n",
    "                                        \n",
    "        return (\"The \"+ Sourcenode + \" \" + References + \" \" + BrowseName + \" which should be of type \" + Typedef + \".\")\n",
    "                        \n",
    "    else:\n",
    "        \n",
    "        return (\"   \")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "- This function returns domain range constraint based on the Values in References column of table and their respective BrowseName which is nothing but the Target node\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Step 2 - Table categorization"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### Object Type Definition type tables"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Example for Step 2 - Table categorization\n",
    "- Categorizing all ObjectType TypeDefinition tables from extracted tables from PDF\n",
    "- In this example there is no consideration of any inconsistencies and merely focussed on understanding Table categoritazion step."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 195,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:06:46.119321Z",
     "start_time": "2021-08-04T07:06:46.114274Z"
    }
   },
   "outputs": [],
   "source": [
    "objtypdef = [\"IsAbstract False True\",\"Symmetric\",\"InverseName\",\" HasComponent HasProperty Requires\",\n",
    "             \"NodeClass Object Variable\",\"TypeDefinition\",\"ModellingRule MandatoryPlaceholder OptionalPlaceholder\",\n",
    "             \"Details\",\"DisplayName\",\"OrganizedBy\",\"Organized by\",\"ValueRank\",\"Powerlink Attributes\",\n",
    "             \"Access level\"]\n",
    "nonobjtypedef = [\"InverseName\",\"Symmetric\", \"Subtype of HierarchialReferences defined\",\"Argument[]\",\n",
    "                  \"InputArguments\", \"OutputArguments\",\"Namespace\",\"ConformanceUnit\",\"Conformance Unit\",\n",
    "                  \"ToState\",\"FromState\",\"HasEffect\",\"Notes –  Notes referencing footnotes of the table content.\",\n",
    "                  \"NOTE  Notes referencing footnotes of the table content.\",\"SourceBrowsePath\",\"Source Path\"] "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "- objtypedef and nonobjtypedef are variables declared to hold the list of strings that help to extract all types of structured\n",
    "  objecttype typedefinition tables and to properly get the count of the extracted tables of this type.\n",
    "- objtypedef variable holds the strings that are specific to objecttype definition tables that we want to extract\n",
    "- nonobjtypedef variable holds strings that do not belong to any objectype definition tables and are present in other types of tables.\n",
    "- Thereby, we can strictly filter out only those tables in which objtypedef strings are present and not any nonobjtypedef strings are present so that \n",
    "  we finally obtain only tables of ObjectType type definition category but not any other table type even similar to this tabletype."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 196,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:09:49.441401Z",
     "start_time": "2021-08-04T07:09:45.631848Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "                     0                                                  1\n",
      "0            Attribute                                              Value\n",
      "1          DisplayName  The  DisplayName  is  a  LocalizedText.  Each ...\n",
      "2          Description  Optionally a server-specific description is pr...\n",
      "3            NodeClass           Shall reflect the NodeClass of the Node.\n",
      "4               NodeId  The NodeId is described by BrowseNames as defi...\n",
      "5            WriteMask  Optionally the WriteMaskAttribute can be provi...\n",
      "6        UserWriteMask  Optionally the UserWriteMaskAttribute can be p...\n",
      "7      RolePermissions  Optionally server-specific role permissions ca...\n",
      "8  UserRolePermissions  Optionally the role permissions of the current...\n",
      "9   AccessRestrictions  Optionally server-specific access restrictions... \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "                         0                                                  1\n",
      "0                Attribute                                              Value\n",
      "1  MinimumSamplingInterval  Optionally, a server-specific minimum sampling...\n",
      "2              AccessLevel  The access level for Variables used for type d...\n",
      "3          UserAccessLevel  The  value  for  the  UserAccessLevelAttribute...\n",
      "4                    Value  For  Variables  used  as  InstanceDeclarations...\n",
      "5          ArrayDimensions  If \\nthe  ValueRank  does  not \\nidentify  an ...\n",
      "6              Historizing  The value for the HistorizingAttribute is serv...\n",
      "7            AccessLevelEx  If the AccessLevelExAttribute is provided, it ... \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "                 0                                                  1\n",
      "0       Attributes                                              Value\n",
      "1            Value  Optionally a server-specific default value can...\n",
      "2  ArrayDimensions  If \\nthe  ValueRank  does  not \\nidentify  an ... \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "               0                                                  1  \\\n",
      "0      Attribute                                              Value   \n",
      "1     BrowseName                                   VisionSystemType   \n",
      "2     IsAbstract                                              False   \n",
      "3     References                                       Node \\nClass   \n",
      "4                 Subtype of the BaseObjectType defined in OPC 1...   \n",
      "5   HasComponent                                             Object   \n",
      "6   HasComponent                                             Object   \n",
      "7   HasComponent                                             Object   \n",
      "8   HasComponent                                             Object   \n",
      "9   HasComponent                                             Object   \n",
      "10  HasComponent                                           Variable   \n",
      "11  HasComponent                                           Variable   \n",
      "\n",
      "                          2                                  3  \\\n",
      "0                                                                \n",
      "1                                                                \n",
      "2                                                                \n",
      "3                BrowseName                           DataType   \n",
      "4                                                                \n",
      "5   ConfigurationManagement                                 --   \n",
      "6          RecipeManagement                                 --   \n",
      "7          ResultManagement                                 --   \n",
      "8     SafetyStateManagement                                 --   \n",
      "9        VisionStateMachine                                 --   \n",
      "10          DiagnosticLevel                             UInt16   \n",
      "11              SystemState  SystemStateDescription \\nDataType   \n",
      "\n",
      "                              4                 5  \n",
      "0                                                  \n",
      "1                                                  \n",
      "2                                                  \n",
      "3                TypeDefinition  Modelling \\nRule  \n",
      "4                                                  \n",
      "5   ConfigurationManagementType          Optional  \n",
      "6          RecipeManagementType          Optional  \n",
      "7          ResultManagementType          Optional  \n",
      "8     SafetyStateManagementType          Optional  \n",
      "9        VisionStateMachineType         Mandatory  \n",
      "10         BaseDataVariableType          Optional  \n",
      "11         BaseDataVariableType          Optional   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "               0                                                  1  \\\n",
      "0      Attribute                                              Value   \n",
      "1     BrowseName                        ConfigurationManagementType   \n",
      "2     IsAbstract                                              False   \n",
      "3     References                                          NodeClass   \n",
      "4                 Subtype of the BaseObjectType defined in OPC 1...   \n",
      "5   HasComponent                                             Object   \n",
      "6   HasComponent                                             Object   \n",
      "7   HasComponent                                             Method   \n",
      "8   HasComponent                                             Method   \n",
      "9   HasComponent                                             Method   \n",
      "10  HasComponent                                             Method   \n",
      "11  HasComponent                                             Method   \n",
      "12  HasComponent                                             Method   \n",
      "13  HasComponent                                           Variable   \n",
      "\n",
      "                             2                      3  \\\n",
      "0                                                       \n",
      "1                                                       \n",
      "2                                                       \n",
      "3                   BrowseName               DataType   \n",
      "4                                                       \n",
      "5        ConfigurationTransfer                     --   \n",
      "6               Configurations                     --   \n",
      "7             AddConfiguration                     --   \n",
      "8         GetConfigurationList                     --   \n",
      "9         GetConfigurationById                     --   \n",
      "10  ReleaseConfigurationHandle                     --   \n",
      "11         RemoveConfiguration                     --   \n",
      "12       ActivateConfiguration                     --   \n",
      "13         ActiveConfiguration  ConfigurationDataType   \n",
      "\n",
      "                                      4              5  \n",
      "0                                                       \n",
      "1                                                       \n",
      "2                                                       \n",
      "3                        TypeDefinition  ModellingRule  \n",
      "4                                                       \n",
      "5   ConfigurationTransferType  Optional                 \n",
      "6               ConfigurationFolderType       Optional  \n",
      "7                                    --       Optional  \n",
      "8                                    --      Mandatory  \n",
      "9                                    --      Mandatory  \n",
      "10                                   --       Optional  \n",
      "11                                   --       Optional  \n",
      "12                                   --      Mandatory  \n",
      "13                 BaseDataVariableType      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "              0                                                 1  \\\n",
      "0     Attribute                                             Value   \n",
      "1    BrowseName                           ConfigurationFolderType   \n",
      "2    IsAbstract                                             False   \n",
      "3    References                                         NodeClass   \n",
      "4                Subtype of the FolderType defined in OPC 10000-5   \n",
      "5  HasComponent                                          Variable   \n",
      "\n",
      "                 2                      3                     4  \\\n",
      "0                                                                 \n",
      "1                                                                 \n",
      "2                                                                 \n",
      "3       BrowseName               DataType        TypeDefinition   \n",
      "4                                                                 \n",
      "5  <Configuration>  ConfigurationDataType  BaseDataVariableType   \n",
      "\n",
      "                     5  \n",
      "0                       \n",
      "1                       \n",
      "2                       \n",
      "3        ModellingRule  \n",
      "4                       \n",
      "5  OptionalPlaceholder   \n",
      "----------------------------------------------------------------------\n",
      "\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "              0                                                  1  \\\n",
      "0     Attribute                                              Value   \n",
      "1    BrowseName                          ConfigurationTransferType   \n",
      "2    IsAbstract                                              False   \n",
      "3    References                                          NodeClass   \n",
      "4                Subtype of the TemporaryFileTransferType defin...   \n",
      "5  HasComponent                                             Method   \n",
      "6  HasComponent                                             Method   \n",
      "\n",
      "                        2         3               4              5  \n",
      "0                                                                   \n",
      "1                                                                   \n",
      "2                                                                   \n",
      "3              BrowseName  DataType  TypeDefinition  ModellingRule  \n",
      "4                                                                   \n",
      "5   0:GenerateFileForRead        --              --      Mandatory  \n",
      "6  0:GenerateFileForWrite        --              --      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "               0                                                  1  \\\n",
      "0      Attribute                                              Value   \n",
      "1     BrowseName                               RecipeManagementType   \n",
      "2     IsAbstract                                              False   \n",
      "3     References                                         Node Class   \n",
      "4                 Subtype of the BaseObjectType defined in OPC 1...   \n",
      "5   HasComponent                                             Method   \n",
      "6   HasComponent                                             Method   \n",
      "7   HasComponent                                             Method   \n",
      "8   HasComponent                                             Method   \n",
      "9   HasComponent                                             Method   \n",
      "10  HasComponent                                             Method   \n",
      "11  HasComponent                                             Method   \n",
      "12  HasComponent                                             Method   \n",
      "13  HasComponent                                             Method   \n",
      "14  HasComponent                                             Object   \n",
      "15  HasComponent                                             Object   \n",
      "16  HasComponent                                             Object   \n",
      "\n",
      "                        2         3                   4              5  \n",
      "0                                                                       \n",
      "1                                                                       \n",
      "2                                                                       \n",
      "3              BrowseName  DataType      TypeDefinition  ModellingRule  \n",
      "4                                                                       \n",
      "5               AddRecipe        --                  --       Optional  \n",
      "6           PrepareRecipe        --                  --      Mandatory  \n",
      "7         UnprepareRecipe        --                  --      Mandatory  \n",
      "8   GetRecipeListFiltered        --                  --      Mandatory  \n",
      "9     ReleaseRecipeHandle        --                  --       Optional  \n",
      "10           RemoveRecipe        --                  --       Optional  \n",
      "11         PrepareProduct        --                  --       Optional  \n",
      "12       UnprepareProduct        --                  --       Optional  \n",
      "13          UnlinkProduct        --                  --       Optional  \n",
      "14         RecipeTransfer        --  RecipeTransferType       Optional  \n",
      "15                Recipes        --    RecipeFolderType       Optional  \n",
      "16               Products        --   ProductFolderType       Optional   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "              0                                                  1  \\\n",
      "0     Attribute                                              Value   \n",
      "1    BrowseName                                 RecipeTransferType   \n",
      "2    IsAbstract                                              False   \n",
      "3    References                                          NodeClass   \n",
      "4                Subtype of the TemporaryFileTransferType defin...   \n",
      "5  HasComponent                                             Method   \n",
      "6  HasComponent                                             Method   \n",
      "\n",
      "                        2         3               4              5  \n",
      "0                                                                   \n",
      "1                                                                   \n",
      "2                                                                   \n",
      "3              BrowseName  DataType  TypeDefinition  ModellingRule  \n",
      "4                                                                   \n",
      "5   0:GenerateFileForRead        --              --      Mandatory  \n",
      "6  0:GenerateFileForWrite        --              --      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "               0                                                  1  \\\n",
      "0      Attribute                                              Value   \n",
      "1     BrowseName                                         RecipeType   \n",
      "2     IsAbstract                                              False   \n",
      "3     References                                          NodeClass   \n",
      "4                 Subtype of the BaseObjectType defined in OPC 1...   \n",
      "5    HasProperty                                           Variable   \n",
      "6    HasProperty                                           Variable   \n",
      "7    HasProperty                                           Variable   \n",
      "8    HasProperty                                           Variable   \n",
      "9    HasProperty                                           Variable   \n",
      "10  HasComponent                                             Object   \n",
      "11  HasComponent                                             Method   \n",
      "12  HasComponent                                             Method   \n",
      "13  HasComponent                                             Method   \n",
      "14  HasComponent                                             Method   \n",
      "\n",
      "                 2                         3               4              5  \n",
      "0                                                                            \n",
      "1                                                                            \n",
      "2                                                                            \n",
      "3       BrowseName                  DataType  TypeDefinition  ModellingRule  \n",
      "4                                                                            \n",
      "5       ExternalId  RecipeIdExternalDataType    PropertyType       Optional  \n",
      "6       InternalId  RecipeIdInternalDataType    PropertyType      Mandatory  \n",
      "7       IsPrepared                   Boolean    PropertyType      Mandatory  \n",
      "8     LastModified                   UtcTime    PropertyType      Mandatory  \n",
      "9   LinkedProducts       ProductIdDataType[]    PropertyType       Optional  \n",
      "10          Handle                        --        FileType       Optional  \n",
      "11     LinkProduct                        --              --       Optional  \n",
      "12   UnlinkProduct                        --              --       Optional  \n",
      "13         Prepare                        --              --      Mandatory  \n",
      "14       Unprepare                        --              --      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "              0                                                 1           2  \\\n",
      "0     Attribute                                             Value               \n",
      "1    BrowseName                                  RecipeFolderType               \n",
      "2    IsAbstract                                             False               \n",
      "3    References                                         NodeClass  BrowseName   \n",
      "4                Subtype of the FolderType defined in OPC 10000-5               \n",
      "5  HasComponent                                            Object    <Recipe>   \n",
      "\n",
      "          3               4                    5  \n",
      "0                                                 \n",
      "1                                                 \n",
      "2                                                 \n",
      "3  DataType  TypeDefinition        ModellingRule  \n",
      "4                                                 \n",
      "5        --      RecipeType  OptionalPlaceholder   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "              0                                                 1           2  \\\n",
      "0     Attribute                                             Value               \n",
      "1    BrowseName                                 ProductFolderType               \n",
      "2    IsAbstract                                             False               \n",
      "3    References                                         NodeClass  BrowseName   \n",
      "4                Subtype of the FolderType defined in OPC 10000-5               \n",
      "5  HasComponent                                          Variable   <Product>   \n",
      "\n",
      "                 3                     4                    5  \n",
      "0                                                              \n",
      "1                                                              \n",
      "2                                                              \n",
      "3         DataType        TypeDefinition        ModellingRule  \n",
      "4                                                              \n",
      "5  ProductDataType  BaseDataVariableType  OptionalPlaceholder   \n",
      "----------------------------------------------------------------------\n",
      "\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "               0                                                  1  \\\n",
      "0      Attribute                                              Value   \n",
      "1     BrowseName                               ResultManagementType   \n",
      "2     IsAbstract                                              False   \n",
      "3     References                                          NodeClass   \n",
      "4                 Subtype of the BaseObjectType defined in OPC 1...   \n",
      "5   HasComponent                                             Method   \n",
      "6   HasComponent                                             Method   \n",
      "7   HasComponent                                             Method   \n",
      "8   HasComponent                                             Method   \n",
      "9   HasComponent                                             Object   \n",
      "10  HasComponent                                             Object   \n",
      "\n",
      "                          2         3                   4              5  \n",
      "0                                                                         \n",
      "1                                                                         \n",
      "2                                                                         \n",
      "3                BrowseName  DataType      TypeDefinition  ModellingRule  \n",
      "4                                                                         \n",
      "5             GetResultById        --                  --      Mandatory  \n",
      "6   GetResultComponentsById        --                  --      Mandatory  \n",
      "7     GetResultListFiltered        --                  --      Mandatory  \n",
      "8       ReleaseResultHandle        --                  --       Optional  \n",
      "9            ResultTransfer        --  ResultTransferType       Optional  \n",
      "10                  Results        --    ResultFolderType       Optional   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "              0                                                 1  \\\n",
      "0     Attribute                                             Value   \n",
      "1    BrowseName                                  ResultFolderType   \n",
      "2    IsAbstract                                             False   \n",
      "3    References                                         NodeClass   \n",
      "4                Subtype of the FolderType defined in OPC 10000-5   \n",
      "5  HasComponent                                          Variable   \n",
      "\n",
      "                  2                 3               4                    5  \n",
      "0                                                                           \n",
      "1                                                                           \n",
      "2                                                                           \n",
      "3        BrowseName          DataType  TypeDefinition        ModellingRule  \n",
      "4                                                                           \n",
      "5  <ResultVariable>  ResultDataTy\\npe      ResultType  OptionalPlaceholder   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "              0                                                  1  \\\n",
      "0     Attribute                                              Value   \n",
      "1    BrowseName                                 ResultTransferType   \n",
      "2    IsAbstract                                              False   \n",
      "3    References                                          NodeClass   \n",
      "4                Subtype of the TemporaryFileTransferType defin...   \n",
      "5  HasComponent                                             Method   \n",
      "\n",
      "                       2         3               4              5  \n",
      "0                                                                  \n",
      "1                                                                  \n",
      "2                                                                  \n",
      "3             BrowseName  DataType  TypeDefinition  ModellingRule  \n",
      "4                                                                  \n",
      "5  0:GenerateFileForRead        --              --      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "              0                                                  1  \\\n",
      "0     Attribute                                              Value   \n",
      "1    BrowseName                          SafetyStateManagementType   \n",
      "2    IsAbstract                                              False   \n",
      "3    References                                          NodeClass   \n",
      "4                Subtype of the BaseObjectType defined in OPC 1...   \n",
      "5  HasComponent                                             Method   \n",
      "6  HasComponent                                           Variable   \n",
      "7  HasComponent                                           Variable   \n",
      "\n",
      "                         2         3                     4              5  \n",
      "0                                                                          \n",
      "1                                                                          \n",
      "2                                                                          \n",
      "3               BrowseName  DataType        TypeDefinition  ModellingRule  \n",
      "4                                                                          \n",
      "5        ReportSafetyState        --                    --      Mandatory  \n",
      "6    VisionSafetyTriggered   Boolean  BaseDataVariableType      Mandatory  \n",
      "7  VisionSafetyInformation    String  BaseDataVariableType      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "               0                                                  1  \\\n",
      "0      Attribute                                              Value   \n",
      "1                                                                     \n",
      "2     BrowseName                             VisionStateMachineType   \n",
      "3     IsAbstract                                              False   \n",
      "4     References                                       Node \\nClass   \n",
      "5                 Subtype of the FiniteStateMachineType defined ...   \n",
      "6   HasComponent                                             Object   \n",
      "7   HasComponent                                             Object   \n",
      "8   HasComponent                                             Object   \n",
      "9   HasComponent                                             Object   \n",
      "10  HasComponent                                             Object   \n",
      "11  HasComponent                                             Object   \n",
      "12  HasComponent                                             Object   \n",
      "13  HasComponent                                             Object   \n",
      "14  HasComponent                                             Object   \n",
      "15  HasComponent                                             Object   \n",
      "16  HasComponent                                             Object   \n",
      "17  HasComponent                                             Object   \n",
      "18  HasComponent                                             Object   \n",
      "19  HasComponent                                             Object   \n",
      "20  HasComponent                                             Object   \n",
      "21  HasComponent                                             Object   \n",
      "22  HasComponent                                             Object   \n",
      "23  HasComponent                                             Object   \n",
      "24  HasComponent                                             Object   \n",
      "25  HasComponent                                             Object   \n",
      "26  HasComponent                                             Object   \n",
      "27  HasComponent                                             Object   \n",
      "28  HasComponent                                             Object   \n",
      "29  HasComponent                                             Method   \n",
      "30  HasComponent                                             Method   \n",
      "31  HasComponent                                             Method   \n",
      "32  HasComponent                                             Method   \n",
      "33  HasComponent                                             Object   \n",
      "34  HasComponent                                             Object   \n",
      "35  HasComponent                                             Object   \n",
      "36  HasComponent                                             Object   \n",
      "\n",
      "                                                    2           3  \\\n",
      "0                                                                   \n",
      "1   Includes all attributes specified for the Fini...               \n",
      "2                                                                   \n",
      "3                                                                   \n",
      "4                                          BrowseName  Data\\nType   \n",
      "5                                                                   \n",
      "6                                      Preoperational          --   \n",
      "7                                              Halted          --   \n",
      "8                                               Error          --   \n",
      "9                                         Operational          --   \n",
      "10                             PreoperationalToHalted          --   \n",
      "11                         PreoperationalToHaltedAuto          --   \n",
      "12                          PreoperationalToErrorAuto          --   \n",
      "13                        PreoperationalToOperational          --   \n",
      "14                    PreoperationalToOperationalAuto          --   \n",
      "15                        PreoperationalToInitialized          --   \n",
      "16                    PreoperationalToInitializedAuto          --   \n",
      "17                             HaltedToPreoperational          --   \n",
      "18                         HaltedToPreoperationalAuto          --   \n",
      "19                              ErrorToPreoperational          --   \n",
      "20                          ErrorToPreoperationalAuto          --   \n",
      "21                                      ErrorToHalted          --   \n",
      "22                                  ErrorToHaltedAuto          --   \n",
      "23                             ErrorToOperationalAuto          --   \n",
      "24                        OperationalToPreoperational          --   \n",
      "25                    OperationalToPreoperationalAuto          --   \n",
      "26                                OperationalToHalted          --   \n",
      "27                            OperationalToHaltedAuto          --   \n",
      "28                             OperationalToErrorAuto          --   \n",
      "29                                              Reset          --   \n",
      "30                                               Halt          --   \n",
      "31                                SelectModeAutomatic          --   \n",
      "32                                         ConfirmAll          --   \n",
      "33                            PreoperationalStepModel          --   \n",
      "34                                    HaltedStepModel          --   \n",
      "35                                     ErrorStepModel          --   \n",
      "36                          AutomaticModeStateMachine          --   \n",
      "\n",
      "                                      4              5  \n",
      "0                                                       \n",
      "1                                                       \n",
      "2                                                       \n",
      "3                                                       \n",
      "4                        TypeDefinition  ModellingRule  \n",
      "5                                                       \n",
      "6                             StateType                 \n",
      "7                             StateType                 \n",
      "8                             StateType                 \n",
      "9                             StateType                 \n",
      "10                       TransitionType                 \n",
      "11                       TransitionType                 \n",
      "12                       TransitionType                 \n",
      "13                       TransitionType                 \n",
      "14                       TransitionType                 \n",
      "15                       TransitionType                 \n",
      "16                       TransitionType                 \n",
      "17                       TransitionType                 \n",
      "18                       TransitionType                 \n",
      "19                       TransitionType                 \n",
      "20                       TransitionType                 \n",
      "21                       TransitionType                 \n",
      "22                       TransitionType                 \n",
      "23                       TransitionType                 \n",
      "24                       TransitionType                 \n",
      "25                       TransitionType                 \n",
      "26                       TransitionType                 \n",
      "27                       TransitionType                 \n",
      "28                       TransitionType                 \n",
      "29                                   --      Mandatory  \n",
      "30                                   --      Mandatory  \n",
      "31                                   --       Optional  \n",
      "32                                   --       Optional  \n",
      "33      VisionStepModelStateMachineType       Optional  \n",
      "34      VisionStepModelStateMachineType       Optional  \n",
      "35      VisionStepModelStateMachineType       Optional  \n",
      "36  VisionAutomaticModeStateMachineType       Optional   \n",
      "----------------------------------------------------------------------\n",
      "\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "                 0                   1                                2  \\\n",
      "0       BrowseName          References                Target BrowseName   \n",
      "1   Preoperational         HasProperty                      StateNumber   \n",
      "2                       FromTransition           HaltedToPreoperational   \n",
      "3                       FromTransition       HaltedToPreoperationalAuto   \n",
      "4                       FromTransition        ErrorToPreoperationalAuto   \n",
      "5                       FromTransition            ErrorToPreoperational   \n",
      "6                       FromTransition      OperationalToPreoperational   \n",
      "7                       FromTransition  OperationalToPreoperationalAuto   \n",
      "8                         ToTransition           PreoperationalToHalted   \n",
      "9                         ToTransition       PreoperationalToHaltedAuto   \n",
      "10                        ToTransition        PreoperationalToErrorAuto   \n",
      "11                        ToTransition      PreoperationalToOperational   \n",
      "12                        ToTransition  PreoperationalToOperationalAuto   \n",
      "13                        ToTransition      PreoperationalToInitialized   \n",
      "14                        ToTransition  PreoperationalToInitializedAuto   \n",
      "15                  HasSubStateMachine          PreoperationalStepModel   \n",
      "16          Halted         HasProperty                      StateNumber   \n",
      "17                      FromTransition           PreoperationalToHalted   \n",
      "18                      FromTransition       PreoperationalToHaltedAuto   \n",
      "19                      FromTransition                    ErrorToHalted   \n",
      "20                      FromTransition                ErrorToHaltedAuto   \n",
      "21                      FromTransition              OperationalToHalted   \n",
      "22                      FromTransition          OperationalToHaltedAuto   \n",
      "23                        ToTransition           HaltedToPreoperational   \n",
      "24                        ToTransition       HaltedToPreoperationalAuto   \n",
      "25                  HasSubStateMachine                  HaltedStepModel   \n",
      "26           Error         HasProperty                      StateNumber   \n",
      "27                      FromTransition        PreoperationalToErrorAuto   \n",
      "28                      FromTransition           OperationalToErrorAuto   \n",
      "29                        ToTransition            ErrorToPreoperational   \n",
      "30                        ToTransition        ErrorToPreoperationalAuto   \n",
      "31                        ToTransition                    ErrorToHalted   \n",
      "32                        ToTransition                ErrorToHaltedAuto   \n",
      "33                        ToTransition           ErrorToOperationalAuto   \n",
      "34                  HasSubStateMachine                   ErrorStepModel   \n",
      "35     Operational         HasProperty                      StateNumber   \n",
      "\n",
      "        3                                   4      5  \n",
      "0   Value               Target TypeDefinition  Notes  \n",
      "1       1                        PropertyType     --  \n",
      "2                              TransitionType     --  \n",
      "3                              TransitionType     --  \n",
      "4                              TransitionType     --  \n",
      "5                              TransitionType     --  \n",
      "6                              TransitionType     --  \n",
      "7                              TransitionType     --  \n",
      "8                              TransitionType     --  \n",
      "9                              TransitionType     --  \n",
      "10                             TransitionType     --  \n",
      "11                             TransitionType     --  \n",
      "12                             TransitionType     --  \n",
      "13                             TransitionType     --  \n",
      "14                             TransitionType     --  \n",
      "15         VisionStepModelState \\nMachineType     --  \n",
      "16      2                        PropertyType     --  \n",
      "17                             TransitionType     --  \n",
      "18                             TransitionType     --  \n",
      "19                             TransitionType     --  \n",
      "20                             TransitionType     --  \n",
      "21                             TransitionType     --  \n",
      "22                             TransitionType     --  \n",
      "23                             TransitionType     --  \n",
      "24                             TransitionType     --  \n",
      "25         VisionStepModelState \\nMachineType     --  \n",
      "26      3                        PropertyType     --  \n",
      "27                             TransitionType     --  \n",
      "28                             TransitionType     --  \n",
      "29                             TransitionType     --  \n",
      "30                             TransitionType     --  \n",
      "31                             TransitionType     --  \n",
      "32                             TransitionType     --  \n",
      "33                             TransitionType     --  \n",
      "34         VisionStepModelState \\nMachineType     --  \n",
      "35      4                        PropertyType     --   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "            0                   1                                2      3  \\\n",
      "0  BrowseName          References                Target BrowseName  Value   \n",
      "1                  FromTransition      PreoperationalToOperational          \n",
      "2                  FromTransition  PreoperationalToOperationalAuto          \n",
      "3                  FromTransition           ErrorToOperationalAuto          \n",
      "4                    ToTransition      OperationalToPreoperational          \n",
      "5                    ToTransition  OperationalToPreoperationalAuto          \n",
      "6                    ToTransition              OperationalToHalted          \n",
      "7                    ToTransition          OperationalToHaltedAuto          \n",
      "8                    ToTransition           OperationalToErrorAuto          \n",
      "9              HasSubStateMachine        AutomaticModeStateMachine          \n",
      "\n",
      "                                        4      5  \n",
      "0                   Target TypeDefinition  Notes  \n",
      "1                          TransitionType     --  \n",
      "2                          TransitionType     --  \n",
      "3                          TransitionType     --  \n",
      "4                          TransitionType     --  \n",
      "5                          TransitionType     --  \n",
      "6                          TransitionType     --  \n",
      "7                          TransitionType     --  \n",
      "8                          TransitionType     --  \n",
      "9  VisionAutomaticModeState \\nMachineType     --   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "            0                                                  1           2  \\\n",
      "0   Attribute                                              Value               \n",
      "1  BrowseName                              StateChangedEventType               \n",
      "2  IsAbstract                                              False               \n",
      "3  References                                          NodeClass  BrowseName   \n",
      "4              Subtype of the TransitionEventType defined in ...               \n",
      "\n",
      "          3               4              5  \n",
      "0                                           \n",
      "1                                           \n",
      "2                                           \n",
      "3  DataType  TypeDefinition  ModellingRule  \n",
      "4                                            \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "            0                                                  1           2  \\\n",
      "0  References                                          NodeClass  BrowseName   \n",
      "1              Subtype of the TransitionEventType defined in ...               \n",
      "\n",
      "          3               4              5  \n",
      "0  DataType  TypeDefinition  ModellingRule  \n",
      "1                                            \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "            0                                                  1           2  \\\n",
      "0   Attribute                                              Value               \n",
      "1  BrowseName                             ErrorResolvedEventType               \n",
      "2  IsAbstract                                              False               \n",
      "3  References                                          NodeClass  BrowseName   \n",
      "4              Subtype of the TransitionEventType defined in ...               \n",
      "\n",
      "          3               4              5  \n",
      "0                                           \n",
      "1                                           \n",
      "2                                           \n",
      "3  DataType  TypeDefinition  ModellingRule  \n",
      "4                                            \n",
      "----------------------------------------------------------------------\n",
      "\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "               0                                                  1  \\\n",
      "0      Attribute                                              Value   \n",
      "1                                                                     \n",
      "2     BrowseName                VisionAutomaticModeStateMachineType   \n",
      "3     IsAbstract                                              False   \n",
      "4                                                                     \n",
      "5     References                                          NodeClass   \n",
      "6                 Subtype of the FiniteStateMachineType defined ...   \n",
      "7   HasComponent                                             Object   \n",
      "8   HasComponent                                             Object   \n",
      "9   HasComponent                                             Object   \n",
      "10  HasComponent                                             Object   \n",
      "11  HasComponent                                             Object   \n",
      "12  HasComponent                                             Object   \n",
      "13  HasComponent                                             Object   \n",
      "14  HasComponent                                             Object   \n",
      "15  HasComponent                                             Object   \n",
      "16  HasComponent                                             Object   \n",
      "17  HasComponent                                             Object   \n",
      "18  HasComponent                                             Object   \n",
      "19  HasComponent                                             Object   \n",
      "20  HasComponent                                             Object   \n",
      "21  HasComponent                                             Object   \n",
      "22  HasComponent                                             Object   \n",
      "23  HasComponent                                             Object   \n",
      "24  HasComponent                                             Object   \n",
      "25  HasComponent                                             Object   \n",
      "26  HasComponent                                             Object   \n",
      "27  HasComponent                                             Method   \n",
      "28  HasComponent                                             Method   \n",
      "29  HasComponent                                             Method   \n",
      "30  HasComponent                                             Method   \n",
      "31  HasComponent                                             Method   \n",
      "32  HasComponent                                             Object   \n",
      "33  HasComponent                                             Object   \n",
      "34  HasComponent                                             Object   \n",
      "35  HasComponent                                             Object   \n",
      "\n",
      "                                                    2            3  \\\n",
      "0                                                                    \n",
      "1   Includes all attributes specified for the Fini...                \n",
      "2                                                                    \n",
      "3                                                                    \n",
      "4                                                                    \n",
      "5                                          BrowseName  Data \\nType   \n",
      "6                                                                    \n",
      "7                                         Initialized           --   \n",
      "8                                               Ready           --   \n",
      "9                                     SingleExecution           --   \n",
      "10                                ContinuousExecution           --   \n",
      "11                           InitializedToReadyRecipe           --   \n",
      "12                          InitializedToReadyProduct           --   \n",
      "13                             InitializedToReadyAuto           --   \n",
      "14                           ReadyToInitializedRecipe           --   \n",
      "15                          ReadyToInitializedProduct           --   \n",
      "16                             ReadyToInitializedAuto           --   \n",
      "17                             ReadyToSingleExecution           --   \n",
      "18                         ReadyToSingleExecutionAuto           --   \n",
      "19                         ReadyToContinuousExecution           --   \n",
      "20                     ReadyToContinuousExecutionAuto           --   \n",
      "21                         SingleExecutionToReadyStop           --   \n",
      "22                        SingleExecutionToReadyAbort           --   \n",
      "23                         SingleExecutionToReadyAuto           --   \n",
      "24                     ContinuousExecutionToReadyStop           --   \n",
      "25                  ContinuousExecutionToReadyAbor\\nt           --   \n",
      "26                     ContinuousExecutionToReadyAuto           --   \n",
      "27                                               Stop           --   \n",
      "28                                              Abort           --   \n",
      "29                                     StartSingleJob           --   \n",
      "30                                    StartContinuous           --   \n",
      "31                                     SimulationMode           --   \n",
      "32                               InitializedStepModel           --   \n",
      "33                                     ReadyStepModel           --   \n",
      "34                           SingleExecutionStepModel           --   \n",
      "35                       ContinuousExecutionStepModel           --   \n",
      "\n",
      "                                  4              5  \n",
      "0                                                   \n",
      "1                                                   \n",
      "2                                                   \n",
      "3                                                   \n",
      "4                                                   \n",
      "5                    TypeDefinition  ModellingRule  \n",
      "6                                                   \n",
      "7                         StateType                 \n",
      "8                         StateType                 \n",
      "9                         StateType                 \n",
      "10                        StateType                 \n",
      "11                   TransitionType                 \n",
      "12                   TransitionType                 \n",
      "13                   TransitionType                 \n",
      "14                   TransitionType                 \n",
      "15                   TransitionType                 \n",
      "16                   TransitionType                 \n",
      "17                   TransitionType                 \n",
      "18                   TransitionType                 \n",
      "19                   TransitionType                 \n",
      "20                   TransitionType                 \n",
      "21                   TransitionType                 \n",
      "22                   TransitionType                 \n",
      "23                   TransitionType                 \n",
      "24                   TransitionType                 \n",
      "25                   TransitionType                 \n",
      "26                   TransitionType                 \n",
      "27                                       Mandatory  \n",
      "28                                       Mandatory  \n",
      "29                                       Mandatory  \n",
      "30                                       Mandatory  \n",
      "31                                        Optional  \n",
      "32  VisionStepModelStateMachineType       Optional  \n",
      "33  VisionStepModelStateMachineType       Optional  \n",
      "34  VisionStepModelStateMachineType       Optional  \n",
      "35  VisionStepModelStateMachineType       Optional   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "            0           1                  2      3                      4  \\\n",
      "0  BrowseName  References  Target BrowseName  Value  Target TypeDefinition   \n",
      "\n",
      "       5  \n",
      "0  Notes   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "            0               1           2         3               4  \\\n",
      "0   Attribute           Value                                         \n",
      "1  BrowseName  StartSingleJob                                         \n",
      "2  References       NodeClass  BrowseName  DataType  TypeDefinition   \n",
      "\n",
      "               5  \n",
      "0                 \n",
      "1                 \n",
      "2  ModellingRule   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "             0                                                  1           2  \\\n",
      "0    Attribute                                              Value               \n",
      "1   BrowseName                            RecipePreparedEventType               \n",
      "2   IsAbstract                                              False               \n",
      "3   References                                          NodeClass  BrowseName   \n",
      "4               Subtype of the BaseEventType defined in OPC 10...               \n",
      "5  HasProperty                                           Variable  ExternalId   \n",
      "6  HasProperty                                           Variable  InternalId   \n",
      "7  HasProperty                                           Variable   ProductId   \n",
      "\n",
      "                          3               4              5  \n",
      "0                                                           \n",
      "1                                                           \n",
      "2                                                           \n",
      "3                  DataType  TypeDefinition  ModellingRule  \n",
      "4                                                           \n",
      "5  RecipeIdExternalDataType    PropertyType       Optional  \n",
      "6  RecipeIdInternalDataType    PropertyType      Mandatory  \n",
      "7         ProductIdDataType    PropertyType       Optional   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "             0                                                  1           2  \\\n",
      "0    Attribute                                              Value               \n",
      "1   BrowseName                                JobStartedEventType               \n",
      "2   IsAbstract                                              False               \n",
      "3   References                                          NodeClass  BrowseName   \n",
      "4               Subtype of the BaseEventType defined in OPC 10...               \n",
      "5  HasProperty                                           Variable       JobId   \n",
      "\n",
      "               3               4              5  \n",
      "0                                                \n",
      "1                                                \n",
      "2                                                \n",
      "3       DataType  TypeDefinition  ModellingRule  \n",
      "4                                                \n",
      "5  JobIdDataType    PropertyType      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "             0                                                  1           2  \\\n",
      "0    Attribute                                              Value               \n",
      "1   BrowseName                                     ReadyEventType               \n",
      "2   IsAbstract                                              False               \n",
      "3   References                                          NodeClass  BrowseName   \n",
      "4               Subtype of the BaseEventType defined in OPC 10...               \n",
      "5  HasProperty                                           Variable       JobId   \n",
      "\n",
      "               3               4              5  \n",
      "0                                                \n",
      "1                                                \n",
      "2                                                \n",
      "3       DataType  TypeDefinition  ModellingRule  \n",
      "4                                                \n",
      "5  JobIdDataType    PropertyType      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "              0                                                  1  \\\n",
      "0     Attribute                                              Value   \n",
      "1    BrowseName                               ResultReadyEventType   \n",
      "2    IsAbstract                                              False   \n",
      "3    References                                          NodeClass   \n",
      "4                Subtype of the BaseEventType defined in OPC 10...   \n",
      "5   HasProperty                                           Variable   \n",
      "6   HasProperty                                           Variable   \n",
      "7   HasProperty                                           Variable   \n",
      "8   HasProperty                                           Variable   \n",
      "9   HasProperty                                           Variable   \n",
      "10  HasProperty                                           Variable   \n",
      "\n",
      "                   2                         3             4  \\\n",
      "0                                                              \n",
      "1                                                              \n",
      "2                                                              \n",
      "3         BrowseName                  DataType                 \n",
      "4                                                              \n",
      "5          IsPartial                   Boolean  PropertyType   \n",
      "6        IsSimulated                   Boolean  PropertyType   \n",
      "7        ResultState       ResultStateDataType  PropertyType   \n",
      "8             MeasId            MeasIdDataType  PropertyType   \n",
      "9             PartId            PartIdDataType  PropertyType   \n",
      "10  ExternalRecipeId  RecipeIdExternalDataType  PropertyType   \n",
      "\n",
      "                                5  \n",
      "0                                  \n",
      "1                                  \n",
      "2                                  \n",
      "3   TypeDefinition  ModellingRule  \n",
      "4                                  \n",
      "5                       Mandatory  \n",
      "6                        Optional  \n",
      "7                       Mandatory  \n",
      "8                        Optional  \n",
      "9                        Optional  \n",
      "10                       Optional   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "             0                                                  1           2  \\\n",
      "0    Attribute                                              Value               \n",
      "1   BrowseName                           AcquisitionDoneEventType               \n",
      "2   IsAbstract                                              False               \n",
      "3   References                                          NodeClass  BrowseName   \n",
      "4               Subtype of the BaseEventType defined in OPC 10...               \n",
      "5  HasProperty                                           Variable       JobId   \n",
      "\n",
      "               3               4              5  \n",
      "0                                                \n",
      "1                                                \n",
      "2                                                \n",
      "3       DataType  TypeDefinition  ModellingRule  \n",
      "4                                                \n",
      "5  JobIdDataType    PropertyType      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "               0                                                  1  \\\n",
      "0      Attribute                                              Value   \n",
      "1                                                                     \n",
      "2     BrowseName                    VisionStepModelStateMachineType   \n",
      "3     IsAbstract                                              False   \n",
      "4     References                                          NodeClass   \n",
      "5                 Subtype of the FiniteStateMachineType defined ...   \n",
      "6   HasComponent                                             Object   \n",
      "7   HasComponent                                             Object   \n",
      "8   HasComponent                                             Object   \n",
      "9   HasComponent                                             Object   \n",
      "10  HasComponent                                             Object   \n",
      "11  HasComponent                                             Object   \n",
      "12  HasComponent                                             Object   \n",
      "13  HasComponent                                             Object   \n",
      "14  HasComponent                                             Object   \n",
      "15  HasComponent                                             Object   \n",
      "16  HasComponent                                             Method   \n",
      "\n",
      "                                                    2         3  \\\n",
      "0                                                                 \n",
      "1   Includes all attributes specified for the Fini...             \n",
      "2                                                                 \n",
      "3                                                                 \n",
      "4                                          BrowseName  DataType   \n",
      "5                                                                 \n",
      "6                                               Entry        --   \n",
      "7                                                Exit        --   \n",
      "8                                                Wait        --   \n",
      "9                                                Step        --   \n",
      "10                                    EntryToExitAuto        --   \n",
      "11                                    EntryToWaitAuto        --   \n",
      "12                                         WaitToStep        --   \n",
      "13                                     WaitToStepAuto        --   \n",
      "14                                     StepToExitAuto        --   \n",
      "15                                     StepToWaitAuto        --   \n",
      "16                                               Sync        --   \n",
      "\n",
      "                   4              5  \n",
      "0                                    \n",
      "1                                    \n",
      "2                                    \n",
      "3                                    \n",
      "4     TypeDefinition  ModellingRule  \n",
      "5                                    \n",
      "6   InitialStateType             --  \n",
      "7          StateType             --  \n",
      "8          StateType             --  \n",
      "9          StateType             --  \n",
      "10    TransitionType             --  \n",
      "11    TransitionType             --  \n",
      "12    TransitionType             --  \n",
      "13    TransitionType             --  \n",
      "14    TransitionType             --  \n",
      "15    TransitionType             --  \n",
      "16                --      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "             0               1                  2      3  \\\n",
      "0   BrowseName      References  Target BrowseName  Value   \n",
      "1        Entry     HasProperty        StateNumber     11   \n",
      "2                 ToTransition    EntryToExitAuto          \n",
      "3                 ToTransition    EntryToWaitAuto          \n",
      "4         Exit     HasProperty        StateNumber     12   \n",
      "5               FromTransition    EntryToExitAuto          \n",
      "6               FromTransition     StepToExitAuto          \n",
      "7         Wait     HasProperty        StateNumber     13   \n",
      "8               FromTransition    EntryToWaitAuto          \n",
      "9               FromTransition     StepToWaitAuto          \n",
      "10                ToTransition         WaitToStep          \n",
      "11                ToTransition     WaitToStepAuto          \n",
      "12        Step     HasProperty        StateNumber     14   \n",
      "13              FromTransition         WaitToStep          \n",
      "14              FromTransition     WaitToStepAuto          \n",
      "15                ToTransition     StepToExitAuto          \n",
      "16                ToTransition     StepToWaitAuto          \n",
      "\n",
      "                        4      5  \n",
      "0   Target TypeDefinition  Notes  \n",
      "1            PropertyType     --  \n",
      "2          TransitionType     --  \n",
      "3          TransitionType     --  \n",
      "4            PropertyType     --  \n",
      "5          TransitionType     --  \n",
      "6          TransitionType     --  \n",
      "7            PropertyType     --  \n",
      "8          TransitionType     --  \n",
      "9          TransitionType     --  \n",
      "10         TransitionType     --  \n",
      "11         TransitionType     --  \n",
      "12           PropertyType     --  \n",
      "13         TransitionType     --  \n",
      "14         TransitionType     --  \n",
      "15         TransitionType     --  \n",
      "16         TransitionType     --   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "             0                                                  1           2  \\\n",
      "0    Attribute                                              Value               \n",
      "1   BrowseName                         EnterStepSequenceEventType               \n",
      "2   IsAbstract                                              False               \n",
      "3   References                                          NodeClass  BrowseName   \n",
      "4               Subtype of the BaseEventType defined in OPC 10...               \n",
      "5  HasProperty                                           Variable       Steps   \n",
      "\n",
      "          3               4              5  \n",
      "0                                           \n",
      "1                                           \n",
      "2                                           \n",
      "3  DataType  TypeDefinition  ModellingRule  \n",
      "4                                           \n",
      "5     Int32    PropertyType      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "             0                                                  1           2  \\\n",
      "0    Attribute                                              Value               \n",
      "1   BrowseName                                  NextStepEventType               \n",
      "2   IsAbstract                                              False               \n",
      "3   References                                          NodeClass  BrowseName   \n",
      "4               Subtype of the BaseEventType defined in OPC 10...               \n",
      "5  HasProperty                                           Variable        Step   \n",
      "\n",
      "          3               4              5  \n",
      "0                                           \n",
      "1                                           \n",
      "2                                           \n",
      "3  DataType  TypeDefinition  ModellingRule  \n",
      "4                                           \n",
      "5     Int32    PropertyType      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "            0                                                  1           2  \\\n",
      "0   Attribute                                              Value               \n",
      "1  BrowseName                         LeaveStepSequenceEventType               \n",
      "2  IsAbstract                                              False               \n",
      "3  References                                          NodeClass  BrowseName   \n",
      "4              Subtype of the BaseEventType defined in OPC 10...               \n",
      "\n",
      "          3               4              5  \n",
      "0                                           \n",
      "1                                           \n",
      "2                                           \n",
      "3  DataType  TypeDefinition  ModellingRule  \n",
      "4                                            \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "               0                                                  1  \\\n",
      "0      Attribute                                              Value   \n",
      "1     BrowseName                                         ResultType   \n",
      "2     IsAbstract                                              False   \n",
      "3      ValueRank                                        -1 {Scalar}   \n",
      "4       DataType                                     ResultDataType   \n",
      "5     References                                         Node Class   \n",
      "6                 Subtype of the BaseDataVariableType defined in...   \n",
      "7   HasComponent                                           Variable   \n",
      "8   HasComponent                                           Variable   \n",
      "9   HasComponent                                           Variable   \n",
      "10  HasComponent                                           Variable   \n",
      "11  HasComponent                                           Variable   \n",
      "12  HasComponent                                           Variable   \n",
      "13  HasComponent                                           Variable   \n",
      "14  HasComponent                                           Variable   \n",
      "15  HasComponent                                           Variable   \n",
      "16  HasComponent                                           Variable   \n",
      "17  HasComponent                                           Variable   \n",
      "18  HasComponent                                           Variable   \n",
      "19  HasComponent                                           Variable   \n",
      "20  HasComponent                                           Variable   \n",
      "21  HasComponent                                           Variable   \n",
      "22  HasComponent                                           Variable   \n",
      "\n",
      "                            2  \\\n",
      "0                               \n",
      "1                               \n",
      "2                               \n",
      "3                               \n",
      "4                               \n",
      "5                  BrowseName   \n",
      "6                               \n",
      "7                    ResultId   \n",
      "8   HasTransferableDataOnFile   \n",
      "9                   IsPartial   \n",
      "10                IsSimulated   \n",
      "11                ResultState   \n",
      "12                     MeasId   \n",
      "13                     PartId   \n",
      "14           ExternalRecipeId   \n",
      "15           InternalRecipeId   \n",
      "16                  ProductId   \n",
      "17    ExternalConfigurationId   \n",
      "18    InternalConfigurationId   \n",
      "19                      JobId   \n",
      "20               CreationTime   \n",
      "21            ProcessingTimes   \n",
      "22              ResultContent   \n",
      "\n",
      "                                                  3              4  \n",
      "0                                                                   \n",
      "1                                                                   \n",
      "2                                                                   \n",
      "3                                                                   \n",
      "4                                                                   \n",
      "5                         DataType / TypeDefinition  ModellingRule  \n",
      "6                                                                   \n",
      "7           ResultIdDataType \\nBaseDataVariableType      Mandatory  \n",
      "8                    Boolean \\nBaseDataVariableType       Optional  \n",
      "9                    Boolean \\nBaseDataVariableType      Mandatory  \n",
      "10                   Boolean \\nBaseDataVariableType       Optional  \n",
      "11       ResultStateDataType \\nBaseDataVariableType      Mandatory  \n",
      "12            MeasIdDataType \\nBaseDataVariableType       Optional  \n",
      "13            PartIdDataType \\nBaseDataVariableType       Optional  \n",
      "14  RecipeIdExternalDataType \\nBaseDataVariableType       Optional  \n",
      "15  RecipeIdInternalDataType \\nBaseDataVariableType      Mandatory  \n",
      "16         ProductIdDataType \\nBaseDataVariableType       Optional  \n",
      "17   ConfigurationIdDataType \\nBaseDataVariableType       Optional  \n",
      "18   ConfigurationIdDataType \\nBaseDataVariableType      Mandatory  \n",
      "19             JobIdDataType \\nBaseDataVariableType      Mandatory  \n",
      "20                   UtcTime \\nBaseDataVariableType      Mandatory  \n",
      "21   ProcessingTimesDataType \\nBaseDataVariableType       Optional  \n",
      "22            BaseDataType[] \\nBaseDataVariableType       Optional   \n",
      "----------------------------------------------------------------------\n",
      "\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "              0                                                  1  \\\n",
      "0     Attribute                                              Value   \n",
      "1    BrowseName                                    VisionEventType   \n",
      "2    IsAbstract                                               True   \n",
      "3    References                                          NodeClass   \n",
      "4                Subtype of the BaseEventType defined in OPC 10...   \n",
      "5    HasSubtype                                         ObjectType   \n",
      "6    HasSubtype                                         ObjectType   \n",
      "7                                                                    \n",
      "8   HasProperty                                           Variable   \n",
      "9   HasProperty                                           Variable   \n",
      "10  HasProperty                                           Variable   \n",
      "11  HasProperty                                           Variable   \n",
      "12  HasProperty                                           Variable   \n",
      "13  HasProperty                                           Variable   \n",
      "14  HasProperty                                           Variable   \n",
      "15  HasProperty                                           Variable   \n",
      "16  HasProperty                                           Variable   \n",
      "17  HasProperty                                           Variable   \n",
      "\n",
      "                                2                         3               4  \\\n",
      "0                                                                             \n",
      "1                                                                             \n",
      "2                                                                             \n",
      "3                      BrowseName                  DataType  TypeDefinition   \n",
      "4                                                                             \n",
      "5   VisionDiagnosticInfoEventType         Defined in 11.4.2                   \n",
      "6      VisionInformationEventType         Defined in 11.4.3                   \n",
      "7                                                                             \n",
      "8                       CausePath                    String    PropertyType   \n",
      "9                          MeasId            MeasIdDataType    PropertyType   \n",
      "10                         PartId            PartIdDataType    PropertyType   \n",
      "11               ExternalRecipeId  RecipeIdExternalDataType    PropertyType   \n",
      "12               InternalRecipeId  RecipeIdInternalDataType    PropertyType   \n",
      "13                      ProductId         ProductIdDataType    PropertyType   \n",
      "14        ExternalConfigurationId   ConfigurationIdDataType    PropertyType   \n",
      "15        InternalConfigurationId   ConfigurationIdDataType    PropertyType   \n",
      "16                          JobId             JobIdDataType    PropertyType   \n",
      "17                       ResultId          ResultIdDataType    PropertyType   \n",
      "\n",
      "                5  \n",
      "0                  \n",
      "1                  \n",
      "2                  \n",
      "3   ModellingRule  \n",
      "4                  \n",
      "5                  \n",
      "6                  \n",
      "7                  \n",
      "8        Optional  \n",
      "9        Optional  \n",
      "10       Optional  \n",
      "11       Optional  \n",
      "12       Optional  \n",
      "13       Optional  \n",
      "14       Optional  \n",
      "15       Optional  \n",
      "16       Optional  \n",
      "17       Optional   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "                                0                              1           2  \\\n",
      "0                       Attribute                          Value               \n",
      "1                      BrowseName  VisionDiagnosticInfoEventType               \n",
      "2                      IsAbstract                          False               \n",
      "3                      References                      NodeClass  BrowseName   \n",
      "4  Subtype of the VisionEventType                                              \n",
      "\n",
      "          3               4              5  \n",
      "0                                           \n",
      "1                                           \n",
      "2                                           \n",
      "3  DataType  TypeDefinition  ModellingRule  \n",
      "4                                            \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "                                0                           1           2  \\\n",
      "0                       Attribute                       Value               \n",
      "1                      BrowseName  VisionInformationEventType               \n",
      "2                      IsAbstract                       False               \n",
      "3                      References                   NodeClass  BrowseName   \n",
      "4  Subtype of the VisionEventType                                           \n",
      "\n",
      "          3               4              5  \n",
      "0                                           \n",
      "1                                           \n",
      "2                                           \n",
      "3  DataType  TypeDefinition  ModellingRule  \n",
      "4                                            \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "              0                                                  1  \\\n",
      "0     Attribute                                              Value   \n",
      "1    BrowseName                                VisionConditionType   \n",
      "2    IsAbstract                                               True   \n",
      "3    References                                          NodeClass   \n",
      "4                Subtype of the AcknowledgeableConditionType de...   \n",
      "5    HasSubtype                                         ObjectType   \n",
      "6    HasSubtype                                         ObjectType   \n",
      "7    HasSubtype                                         ObjectType   \n",
      "8                                                                    \n",
      "9   HasProperty                                           Variable   \n",
      "10  HasProperty                                           Variable   \n",
      "11  HasProperty                                           Variable   \n",
      "12  HasProperty                                           Variable   \n",
      "13  HasProperty                                           Variable   \n",
      "14  HasProperty                                           Variable   \n",
      "15  HasProperty                                           Variable   \n",
      "16  HasProperty                                           Variable   \n",
      "17  HasProperty                                           Variable   \n",
      "18  HasProperty                                           Variable   \n",
      "19  HasProperty                                           Variable   \n",
      "20  HasProperty                                           Variable   \n",
      "21  HasProperty                                           Variable   \n",
      "22  HasProperty                                           Variable   \n",
      "\n",
      "                                     2                         3  \\\n",
      "0                                                                  \n",
      "1                                                                  \n",
      "2                                                                  \n",
      "3                           BrowseName                  DataType   \n",
      "4                                                                  \n",
      "5           VisionWarningConditionType         Defined in 11.4.5   \n",
      "6             VisionErrorConditionType         Defined in 11.4.6   \n",
      "7   VisionPersistentErrorConditionType         Defined in 11.4.7   \n",
      "8                                                                  \n",
      "9                            CausePath                    String   \n",
      "10                              MeasId            MeasIdDataType   \n",
      "11                              PartId            PartIdDataType   \n",
      "12                    ExternalRecipeId  RecipeIdExternalDataType   \n",
      "13                    InternalRecipeId  RecipeIdInternalDataType   \n",
      "14                           ProductId         ProductIdDataType   \n",
      "15             ExternalConfigurationId   ConfigurationIdDataType   \n",
      "16             InternalConfigurationId   ConfigurationIdDataType   \n",
      "17                               JobId             JobIdDataType   \n",
      "18                            ResultId          ResultIdDataType   \n",
      "19                           ErrorCode                    UInt64   \n",
      "20                         ErrorString                    String   \n",
      "21                        StopReaction                   Boolean   \n",
      "22                       BlockReaction                   Boolean   \n",
      "\n",
      "                                4          5  \n",
      "0                                             \n",
      "1                                             \n",
      "2                                             \n",
      "3   TypeDefinition  ModellingRule             \n",
      "4                                             \n",
      "5                                             \n",
      "6                                             \n",
      "7                                             \n",
      "8                                             \n",
      "9                    PropertyType   Optional  \n",
      "10                   PropertyType   Optional  \n",
      "11                   PropertyType   Optional  \n",
      "12                   PropertyType   Optional  \n",
      "13                   PropertyType   Optional  \n",
      "14                   PropertyType   Optional  \n",
      "15                   PropertyType   Optional  \n",
      "16                   PropertyType   Optional  \n",
      "17                   PropertyType   Optional  \n",
      "18                   PropertyType   Optional  \n",
      "19                   PropertyType   Optional  \n",
      "20                   PropertyType   Optional  \n",
      "21                   PropertyType  Mandatory  \n",
      "22                   PropertyType  Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "                                    0                           1           2  \\\n",
      "0                           Attribute                       Value               \n",
      "1                          BrowseName  VisionWarningConditionType               \n",
      "2                          IsAbstract                       False               \n",
      "3                          References                   NodeClass  BrowseName   \n",
      "4  Subtype of the VisionConditionType                                           \n",
      "\n",
      "          3               4              5  \n",
      "0                                           \n",
      "1                                           \n",
      "2                                           \n",
      "3  DataType  TypeDefinition  ModellingRule  \n",
      "4                                            \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "                                    0                         1           2  \\\n",
      "0                           Attribute                     Value               \n",
      "1                          BrowseName  VisionErrorConditionType               \n",
      "2                          IsAbstract                     False               \n",
      "3                          References                 NodeClass  BrowseName   \n",
      "4  Subtype of the VisionConditionType                                         \n",
      "\n",
      "          3               4              5  \n",
      "0                                           \n",
      "1                                           \n",
      "2                                           \n",
      "3  DataType  TypeDefinition  ModellingRule  \n",
      "4                                            \n",
      "----------------------------------------------------------------------\n",
      "\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "                                    0                                   1  \\\n",
      "0                           Attribute                               Value   \n",
      "1                          BrowseName  VisionPersistentErrorConditionType   \n",
      "2                          IsAbstract                               False   \n",
      "3                          References                           NodeClass   \n",
      "4  Subtype of the VisionConditionType                                       \n",
      "\n",
      "            2         3               4              5  \n",
      "0                                                       \n",
      "1                                                       \n",
      "2                                                       \n",
      "3  BrowseName  DataType  TypeDefinition  ModellingRule  \n",
      "4                                                        \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "             0                                                  1  \\\n",
      "0    Attribute                                              Value   \n",
      "1   BrowseName                              VisionSafetyEventType   \n",
      "2   IsAbstract                                              False   \n",
      "3   References                                          NodeClass   \n",
      "4               Subtype of the BaseEventType defined in OPC 10...   \n",
      "5  HasProperty                                           Variable   \n",
      "6  HasProperty                                           Variable   \n",
      "\n",
      "                         2         3               4              5  \n",
      "0                                                                    \n",
      "1                                                                    \n",
      "2                                                                    \n",
      "3               BrowseName  DataType  TypeDefinition  ModellingRule  \n",
      "4                                                                    \n",
      "5    VisionSafetyTriggered   Boolean    PropertyType      Mandatory  \n",
      "6  VisionSafetyInformation    String    PropertyType      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "            0                                                  1           2  \\\n",
      "0   Attribute                                              Value               \n",
      "1  BrowseName                                ResultStateDataType               \n",
      "2  IsAbstract                                              False               \n",
      "3  References                                       Node \\nClass  BrowseName   \n",
      "4              Subtype of the Int32 DataType defined in OPC 1...               \n",
      "\n",
      "          3               4                 5  \n",
      "0                                              \n",
      "1                                              \n",
      "2                                              \n",
      "3  DataType  TypeDefinition  Modelling \\nRule  \n",
      "4                                               \n",
      "----------------------------------------------------------------------\n",
      "\n"
     ]
    }
   ],
   "source": [
    "for table in tables:\n",
    "# select only tables which contain any of the objtypdef strings and not any of the nonobjtypedef strings\n",
    "    if any(s1 in table.df.to_string() for s1 in objtypdef):\n",
    "        if not any(s2 in table.df.to_string() for s2 in nonobjtypedef):\n",
    "            t = table.df\n",
    "            print(table.df, \"\\n----------------------------------------------------------------------\\n\")\n",
    "            "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Now we define variables for strings that help to identify and filter standard structured objecttype definition tables with identified and considered inconsistencies only, from all tables extracted from PDF\n",
    "That means, these filtered tables tables appear in general in the companion spec documents and mostly follow companion spec template format."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 200,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:10:12.558572Z",
     "start_time": "2021-08-04T07:10:12.555534Z"
    }
   },
   "outputs": [],
   "source": [
    "objtypdef = [\"IsAbstract False True\",\"Symmetric\",\"InverseName\",\" HasComponent HasProperty Requires\",\n",
    "                     \"NodeClass Object Variable\",\"TypeDefinition\",\"ModellingRule MandatoryPlaceholder OptionalPlaceholder\",\n",
    "                     \"Details\"]\n",
    "nonobjtypedef = [\"InverseName\",\"Symmetric\", \"Subtype of HierarchialReferences defined\",\"Argument[]\",\"DisplayName\",\n",
    "                  \"InputArguments\", \"OutputArguments\",\"OrganizedBy\",\"Organized by\",\"Namespace\",\"ConformanceUnit\",\"Conformance Unit\",\n",
    "                  \"ToState\",\"FromState\",\"HasEffect\",\"ValueRank\",\"Notes –  Notes referencing footnotes of the table content.\",\n",
    "                  \"NOTE  Notes referencing footnotes of the table content.\",\"SourceBrowsePath\",\"Source Path\", \"Target BrowseName\",\n",
    "                \"Target TypeDefinition\",\"Notes\", \"Client Facet\",\"http://opcfoundation.org/UA-Profile/External\"] "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "- o1 : int type - variable to hold row number value in a range along the length of the table\n",
    "- range() function returns a list or sequence of numbers, that denote the row index value of table here starting from 3rd row, ranging throughout the length of table i.e., through all the rows present in the table. This helps in row-wise extraction of constraints based on values of different columns of an each individual row in table\n",
    "- Sourcenode : string type - variable the holds the values in 1st row 1st column or 1st row 2nd column or 1st row 3rd cloumn in 'Value' column of objecttype definitiontables\n",
    "- NOTE: generally the Sourcenode is in the name of 'BrowseName' in the Attributes column (0th column). It is the main node on which the constraints are definied and usually its position is in 1st row 1st column of these tables but sometimes due to improper or irregular spacing in cells of tables the position of sourcenode value automatically gets shifted into 2nd or 3rd column during the extraction, hence inorder to not to miss out the values of sourcenode even in such situations. We also give the value to be picked from positions <tablevariable>.iat[1,2] and <tablevariable>.iat[1,3]\n",
    "- References : string type - variable to hold the allowed reference type name for the respective Targetnodes(browsenames), allowed under a particular main Sourcenode.\n",
    "- NodeClass : string type - variable to hold the allowed NodeClass name for the respective Targetnodes(browsenames), allowed under a particular main Sourcenode.\n",
    "- BrowseName : string type - variable to hold the allowed Browsename name or Targetnode name, allowed under a particular main Sourcenode.\n",
    "- Datatype : string type - variable to hold the allowed Datatype name for the respective Targetnodes(browsenames), allowed under a particular main Sourcenode.\n",
    "- Typedef : string type - variable to hold the allowed TargetType definition name for the respective Targetnodes(browsenames), allowed under a particular main Sourcenode.\n",
    "- Other : string type - variable to hold the allowed status of the ModellingRule (like if the ModellingRule is Mandatory or Optional or Other)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 201,
   "metadata": {},
   "outputs": [],
   "source": [
    "# ObjectTypeDefinition - creating a excel workbook for writing output to objecttype definition constraints excel sheet\n",
    "\n",
    "wb = {\n",
    "      'Datatype_Const':[], \n",
    "      'Cardinality_Existance':[],\n",
    "      'Domain_Range':[],\n",
    "      }"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Step 2 Table categorization followed by \n",
    "## Step 3 - Constraint Identification & Rule formulation "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 202,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:10:16.246841Z",
     "start_time": "2021-08-04T07:10:13.379420Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "               0                                                  1  \\\n",
      "0      Attribute                                              Value   \n",
      "1     BrowseName                                   VisionSystemType   \n",
      "2     IsAbstract                                              False   \n",
      "3     References                                       Node \\nClass   \n",
      "4                 Subtype of the BaseObjectType defined in OPC 1...   \n",
      "5   HasComponent                                             Object   \n",
      "6   HasComponent                                             Object   \n",
      "7   HasComponent                                             Object   \n",
      "8   HasComponent                                             Object   \n",
      "9   HasComponent                                             Object   \n",
      "10  HasComponent                                           Variable   \n",
      "11  HasComponent                                           Variable   \n",
      "\n",
      "                          2                                  3  \\\n",
      "0                                                                \n",
      "1                                                                \n",
      "2                                                                \n",
      "3                BrowseName                           DataType   \n",
      "4                                                                \n",
      "5   ConfigurationManagement                                 --   \n",
      "6          RecipeManagement                                 --   \n",
      "7          ResultManagement                                 --   \n",
      "8     SafetyStateManagement                                 --   \n",
      "9        VisionStateMachine                                 --   \n",
      "10          DiagnosticLevel                             UInt16   \n",
      "11              SystemState  SystemStateDescription \\nDataType   \n",
      "\n",
      "                              4                 5  \n",
      "0                                                  \n",
      "1                                                  \n",
      "2                                                  \n",
      "3                TypeDefinition  Modelling \\nRule  \n",
      "4                                                  \n",
      "5   ConfigurationManagementType          Optional  \n",
      "6          RecipeManagementType          Optional  \n",
      "7          ResultManagementType          Optional  \n",
      "8     SafetyStateManagementType          Optional  \n",
      "9        VisionStateMachineType         Mandatory  \n",
      "10         BaseDataVariableType          Optional  \n",
      "11         BaseDataVariableType          Optional   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      " \n",
      "  \n",
      " \n",
      "  \n",
      "  \n",
      "   \n",
      "The VisionSystemType HasComponent ConfigurationManagement which should be of datatype --.\n",
      "The VisionSystemType HasComponent ConfigurationManagement Object which is Optional.\n",
      "The VisionSystemType HasComponent ConfigurationManagement which should be of type ConfigurationManagementType.\n",
      "The VisionSystemType HasComponent RecipeManagement which should be of datatype --.\n",
      "The VisionSystemType HasComponent RecipeManagement Object which is Optional.\n",
      "The VisionSystemType HasComponent RecipeManagement which should be of type RecipeManagementType.\n",
      "The VisionSystemType HasComponent ResultManagement which should be of datatype --.\n",
      "The VisionSystemType HasComponent ResultManagement Object which is Optional.\n",
      "The VisionSystemType HasComponent ResultManagement which should be of type ResultManagementType.\n",
      "The VisionSystemType HasComponent SafetyStateManagement which should be of datatype --.\n",
      "The VisionSystemType HasComponent SafetyStateManagement Object which is Optional.\n",
      "The VisionSystemType HasComponent SafetyStateManagement which should be of type SafetyStateManagementType.\n",
      "The VisionSystemType HasComponent VisionStateMachine which should be of datatype --.\n",
      "The VisionSystemType HasComponent VisionStateMachine Object which is Mandatory.\n",
      "The VisionSystemType HasComponent VisionStateMachine which should be of type VisionStateMachineType.\n",
      "The VisionSystemType HasComponent DiagnosticLevel which should be of datatype UInt16.\n",
      "The VisionSystemType HasComponent DiagnosticLevel Variable which is Optional.\n",
      "The VisionSystemType HasComponent DiagnosticLevel which should be of type BaseDataVariableType.\n",
      "The VisionSystemType HasComponent SystemState which should be of datatype SystemStateDescription \n",
      "DataType.\n",
      "The VisionSystemType HasComponent SystemState Variable which is Optional.\n",
      "The VisionSystemType HasComponent SystemState which should be of type BaseDataVariableType.\n",
      "               0                                                  1  \\\n",
      "0      Attribute                                              Value   \n",
      "1     BrowseName                        ConfigurationManagementType   \n",
      "2     IsAbstract                                              False   \n",
      "3     References                                          NodeClass   \n",
      "4                 Subtype of the BaseObjectType defined in OPC 1...   \n",
      "5   HasComponent                                             Object   \n",
      "6   HasComponent                                             Object   \n",
      "7   HasComponent                                             Method   \n",
      "8   HasComponent                                             Method   \n",
      "9   HasComponent                                             Method   \n",
      "10  HasComponent                                             Method   \n",
      "11  HasComponent                                             Method   \n",
      "12  HasComponent                                             Method   \n",
      "13  HasComponent                                           Variable   \n",
      "\n",
      "                             2                      3  \\\n",
      "0                                                       \n",
      "1                                                       \n",
      "2                                                       \n",
      "3                   BrowseName               DataType   \n",
      "4                                                       \n",
      "5        ConfigurationTransfer                     --   \n",
      "6               Configurations                     --   \n",
      "7             AddConfiguration                     --   \n",
      "8         GetConfigurationList                     --   \n",
      "9         GetConfigurationById                     --   \n",
      "10  ReleaseConfigurationHandle                     --   \n",
      "11         RemoveConfiguration                     --   \n",
      "12       ActivateConfiguration                     --   \n",
      "13         ActiveConfiguration  ConfigurationDataType   \n",
      "\n",
      "                                      4              5  \n",
      "0                                                       \n",
      "1                                                       \n",
      "2                                                       \n",
      "3                        TypeDefinition  ModellingRule  \n",
      "4                                                       \n",
      "5   ConfigurationTransferType  Optional                 \n",
      "6               ConfigurationFolderType       Optional  \n",
      "7                                    --       Optional  \n",
      "8                                    --      Mandatory  \n",
      "9                                    --      Mandatory  \n",
      "10                                   --       Optional  \n",
      "11                                   --       Optional  \n",
      "12                                   --      Mandatory  \n",
      "13                 BaseDataVariableType      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      " \n",
      "  \n",
      " \n",
      "  \n",
      "  \n",
      "   \n",
      "The ConfigurationManagementType HasComponent ConfigurationTransfer which should be of datatype --.\n",
      "  \n",
      "The ConfigurationManagementType HasComponent ConfigurationTransfer which should be of type ConfigurationTransferType  Optional.\n",
      "The ConfigurationManagementType HasComponent Configurations which should be of datatype --.\n",
      "The ConfigurationManagementType HasComponent Configurations Object which is Optional.\n",
      "The ConfigurationManagementType HasComponent Configurations which should be of type ConfigurationFolderType.\n",
      "The ConfigurationManagementType HasComponent AddConfiguration which should be of datatype --.\n",
      "The ConfigurationManagementType HasComponent AddConfiguration Method which is Optional.\n",
      "The ConfigurationManagementType HasComponent AddConfiguration which should be of type --.\n",
      "The ConfigurationManagementType HasComponent GetConfigurationList which should be of datatype --.\n",
      "The ConfigurationManagementType HasComponent GetConfigurationList Method which is Mandatory.\n",
      "The ConfigurationManagementType HasComponent GetConfigurationList which should be of type --.\n",
      "The ConfigurationManagementType HasComponent GetConfigurationById which should be of datatype --.\n",
      "The ConfigurationManagementType HasComponent GetConfigurationById Method which is Mandatory.\n",
      "The ConfigurationManagementType HasComponent GetConfigurationById which should be of type --.\n",
      "The ConfigurationManagementType HasComponent ReleaseConfigurationHandle which should be of datatype --.\n",
      "The ConfigurationManagementType HasComponent ReleaseConfigurationHandle Method which is Optional.\n",
      "The ConfigurationManagementType HasComponent ReleaseConfigurationHandle which should be of type --.\n",
      "The ConfigurationManagementType HasComponent RemoveConfiguration which should be of datatype --.\n",
      "The ConfigurationManagementType HasComponent RemoveConfiguration Method which is Optional.\n",
      "The ConfigurationManagementType HasComponent RemoveConfiguration which should be of type --.\n",
      "The ConfigurationManagementType HasComponent ActivateConfiguration which should be of datatype --.\n",
      "The ConfigurationManagementType HasComponent ActivateConfiguration Method which is Mandatory.\n",
      "The ConfigurationManagementType HasComponent ActivateConfiguration which should be of type --.\n",
      "The ConfigurationManagementType HasComponent ActiveConfiguration which should be of datatype ConfigurationDataType.\n",
      "The ConfigurationManagementType HasComponent ActiveConfiguration Variable which is Mandatory.\n",
      "The ConfigurationManagementType HasComponent ActiveConfiguration which should be of type BaseDataVariableType.\n",
      "              0                                                 1  \\\n",
      "0     Attribute                                             Value   \n",
      "1    BrowseName                           ConfigurationFolderType   \n",
      "2    IsAbstract                                             False   \n",
      "3    References                                         NodeClass   \n",
      "4                Subtype of the FolderType defined in OPC 10000-5   \n",
      "5  HasComponent                                          Variable   \n",
      "\n",
      "                 2                      3                     4  \\\n",
      "0                                                                 \n",
      "1                                                                 \n",
      "2                                                                 \n",
      "3       BrowseName               DataType        TypeDefinition   \n",
      "4                                                                 \n",
      "5  <Configuration>  ConfigurationDataType  BaseDataVariableType   \n",
      "\n",
      "                     5  \n",
      "0                       \n",
      "1                       \n",
      "2                       \n",
      "3        ModellingRule  \n",
      "4                       \n",
      "5  OptionalPlaceholder   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      " \n",
      "  \n",
      " \n",
      "  \n",
      "  \n",
      "   \n",
      "The ConfigurationFolderType HasComponent <Configuration> which should be of datatype ConfigurationDataType.\n",
      "The ConfigurationFolderType HasComponent <Configuration> Variable which is OptionalPlaceholder.\n",
      "The ConfigurationFolderType HasComponent <Configuration> which should be of type BaseDataVariableType.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "              0                                                  1  \\\n",
      "0     Attribute                                              Value   \n",
      "1    BrowseName                          ConfigurationTransferType   \n",
      "2    IsAbstract                                              False   \n",
      "3    References                                          NodeClass   \n",
      "4                Subtype of the TemporaryFileTransferType defin...   \n",
      "5  HasComponent                                             Method   \n",
      "6  HasComponent                                             Method   \n",
      "\n",
      "                        2         3               4              5  \n",
      "0                                                                   \n",
      "1                                                                   \n",
      "2                                                                   \n",
      "3              BrowseName  DataType  TypeDefinition  ModellingRule  \n",
      "4                                                                   \n",
      "5   0:GenerateFileForRead        --              --      Mandatory  \n",
      "6  0:GenerateFileForWrite        --              --      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      " \n",
      "  \n",
      " \n",
      "  \n",
      "  \n",
      "   \n",
      "The ConfigurationTransferType HasComponent 0:GenerateFileForRead which should be of datatype --.\n",
      "The ConfigurationTransferType HasComponent 0:GenerateFileForRead Method which is Mandatory.\n",
      "The ConfigurationTransferType HasComponent 0:GenerateFileForRead which should be of type --.\n",
      "The ConfigurationTransferType HasComponent 0:GenerateFileForWrite which should be of datatype --.\n",
      "The ConfigurationTransferType HasComponent 0:GenerateFileForWrite Method which is Mandatory.\n",
      "The ConfigurationTransferType HasComponent 0:GenerateFileForWrite which should be of type --.\n",
      "               0                                                  1  \\\n",
      "0      Attribute                                              Value   \n",
      "1     BrowseName                               RecipeManagementType   \n",
      "2     IsAbstract                                              False   \n",
      "3     References                                         Node Class   \n",
      "4                 Subtype of the BaseObjectType defined in OPC 1...   \n",
      "5   HasComponent                                             Method   \n",
      "6   HasComponent                                             Method   \n",
      "7   HasComponent                                             Method   \n",
      "8   HasComponent                                             Method   \n",
      "9   HasComponent                                             Method   \n",
      "10  HasComponent                                             Method   \n",
      "11  HasComponent                                             Method   \n",
      "12  HasComponent                                             Method   \n",
      "13  HasComponent                                             Method   \n",
      "14  HasComponent                                             Object   \n",
      "15  HasComponent                                             Object   \n",
      "16  HasComponent                                             Object   \n",
      "\n",
      "                        2         3                   4              5  \n",
      "0                                                                       \n",
      "1                                                                       \n",
      "2                                                                       \n",
      "3              BrowseName  DataType      TypeDefinition  ModellingRule  \n",
      "4                                                                       \n",
      "5               AddRecipe        --                  --       Optional  \n",
      "6           PrepareRecipe        --                  --      Mandatory  \n",
      "7         UnprepareRecipe        --                  --      Mandatory  \n",
      "8   GetRecipeListFiltered        --                  --      Mandatory  \n",
      "9     ReleaseRecipeHandle        --                  --       Optional  \n",
      "10           RemoveRecipe        --                  --       Optional  \n",
      "11         PrepareProduct        --                  --       Optional  \n",
      "12       UnprepareProduct        --                  --       Optional  \n",
      "13          UnlinkProduct        --                  --       Optional  \n",
      "14         RecipeTransfer        --  RecipeTransferType       Optional  \n",
      "15                Recipes        --    RecipeFolderType       Optional  \n",
      "16               Products        --   ProductFolderType       Optional   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      " \n",
      "  \n",
      " \n",
      "  \n",
      "  \n",
      "   \n",
      "The RecipeManagementType HasComponent AddRecipe which should be of datatype --.\n",
      "The RecipeManagementType HasComponent AddRecipe Method which is Optional.\n",
      "The RecipeManagementType HasComponent AddRecipe which should be of type --.\n",
      "The RecipeManagementType HasComponent PrepareRecipe which should be of datatype --.\n",
      "The RecipeManagementType HasComponent PrepareRecipe Method which is Mandatory.\n",
      "The RecipeManagementType HasComponent PrepareRecipe which should be of type --.\n",
      "The RecipeManagementType HasComponent UnprepareRecipe which should be of datatype --.\n",
      "The RecipeManagementType HasComponent UnprepareRecipe Method which is Mandatory.\n",
      "The RecipeManagementType HasComponent UnprepareRecipe which should be of type --.\n",
      "The RecipeManagementType HasComponent GetRecipeListFiltered which should be of datatype --.\n",
      "The RecipeManagementType HasComponent GetRecipeListFiltered Method which is Mandatory.\n",
      "The RecipeManagementType HasComponent GetRecipeListFiltered which should be of type --.\n",
      "The RecipeManagementType HasComponent ReleaseRecipeHandle which should be of datatype --.\n",
      "The RecipeManagementType HasComponent ReleaseRecipeHandle Method which is Optional.\n",
      "The RecipeManagementType HasComponent ReleaseRecipeHandle which should be of type --.\n",
      "The RecipeManagementType HasComponent RemoveRecipe which should be of datatype --.\n",
      "The RecipeManagementType HasComponent RemoveRecipe Method which is Optional.\n",
      "The RecipeManagementType HasComponent RemoveRecipe which should be of type --.\n",
      "The RecipeManagementType HasComponent PrepareProduct which should be of datatype --.\n",
      "The RecipeManagementType HasComponent PrepareProduct Method which is Optional.\n",
      "The RecipeManagementType HasComponent PrepareProduct which should be of type --.\n",
      "The RecipeManagementType HasComponent UnprepareProduct which should be of datatype --.\n",
      "The RecipeManagementType HasComponent UnprepareProduct Method which is Optional.\n",
      "The RecipeManagementType HasComponent UnprepareProduct which should be of type --.\n",
      "The RecipeManagementType HasComponent UnlinkProduct which should be of datatype --.\n",
      "The RecipeManagementType HasComponent UnlinkProduct Method which is Optional.\n",
      "The RecipeManagementType HasComponent UnlinkProduct which should be of type --.\n",
      "The RecipeManagementType HasComponent RecipeTransfer which should be of datatype --.\n",
      "The RecipeManagementType HasComponent RecipeTransfer Object which is Optional.\n",
      "The RecipeManagementType HasComponent RecipeTransfer which should be of type RecipeTransferType.\n",
      "The RecipeManagementType HasComponent Recipes which should be of datatype --.\n",
      "The RecipeManagementType HasComponent Recipes Object which is Optional.\n",
      "The RecipeManagementType HasComponent Recipes which should be of type RecipeFolderType.\n",
      "The RecipeManagementType HasComponent Products which should be of datatype --.\n",
      "The RecipeManagementType HasComponent Products Object which is Optional.\n",
      "The RecipeManagementType HasComponent Products which should be of type ProductFolderType.\n",
      "              0                                                  1  \\\n",
      "0     Attribute                                              Value   \n",
      "1    BrowseName                                 RecipeTransferType   \n",
      "2    IsAbstract                                              False   \n",
      "3    References                                          NodeClass   \n",
      "4                Subtype of the TemporaryFileTransferType defin...   \n",
      "5  HasComponent                                             Method   \n",
      "6  HasComponent                                             Method   \n",
      "\n",
      "                        2         3               4              5  \n",
      "0                                                                   \n",
      "1                                                                   \n",
      "2                                                                   \n",
      "3              BrowseName  DataType  TypeDefinition  ModellingRule  \n",
      "4                                                                   \n",
      "5   0:GenerateFileForRead        --              --      Mandatory  \n",
      "6  0:GenerateFileForWrite        --              --      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      " \n",
      "  \n",
      " \n",
      "  \n",
      "  \n",
      "   \n",
      "The RecipeTransferType HasComponent 0:GenerateFileForRead which should be of datatype --.\n",
      "The RecipeTransferType HasComponent 0:GenerateFileForRead Method which is Mandatory.\n",
      "The RecipeTransferType HasComponent 0:GenerateFileForRead which should be of type --.\n",
      "The RecipeTransferType HasComponent 0:GenerateFileForWrite which should be of datatype --.\n",
      "The RecipeTransferType HasComponent 0:GenerateFileForWrite Method which is Mandatory.\n",
      "The RecipeTransferType HasComponent 0:GenerateFileForWrite which should be of type --.\n",
      "               0                                                  1  \\\n",
      "0      Attribute                                              Value   \n",
      "1     BrowseName                                         RecipeType   \n",
      "2     IsAbstract                                              False   \n",
      "3     References                                          NodeClass   \n",
      "4                 Subtype of the BaseObjectType defined in OPC 1...   \n",
      "5    HasProperty                                           Variable   \n",
      "6    HasProperty                                           Variable   \n",
      "7    HasProperty                                           Variable   \n",
      "8    HasProperty                                           Variable   \n",
      "9    HasProperty                                           Variable   \n",
      "10  HasComponent                                             Object   \n",
      "11  HasComponent                                             Method   \n",
      "12  HasComponent                                             Method   \n",
      "13  HasComponent                                             Method   \n",
      "14  HasComponent                                             Method   \n",
      "\n",
      "                 2                         3               4              5  \n",
      "0                                                                            \n",
      "1                                                                            \n",
      "2                                                                            \n",
      "3       BrowseName                  DataType  TypeDefinition  ModellingRule  \n",
      "4                                                                            \n",
      "5       ExternalId  RecipeIdExternalDataType    PropertyType       Optional  \n",
      "6       InternalId  RecipeIdInternalDataType    PropertyType      Mandatory  \n",
      "7       IsPrepared                   Boolean    PropertyType      Mandatory  \n",
      "8     LastModified                   UtcTime    PropertyType      Mandatory  \n",
      "9   LinkedProducts       ProductIdDataType[]    PropertyType       Optional  \n",
      "10          Handle                        --        FileType       Optional  \n",
      "11     LinkProduct                        --              --       Optional  \n",
      "12   UnlinkProduct                        --              --       Optional  \n",
      "13         Prepare                        --              --      Mandatory  \n",
      "14       Unprepare                        --              --      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      " \n",
      "  \n",
      " \n",
      "  \n",
      "  \n",
      "   \n",
      "The RecipeType HasProperty ExternalId which should be of datatype RecipeIdExternalDataType.\n",
      "The RecipeType HasProperty ExternalId Variable which is Optional.\n",
      "The RecipeType HasProperty ExternalId which should be of type PropertyType.\n",
      "The RecipeType HasProperty InternalId which should be of datatype RecipeIdInternalDataType.\n",
      "The RecipeType HasProperty InternalId Variable which is Mandatory.\n",
      "The RecipeType HasProperty InternalId which should be of type PropertyType.\n",
      "The RecipeType HasProperty IsPrepared which should be of datatype Boolean.\n",
      "The RecipeType HasProperty IsPrepared Variable which is Mandatory.\n",
      "The RecipeType HasProperty IsPrepared which should be of type PropertyType.\n",
      "The RecipeType HasProperty LastModified which should be of datatype UtcTime.\n",
      "The RecipeType HasProperty LastModified Variable which is Mandatory.\n",
      "The RecipeType HasProperty LastModified which should be of type PropertyType.\n",
      "The RecipeType HasProperty LinkedProducts which should be of datatype ProductIdDataType[].\n",
      "The RecipeType HasProperty LinkedProducts Variable which is Optional.\n",
      "The RecipeType HasProperty LinkedProducts which should be of type PropertyType.\n",
      "The RecipeType HasComponent Handle which should be of datatype --.\n",
      "The RecipeType HasComponent Handle Object which is Optional.\n",
      "The RecipeType HasComponent Handle which should be of type FileType.\n",
      "The RecipeType HasComponent LinkProduct which should be of datatype --.\n",
      "The RecipeType HasComponent LinkProduct Method which is Optional.\n",
      "The RecipeType HasComponent LinkProduct which should be of type --.\n",
      "The RecipeType HasComponent UnlinkProduct which should be of datatype --.\n",
      "The RecipeType HasComponent UnlinkProduct Method which is Optional.\n",
      "The RecipeType HasComponent UnlinkProduct which should be of type --.\n",
      "The RecipeType HasComponent Prepare which should be of datatype --.\n",
      "The RecipeType HasComponent Prepare Method which is Mandatory.\n",
      "The RecipeType HasComponent Prepare which should be of type --.\n",
      "The RecipeType HasComponent Unprepare which should be of datatype --.\n",
      "The RecipeType HasComponent Unprepare Method which is Mandatory.\n",
      "The RecipeType HasComponent Unprepare which should be of type --.\n",
      "              0                                                 1           2  \\\n",
      "0     Attribute                                             Value               \n",
      "1    BrowseName                                  RecipeFolderType               \n",
      "2    IsAbstract                                             False               \n",
      "3    References                                         NodeClass  BrowseName   \n",
      "4                Subtype of the FolderType defined in OPC 10000-5               \n",
      "5  HasComponent                                            Object    <Recipe>   \n",
      "\n",
      "          3               4                    5  \n",
      "0                                                 \n",
      "1                                                 \n",
      "2                                                 \n",
      "3  DataType  TypeDefinition        ModellingRule  \n",
      "4                                                 \n",
      "5        --      RecipeType  OptionalPlaceholder   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      " \n",
      "  \n",
      " \n",
      "  \n",
      "  \n",
      "   \n",
      "The RecipeFolderType HasComponent <Recipe> which should be of datatype --.\n",
      "The RecipeFolderType HasComponent <Recipe> Object which is OptionalPlaceholder.\n",
      "The RecipeFolderType HasComponent <Recipe> which should be of type RecipeType.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "              0                                                 1           2  \\\n",
      "0     Attribute                                             Value               \n",
      "1    BrowseName                                 ProductFolderType               \n",
      "2    IsAbstract                                             False               \n",
      "3    References                                         NodeClass  BrowseName   \n",
      "4                Subtype of the FolderType defined in OPC 10000-5               \n",
      "5  HasComponent                                          Variable   <Product>   \n",
      "\n",
      "                 3                     4                    5  \n",
      "0                                                              \n",
      "1                                                              \n",
      "2                                                              \n",
      "3         DataType        TypeDefinition        ModellingRule  \n",
      "4                                                              \n",
      "5  ProductDataType  BaseDataVariableType  OptionalPlaceholder   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      " \n",
      "  \n",
      " \n",
      "  \n",
      "  \n",
      "   \n",
      "The ProductFolderType HasComponent <Product> which should be of datatype ProductDataType.\n",
      "The ProductFolderType HasComponent <Product> Variable which is OptionalPlaceholder.\n",
      "The ProductFolderType HasComponent <Product> which should be of type BaseDataVariableType.\n",
      "               0                                                  1  \\\n",
      "0      Attribute                                              Value   \n",
      "1     BrowseName                               ResultManagementType   \n",
      "2     IsAbstract                                              False   \n",
      "3     References                                          NodeClass   \n",
      "4                 Subtype of the BaseObjectType defined in OPC 1...   \n",
      "5   HasComponent                                             Method   \n",
      "6   HasComponent                                             Method   \n",
      "7   HasComponent                                             Method   \n",
      "8   HasComponent                                             Method   \n",
      "9   HasComponent                                             Object   \n",
      "10  HasComponent                                             Object   \n",
      "\n",
      "                          2         3                   4              5  \n",
      "0                                                                         \n",
      "1                                                                         \n",
      "2                                                                         \n",
      "3                BrowseName  DataType      TypeDefinition  ModellingRule  \n",
      "4                                                                         \n",
      "5             GetResultById        --                  --      Mandatory  \n",
      "6   GetResultComponentsById        --                  --      Mandatory  \n",
      "7     GetResultListFiltered        --                  --      Mandatory  \n",
      "8       ReleaseResultHandle        --                  --       Optional  \n",
      "9            ResultTransfer        --  ResultTransferType       Optional  \n",
      "10                  Results        --    ResultFolderType       Optional   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      " \n",
      "  \n",
      " \n",
      "  \n",
      "  \n",
      "   \n",
      "The ResultManagementType HasComponent GetResultById which should be of datatype --.\n",
      "The ResultManagementType HasComponent GetResultById Method which is Mandatory.\n",
      "The ResultManagementType HasComponent GetResultById which should be of type --.\n",
      "The ResultManagementType HasComponent GetResultComponentsById which should be of datatype --.\n",
      "The ResultManagementType HasComponent GetResultComponentsById Method which is Mandatory.\n",
      "The ResultManagementType HasComponent GetResultComponentsById which should be of type --.\n",
      "The ResultManagementType HasComponent GetResultListFiltered which should be of datatype --.\n",
      "The ResultManagementType HasComponent GetResultListFiltered Method which is Mandatory.\n",
      "The ResultManagementType HasComponent GetResultListFiltered which should be of type --.\n",
      "The ResultManagementType HasComponent ReleaseResultHandle which should be of datatype --.\n",
      "The ResultManagementType HasComponent ReleaseResultHandle Method which is Optional.\n",
      "The ResultManagementType HasComponent ReleaseResultHandle which should be of type --.\n",
      "The ResultManagementType HasComponent ResultTransfer which should be of datatype --.\n",
      "The ResultManagementType HasComponent ResultTransfer Object which is Optional.\n",
      "The ResultManagementType HasComponent ResultTransfer which should be of type ResultTransferType.\n",
      "The ResultManagementType HasComponent Results which should be of datatype --.\n",
      "The ResultManagementType HasComponent Results Object which is Optional.\n",
      "The ResultManagementType HasComponent Results which should be of type ResultFolderType.\n",
      "              0                                                 1  \\\n",
      "0     Attribute                                             Value   \n",
      "1    BrowseName                                  ResultFolderType   \n",
      "2    IsAbstract                                             False   \n",
      "3    References                                         NodeClass   \n",
      "4                Subtype of the FolderType defined in OPC 10000-5   \n",
      "5  HasComponent                                          Variable   \n",
      "\n",
      "                  2                 3               4                    5  \n",
      "0                                                                           \n",
      "1                                                                           \n",
      "2                                                                           \n",
      "3        BrowseName          DataType  TypeDefinition        ModellingRule  \n",
      "4                                                                           \n",
      "5  <ResultVariable>  ResultDataTy\\npe      ResultType  OptionalPlaceholder   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      " \n",
      "  \n",
      " \n",
      "  \n",
      "  \n",
      "   \n",
      "The ResultFolderType HasComponent <ResultVariable> which should be of datatype ResultDataTy\n",
      "pe.\n",
      "The ResultFolderType HasComponent <ResultVariable> Variable which is OptionalPlaceholder.\n",
      "The ResultFolderType HasComponent <ResultVariable> which should be of type ResultType.\n",
      "              0                                                  1  \\\n",
      "0     Attribute                                              Value   \n",
      "1    BrowseName                                 ResultTransferType   \n",
      "2    IsAbstract                                              False   \n",
      "3    References                                          NodeClass   \n",
      "4                Subtype of the TemporaryFileTransferType defin...   \n",
      "5  HasComponent                                             Method   \n",
      "\n",
      "                       2         3               4              5  \n",
      "0                                                                  \n",
      "1                                                                  \n",
      "2                                                                  \n",
      "3             BrowseName  DataType  TypeDefinition  ModellingRule  \n",
      "4                                                                  \n",
      "5  0:GenerateFileForRead        --              --      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      " \n",
      "  \n",
      " \n",
      "  \n",
      "  \n",
      "   \n",
      "The ResultTransferType HasComponent 0:GenerateFileForRead which should be of datatype --.\n",
      "The ResultTransferType HasComponent 0:GenerateFileForRead Method which is Mandatory.\n",
      "The ResultTransferType HasComponent 0:GenerateFileForRead which should be of type --.\n",
      "              0                                                  1  \\\n",
      "0     Attribute                                              Value   \n",
      "1    BrowseName                          SafetyStateManagementType   \n",
      "2    IsAbstract                                              False   \n",
      "3    References                                          NodeClass   \n",
      "4                Subtype of the BaseObjectType defined in OPC 1...   \n",
      "5  HasComponent                                             Method   \n",
      "6  HasComponent                                           Variable   \n",
      "7  HasComponent                                           Variable   \n",
      "\n",
      "                         2         3                     4              5  \n",
      "0                                                                          \n",
      "1                                                                          \n",
      "2                                                                          \n",
      "3               BrowseName  DataType        TypeDefinition  ModellingRule  \n",
      "4                                                                          \n",
      "5        ReportSafetyState        --                    --      Mandatory  \n",
      "6    VisionSafetyTriggered   Boolean  BaseDataVariableType      Mandatory  \n",
      "7  VisionSafetyInformation    String  BaseDataVariableType      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      " \n",
      "  \n",
      " \n",
      "  \n",
      "  \n",
      "   \n",
      "The SafetyStateManagementType HasComponent ReportSafetyState which should be of datatype --.\n",
      "The SafetyStateManagementType HasComponent ReportSafetyState Method which is Mandatory.\n",
      "The SafetyStateManagementType HasComponent ReportSafetyState which should be of type --.\n",
      "The SafetyStateManagementType HasComponent VisionSafetyTriggered which should be of datatype Boolean.\n",
      "The SafetyStateManagementType HasComponent VisionSafetyTriggered Variable which is Mandatory.\n",
      "The SafetyStateManagementType HasComponent VisionSafetyTriggered which should be of type BaseDataVariableType.\n",
      "The SafetyStateManagementType HasComponent VisionSafetyInformation which should be of datatype String.\n",
      "The SafetyStateManagementType HasComponent VisionSafetyInformation Variable which is Mandatory.\n",
      "The SafetyStateManagementType HasComponent VisionSafetyInformation which should be of type BaseDataVariableType.\n",
      "               0                                                  1  \\\n",
      "0      Attribute                                              Value   \n",
      "1                                                                     \n",
      "2     BrowseName                             VisionStateMachineType   \n",
      "3     IsAbstract                                              False   \n",
      "4     References                                       Node \\nClass   \n",
      "5                 Subtype of the FiniteStateMachineType defined ...   \n",
      "6   HasComponent                                             Object   \n",
      "7   HasComponent                                             Object   \n",
      "8   HasComponent                                             Object   \n",
      "9   HasComponent                                             Object   \n",
      "10  HasComponent                                             Object   \n",
      "11  HasComponent                                             Object   \n",
      "12  HasComponent                                             Object   \n",
      "13  HasComponent                                             Object   \n",
      "14  HasComponent                                             Object   \n",
      "15  HasComponent                                             Object   \n",
      "16  HasComponent                                             Object   \n",
      "17  HasComponent                                             Object   \n",
      "18  HasComponent                                             Object   \n",
      "19  HasComponent                                             Object   \n",
      "20  HasComponent                                             Object   \n",
      "21  HasComponent                                             Object   \n",
      "22  HasComponent                                             Object   \n",
      "23  HasComponent                                             Object   \n",
      "24  HasComponent                                             Object   \n",
      "25  HasComponent                                             Object   \n",
      "26  HasComponent                                             Object   \n",
      "27  HasComponent                                             Object   \n",
      "28  HasComponent                                             Object   \n",
      "29  HasComponent                                             Method   \n",
      "30  HasComponent                                             Method   \n",
      "31  HasComponent                                             Method   \n",
      "32  HasComponent                                             Method   \n",
      "33  HasComponent                                             Object   \n",
      "34  HasComponent                                             Object   \n",
      "35  HasComponent                                             Object   \n",
      "36  HasComponent                                             Object   \n",
      "\n",
      "                                                    2           3  \\\n",
      "0                                                                   \n",
      "1   Includes all attributes specified for the Fini...               \n",
      "2                                                                   \n",
      "3                                                                   \n",
      "4                                          BrowseName  Data\\nType   \n",
      "5                                                                   \n",
      "6                                      Preoperational          --   \n",
      "7                                              Halted          --   \n",
      "8                                               Error          --   \n",
      "9                                         Operational          --   \n",
      "10                             PreoperationalToHalted          --   \n",
      "11                         PreoperationalToHaltedAuto          --   \n",
      "12                          PreoperationalToErrorAuto          --   \n",
      "13                        PreoperationalToOperational          --   \n",
      "14                    PreoperationalToOperationalAuto          --   \n",
      "15                        PreoperationalToInitialized          --   \n",
      "16                    PreoperationalToInitializedAuto          --   \n",
      "17                             HaltedToPreoperational          --   \n",
      "18                         HaltedToPreoperationalAuto          --   \n",
      "19                              ErrorToPreoperational          --   \n",
      "20                          ErrorToPreoperationalAuto          --   \n",
      "21                                      ErrorToHalted          --   \n",
      "22                                  ErrorToHaltedAuto          --   \n",
      "23                             ErrorToOperationalAuto          --   \n",
      "24                        OperationalToPreoperational          --   \n",
      "25                    OperationalToPreoperationalAuto          --   \n",
      "26                                OperationalToHalted          --   \n",
      "27                            OperationalToHaltedAuto          --   \n",
      "28                             OperationalToErrorAuto          --   \n",
      "29                                              Reset          --   \n",
      "30                                               Halt          --   \n",
      "31                                SelectModeAutomatic          --   \n",
      "32                                         ConfirmAll          --   \n",
      "33                            PreoperationalStepModel          --   \n",
      "34                                    HaltedStepModel          --   \n",
      "35                                     ErrorStepModel          --   \n",
      "36                          AutomaticModeStateMachine          --   \n",
      "\n",
      "                                      4              5  \n",
      "0                                                       \n",
      "1                                                       \n",
      "2                                                       \n",
      "3                                                       \n",
      "4                        TypeDefinition  ModellingRule  \n",
      "5                                                       \n",
      "6                             StateType                 \n",
      "7                             StateType                 \n",
      "8                             StateType                 \n",
      "9                             StateType                 \n",
      "10                       TransitionType                 \n",
      "11                       TransitionType                 \n",
      "12                       TransitionType                 \n",
      "13                       TransitionType                 \n",
      "14                       TransitionType                 \n",
      "15                       TransitionType                 \n",
      "16                       TransitionType                 \n",
      "17                       TransitionType                 \n",
      "18                       TransitionType                 \n",
      "19                       TransitionType                 \n",
      "20                       TransitionType                 \n",
      "21                       TransitionType                 \n",
      "22                       TransitionType                 \n",
      "23                       TransitionType                 \n",
      "24                       TransitionType                 \n",
      "25                       TransitionType                 \n",
      "26                       TransitionType                 \n",
      "27                       TransitionType                 \n",
      "28                       TransitionType                 \n",
      "29                                   --      Mandatory  \n",
      "30                                   --      Mandatory  \n",
      "31                                   --       Optional  \n",
      "32                                   --       Optional  \n",
      "33      VisionStepModelStateMachineType       Optional  \n",
      "34      VisionStepModelStateMachineType       Optional  \n",
      "35      VisionStepModelStateMachineType       Optional  \n",
      "36  VisionAutomaticModeStateMachineType       Optional   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "  \n",
      "  \n",
      "   \n",
      "The Includes all attributes specified for the FiniteStateMachineType References BrowseName which should be of datatype Data\n",
      "Type.\n",
      "  \n",
      " \n",
      "  \n",
      "  \n",
      "   \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent Preoperational which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent Preoperational which should be of type StateType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent Halted which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent Halted which should be of type StateType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent Error which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent Error which should be of type StateType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent Operational which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent Operational which should be of type StateType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent PreoperationalToHalted which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent PreoperationalToHalted which should be of type TransitionType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent PreoperationalToHaltedAuto which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent PreoperationalToHaltedAuto which should be of type TransitionType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent PreoperationalToErrorAuto which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent PreoperationalToErrorAuto which should be of type TransitionType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent PreoperationalToOperational which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent PreoperationalToOperational which should be of type TransitionType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent PreoperationalToOperationalAuto which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent PreoperationalToOperationalAuto which should be of type TransitionType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent PreoperationalToInitialized which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent PreoperationalToInitialized which should be of type TransitionType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent PreoperationalToInitializedAuto which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent PreoperationalToInitializedAuto which should be of type TransitionType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent HaltedToPreoperational which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent HaltedToPreoperational which should be of type TransitionType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent HaltedToPreoperationalAuto which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent HaltedToPreoperationalAuto which should be of type TransitionType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent ErrorToPreoperational which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent ErrorToPreoperational which should be of type TransitionType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent ErrorToPreoperationalAuto which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent ErrorToPreoperationalAuto which should be of type TransitionType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent ErrorToHalted which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent ErrorToHalted which should be of type TransitionType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent ErrorToHaltedAuto which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent ErrorToHaltedAuto which should be of type TransitionType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent ErrorToOperationalAuto which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent ErrorToOperationalAuto which should be of type TransitionType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent OperationalToPreoperational which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent OperationalToPreoperational which should be of type TransitionType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent OperationalToPreoperationalAuto which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent OperationalToPreoperationalAuto which should be of type TransitionType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent OperationalToHalted which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent OperationalToHalted which should be of type TransitionType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent OperationalToHaltedAuto which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent OperationalToHaltedAuto which should be of type TransitionType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent OperationalToErrorAuto which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent OperationalToErrorAuto which should be of type TransitionType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent Reset which should be of datatype --.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent Reset Method which is Mandatory.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent Reset which should be of type --.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent Halt which should be of datatype --.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent Halt Method which is Mandatory.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent Halt which should be of type --.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent SelectModeAutomatic which should be of datatype --.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent SelectModeAutomatic Method which is Optional.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent SelectModeAutomatic which should be of type --.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent ConfirmAll which should be of datatype --.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent ConfirmAll Method which is Optional.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent ConfirmAll which should be of type --.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent PreoperationalStepModel which should be of datatype --.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent PreoperationalStepModel Object which is Optional.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent PreoperationalStepModel which should be of type VisionStepModelStateMachineType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent HaltedStepModel which should be of datatype --.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent HaltedStepModel Object which is Optional.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent HaltedStepModel which should be of type VisionStepModelStateMachineType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent ErrorStepModel which should be of datatype --.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent ErrorStepModel Object which is Optional.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent ErrorStepModel which should be of type VisionStepModelStateMachineType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent AutomaticModeStateMachine which should be of datatype --.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent AutomaticModeStateMachine Object which is Optional.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent AutomaticModeStateMachine which should be of type VisionAutomaticModeStateMachineType.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "            0                                                  1           2  \\\n",
      "0   Attribute                                              Value               \n",
      "1  BrowseName                              StateChangedEventType               \n",
      "2  IsAbstract                                              False               \n",
      "3  References                                          NodeClass  BrowseName   \n",
      "4              Subtype of the TransitionEventType defined in ...               \n",
      "\n",
      "          3               4              5  \n",
      "0                                           \n",
      "1                                           \n",
      "2                                           \n",
      "3  DataType  TypeDefinition  ModellingRule  \n",
      "4                                            \n",
      "----------------------------------------------------------------------\n",
      "\n",
      " \n",
      "  \n",
      " \n",
      "  \n",
      "  \n",
      "   \n",
      "            0                                                  1           2  \\\n",
      "0  References                                          NodeClass  BrowseName   \n",
      "1              Subtype of the TransitionEventType defined in ...               \n",
      "\n",
      "          3               4              5  \n",
      "0  DataType  TypeDefinition  ModellingRule  \n",
      "1                                            \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "            0                                                  1           2  \\\n",
      "0   Attribute                                              Value               \n",
      "1  BrowseName                             ErrorResolvedEventType               \n",
      "2  IsAbstract                                              False               \n",
      "3  References                                          NodeClass  BrowseName   \n",
      "4              Subtype of the TransitionEventType defined in ...               \n",
      "\n",
      "          3               4              5  \n",
      "0                                           \n",
      "1                                           \n",
      "2                                           \n",
      "3  DataType  TypeDefinition  ModellingRule  \n",
      "4                                            \n",
      "----------------------------------------------------------------------\n",
      "\n",
      " \n",
      "  \n",
      " \n",
      "  \n",
      "  \n",
      "   \n",
      "               0                                                  1  \\\n",
      "0      Attribute                                              Value   \n",
      "1                                                                     \n",
      "2     BrowseName                VisionAutomaticModeStateMachineType   \n",
      "3     IsAbstract                                              False   \n",
      "4                                                                     \n",
      "5     References                                          NodeClass   \n",
      "6                 Subtype of the FiniteStateMachineType defined ...   \n",
      "7   HasComponent                                             Object   \n",
      "8   HasComponent                                             Object   \n",
      "9   HasComponent                                             Object   \n",
      "10  HasComponent                                             Object   \n",
      "11  HasComponent                                             Object   \n",
      "12  HasComponent                                             Object   \n",
      "13  HasComponent                                             Object   \n",
      "14  HasComponent                                             Object   \n",
      "15  HasComponent                                             Object   \n",
      "16  HasComponent                                             Object   \n",
      "17  HasComponent                                             Object   \n",
      "18  HasComponent                                             Object   \n",
      "19  HasComponent                                             Object   \n",
      "20  HasComponent                                             Object   \n",
      "21  HasComponent                                             Object   \n",
      "22  HasComponent                                             Object   \n",
      "23  HasComponent                                             Object   \n",
      "24  HasComponent                                             Object   \n",
      "25  HasComponent                                             Object   \n",
      "26  HasComponent                                             Object   \n",
      "27  HasComponent                                             Method   \n",
      "28  HasComponent                                             Method   \n",
      "29  HasComponent                                             Method   \n",
      "30  HasComponent                                             Method   \n",
      "31  HasComponent                                             Method   \n",
      "32  HasComponent                                             Object   \n",
      "33  HasComponent                                             Object   \n",
      "34  HasComponent                                             Object   \n",
      "35  HasComponent                                             Object   \n",
      "\n",
      "                                                    2            3  \\\n",
      "0                                                                    \n",
      "1   Includes all attributes specified for the Fini...                \n",
      "2                                                                    \n",
      "3                                                                    \n",
      "4                                                                    \n",
      "5                                          BrowseName  Data \\nType   \n",
      "6                                                                    \n",
      "7                                         Initialized           --   \n",
      "8                                               Ready           --   \n",
      "9                                     SingleExecution           --   \n",
      "10                                ContinuousExecution           --   \n",
      "11                           InitializedToReadyRecipe           --   \n",
      "12                          InitializedToReadyProduct           --   \n",
      "13                             InitializedToReadyAuto           --   \n",
      "14                           ReadyToInitializedRecipe           --   \n",
      "15                          ReadyToInitializedProduct           --   \n",
      "16                             ReadyToInitializedAuto           --   \n",
      "17                             ReadyToSingleExecution           --   \n",
      "18                         ReadyToSingleExecutionAuto           --   \n",
      "19                         ReadyToContinuousExecution           --   \n",
      "20                     ReadyToContinuousExecutionAuto           --   \n",
      "21                         SingleExecutionToReadyStop           --   \n",
      "22                        SingleExecutionToReadyAbort           --   \n",
      "23                         SingleExecutionToReadyAuto           --   \n",
      "24                     ContinuousExecutionToReadyStop           --   \n",
      "25                  ContinuousExecutionToReadyAbor\\nt           --   \n",
      "26                     ContinuousExecutionToReadyAuto           --   \n",
      "27                                               Stop           --   \n",
      "28                                              Abort           --   \n",
      "29                                     StartSingleJob           --   \n",
      "30                                    StartContinuous           --   \n",
      "31                                     SimulationMode           --   \n",
      "32                               InitializedStepModel           --   \n",
      "33                                     ReadyStepModel           --   \n",
      "34                           SingleExecutionStepModel           --   \n",
      "35                       ContinuousExecutionStepModel           --   \n",
      "\n",
      "                                  4              5  \n",
      "0                                                   \n",
      "1                                                   \n",
      "2                                                   \n",
      "3                                                   \n",
      "4                                                   \n",
      "5                    TypeDefinition  ModellingRule  \n",
      "6                                                   \n",
      "7                         StateType                 \n",
      "8                         StateType                 \n",
      "9                         StateType                 \n",
      "10                        StateType                 \n",
      "11                   TransitionType                 \n",
      "12                   TransitionType                 \n",
      "13                   TransitionType                 \n",
      "14                   TransitionType                 \n",
      "15                   TransitionType                 \n",
      "16                   TransitionType                 \n",
      "17                   TransitionType                 \n",
      "18                   TransitionType                 \n",
      "19                   TransitionType                 \n",
      "20                   TransitionType                 \n",
      "21                   TransitionType                 \n",
      "22                   TransitionType                 \n",
      "23                   TransitionType                 \n",
      "24                   TransitionType                 \n",
      "25                   TransitionType                 \n",
      "26                   TransitionType                 \n",
      "27                                       Mandatory  \n",
      "28                                       Mandatory  \n",
      "29                                       Mandatory  \n",
      "30                                       Mandatory  \n",
      "31                                        Optional  \n",
      "32  VisionStepModelStateMachineType       Optional  \n",
      "33  VisionStepModelStateMachineType       Optional  \n",
      "34  VisionStepModelStateMachineType       Optional  \n",
      "35  VisionStepModelStateMachineType       Optional   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "  \n",
      "  \n",
      "   \n",
      "  \n",
      "  \n",
      "   \n",
      "The Includes all attributes specified for the FiniteStateMachineType References BrowseName which should be of datatype Data \n",
      "Type.\n",
      "  \n",
      " \n",
      "  \n",
      "  \n",
      "   \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent Initialized which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent Initialized which should be of type StateType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent Ready which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent Ready which should be of type StateType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent SingleExecution which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent SingleExecution which should be of type StateType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent ContinuousExecution which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent ContinuousExecution which should be of type StateType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent InitializedToReadyRecipe which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent InitializedToReadyRecipe which should be of type TransitionType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent InitializedToReadyProduct which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent InitializedToReadyProduct which should be of type TransitionType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent InitializedToReadyAuto which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent InitializedToReadyAuto which should be of type TransitionType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent ReadyToInitializedRecipe which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent ReadyToInitializedRecipe which should be of type TransitionType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent ReadyToInitializedProduct which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent ReadyToInitializedProduct which should be of type TransitionType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent ReadyToInitializedAuto which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent ReadyToInitializedAuto which should be of type TransitionType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent ReadyToSingleExecution which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent ReadyToSingleExecution which should be of type TransitionType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent ReadyToSingleExecutionAuto which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent ReadyToSingleExecutionAuto which should be of type TransitionType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent ReadyToContinuousExecution which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent ReadyToContinuousExecution which should be of type TransitionType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent ReadyToContinuousExecutionAuto which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent ReadyToContinuousExecutionAuto which should be of type TransitionType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent SingleExecutionToReadyStop which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent SingleExecutionToReadyStop which should be of type TransitionType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent SingleExecutionToReadyAbort which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent SingleExecutionToReadyAbort which should be of type TransitionType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent SingleExecutionToReadyAuto which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent SingleExecutionToReadyAuto which should be of type TransitionType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent ContinuousExecutionToReadyStop which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent ContinuousExecutionToReadyStop which should be of type TransitionType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent ContinuousExecutionToReadyAbor\n",
      "t which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent ContinuousExecutionToReadyAbor\n",
      "t which should be of type TransitionType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent ContinuousExecutionToReadyAuto which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent ContinuousExecutionToReadyAuto which should be of type TransitionType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent Stop which should be of datatype --.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent Stop Method which is Mandatory.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent Stop which should be of type .\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent Abort which should be of datatype --.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent Abort Method which is Mandatory.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent Abort which should be of type .\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent StartSingleJob which should be of datatype --.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent StartSingleJob Method which is Mandatory.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent StartSingleJob which should be of type .\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent StartContinuous which should be of datatype --.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent StartContinuous Method which is Mandatory.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent StartContinuous which should be of type .\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent SimulationMode which should be of datatype --.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent SimulationMode Method which is Optional.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent SimulationMode which should be of type .\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent InitializedStepModel which should be of datatype --.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent InitializedStepModel Object which is Optional.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent InitializedStepModel which should be of type VisionStepModelStateMachineType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent ReadyStepModel which should be of datatype --.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent ReadyStepModel Object which is Optional.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent ReadyStepModel which should be of type VisionStepModelStateMachineType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent SingleExecutionStepModel which should be of datatype --.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent SingleExecutionStepModel Object which is Optional.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent SingleExecutionStepModel which should be of type VisionStepModelStateMachineType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent ContinuousExecutionStepModel which should be of datatype --.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent ContinuousExecutionStepModel Object which is Optional.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent ContinuousExecutionStepModel which should be of type VisionStepModelStateMachineType.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "            0               1           2         3               4  \\\n",
      "0   Attribute           Value                                         \n",
      "1  BrowseName  StartSingleJob                                         \n",
      "2  References       NodeClass  BrowseName  DataType  TypeDefinition   \n",
      "\n",
      "               5  \n",
      "0                 \n",
      "1                 \n",
      "2  ModellingRule   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "             0                                                  1           2  \\\n",
      "0    Attribute                                              Value               \n",
      "1   BrowseName                            RecipePreparedEventType               \n",
      "2   IsAbstract                                              False               \n",
      "3   References                                          NodeClass  BrowseName   \n",
      "4               Subtype of the BaseEventType defined in OPC 10...               \n",
      "5  HasProperty                                           Variable  ExternalId   \n",
      "6  HasProperty                                           Variable  InternalId   \n",
      "7  HasProperty                                           Variable   ProductId   \n",
      "\n",
      "                          3               4              5  \n",
      "0                                                           \n",
      "1                                                           \n",
      "2                                                           \n",
      "3                  DataType  TypeDefinition  ModellingRule  \n",
      "4                                                           \n",
      "5  RecipeIdExternalDataType    PropertyType       Optional  \n",
      "6  RecipeIdInternalDataType    PropertyType      Mandatory  \n",
      "7         ProductIdDataType    PropertyType       Optional   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      " \n",
      "  \n",
      " \n",
      "  \n",
      "  \n",
      "   \n",
      "The RecipePreparedEventType HasProperty ExternalId which should be of datatype RecipeIdExternalDataType.\n",
      "The RecipePreparedEventType HasProperty ExternalId Variable which is Optional.\n",
      "The RecipePreparedEventType HasProperty ExternalId which should be of type PropertyType.\n",
      "The RecipePreparedEventType HasProperty InternalId which should be of datatype RecipeIdInternalDataType.\n",
      "The RecipePreparedEventType HasProperty InternalId Variable which is Mandatory.\n",
      "The RecipePreparedEventType HasProperty InternalId which should be of type PropertyType.\n",
      "The RecipePreparedEventType HasProperty ProductId which should be of datatype ProductIdDataType.\n",
      "The RecipePreparedEventType HasProperty ProductId Variable which is Optional.\n",
      "The RecipePreparedEventType HasProperty ProductId which should be of type PropertyType.\n",
      "             0                                                  1           2  \\\n",
      "0    Attribute                                              Value               \n",
      "1   BrowseName                                JobStartedEventType               \n",
      "2   IsAbstract                                              False               \n",
      "3   References                                          NodeClass  BrowseName   \n",
      "4               Subtype of the BaseEventType defined in OPC 10...               \n",
      "5  HasProperty                                           Variable       JobId   \n",
      "\n",
      "               3               4              5  \n",
      "0                                                \n",
      "1                                                \n",
      "2                                                \n",
      "3       DataType  TypeDefinition  ModellingRule  \n",
      "4                                                \n",
      "5  JobIdDataType    PropertyType      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      " \n",
      "  \n",
      " \n",
      "  \n",
      "  \n",
      "   \n",
      "The JobStartedEventType HasProperty JobId which should be of datatype JobIdDataType.\n",
      "The JobStartedEventType HasProperty JobId Variable which is Mandatory.\n",
      "The JobStartedEventType HasProperty JobId which should be of type PropertyType.\n",
      "             0                                                  1           2  \\\n",
      "0    Attribute                                              Value               \n",
      "1   BrowseName                                     ReadyEventType               \n",
      "2   IsAbstract                                              False               \n",
      "3   References                                          NodeClass  BrowseName   \n",
      "4               Subtype of the BaseEventType defined in OPC 10...               \n",
      "5  HasProperty                                           Variable       JobId   \n",
      "\n",
      "               3               4              5  \n",
      "0                                                \n",
      "1                                                \n",
      "2                                                \n",
      "3       DataType  TypeDefinition  ModellingRule  \n",
      "4                                                \n",
      "5  JobIdDataType    PropertyType      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      " \n",
      "  \n",
      " \n",
      "  \n",
      "  \n",
      "   \n",
      "The ReadyEventType HasProperty JobId which should be of datatype JobIdDataType.\n",
      "The ReadyEventType HasProperty JobId Variable which is Mandatory.\n",
      "The ReadyEventType HasProperty JobId which should be of type PropertyType.\n",
      "              0                                                  1  \\\n",
      "0     Attribute                                              Value   \n",
      "1    BrowseName                               ResultReadyEventType   \n",
      "2    IsAbstract                                              False   \n",
      "3    References                                          NodeClass   \n",
      "4                Subtype of the BaseEventType defined in OPC 10...   \n",
      "5   HasProperty                                           Variable   \n",
      "6   HasProperty                                           Variable   \n",
      "7   HasProperty                                           Variable   \n",
      "8   HasProperty                                           Variable   \n",
      "9   HasProperty                                           Variable   \n",
      "10  HasProperty                                           Variable   \n",
      "\n",
      "                   2                         3             4  \\\n",
      "0                                                              \n",
      "1                                                              \n",
      "2                                                              \n",
      "3         BrowseName                  DataType                 \n",
      "4                                                              \n",
      "5          IsPartial                   Boolean  PropertyType   \n",
      "6        IsSimulated                   Boolean  PropertyType   \n",
      "7        ResultState       ResultStateDataType  PropertyType   \n",
      "8             MeasId            MeasIdDataType  PropertyType   \n",
      "9             PartId            PartIdDataType  PropertyType   \n",
      "10  ExternalRecipeId  RecipeIdExternalDataType  PropertyType   \n",
      "\n",
      "                                5  \n",
      "0                                  \n",
      "1                                  \n",
      "2                                  \n",
      "3   TypeDefinition  ModellingRule  \n",
      "4                                  \n",
      "5                       Mandatory  \n",
      "6                        Optional  \n",
      "7                       Mandatory  \n",
      "8                        Optional  \n",
      "9                        Optional  \n",
      "10                       Optional   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      " \n",
      "  \n",
      " \n",
      "  \n",
      "  \n",
      "   \n",
      "The ResultReadyEventType HasProperty IsPartial which should be of datatype Boolean.\n",
      "The ResultReadyEventType HasProperty IsPartial Variable which is Mandatory.\n",
      "The ResultReadyEventType HasProperty IsPartial which should be of type PropertyType.\n",
      "The ResultReadyEventType HasProperty IsSimulated which should be of datatype Boolean.\n",
      "The ResultReadyEventType HasProperty IsSimulated Variable which is Optional.\n",
      "The ResultReadyEventType HasProperty IsSimulated which should be of type PropertyType.\n",
      "The ResultReadyEventType HasProperty ResultState which should be of datatype ResultStateDataType.\n",
      "The ResultReadyEventType HasProperty ResultState Variable which is Mandatory.\n",
      "The ResultReadyEventType HasProperty ResultState which should be of type PropertyType.\n",
      "The ResultReadyEventType HasProperty MeasId which should be of datatype MeasIdDataType.\n",
      "The ResultReadyEventType HasProperty MeasId Variable which is Optional.\n",
      "The ResultReadyEventType HasProperty MeasId which should be of type PropertyType.\n",
      "The ResultReadyEventType HasProperty PartId which should be of datatype PartIdDataType.\n",
      "The ResultReadyEventType HasProperty PartId Variable which is Optional.\n",
      "The ResultReadyEventType HasProperty PartId which should be of type PropertyType.\n",
      "The ResultReadyEventType HasProperty ExternalRecipeId which should be of datatype RecipeIdExternalDataType.\n",
      "The ResultReadyEventType HasProperty ExternalRecipeId Variable which is Optional.\n",
      "The ResultReadyEventType HasProperty ExternalRecipeId which should be of type PropertyType.\n",
      "             0                                                  1           2  \\\n",
      "0    Attribute                                              Value               \n",
      "1   BrowseName                           AcquisitionDoneEventType               \n",
      "2   IsAbstract                                              False               \n",
      "3   References                                          NodeClass  BrowseName   \n",
      "4               Subtype of the BaseEventType defined in OPC 10...               \n",
      "5  HasProperty                                           Variable       JobId   \n",
      "\n",
      "               3               4              5  \n",
      "0                                                \n",
      "1                                                \n",
      "2                                                \n",
      "3       DataType  TypeDefinition  ModellingRule  \n",
      "4                                                \n",
      "5  JobIdDataType    PropertyType      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      " \n",
      "  \n",
      " \n",
      "  \n",
      "  \n",
      "   \n",
      "The AcquisitionDoneEventType HasProperty JobId which should be of datatype JobIdDataType.\n",
      "The AcquisitionDoneEventType HasProperty JobId Variable which is Mandatory.\n",
      "The AcquisitionDoneEventType HasProperty JobId which should be of type PropertyType.\n",
      "               0                                                  1  \\\n",
      "0      Attribute                                              Value   \n",
      "1                                                                     \n",
      "2     BrowseName                    VisionStepModelStateMachineType   \n",
      "3     IsAbstract                                              False   \n",
      "4     References                                          NodeClass   \n",
      "5                 Subtype of the FiniteStateMachineType defined ...   \n",
      "6   HasComponent                                             Object   \n",
      "7   HasComponent                                             Object   \n",
      "8   HasComponent                                             Object   \n",
      "9   HasComponent                                             Object   \n",
      "10  HasComponent                                             Object   \n",
      "11  HasComponent                                             Object   \n",
      "12  HasComponent                                             Object   \n",
      "13  HasComponent                                             Object   \n",
      "14  HasComponent                                             Object   \n",
      "15  HasComponent                                             Object   \n",
      "16  HasComponent                                             Method   \n",
      "\n",
      "                                                    2         3  \\\n",
      "0                                                                 \n",
      "1   Includes all attributes specified for the Fini...             \n",
      "2                                                                 \n",
      "3                                                                 \n",
      "4                                          BrowseName  DataType   \n",
      "5                                                                 \n",
      "6                                               Entry        --   \n",
      "7                                                Exit        --   \n",
      "8                                                Wait        --   \n",
      "9                                                Step        --   \n",
      "10                                    EntryToExitAuto        --   \n",
      "11                                    EntryToWaitAuto        --   \n",
      "12                                         WaitToStep        --   \n",
      "13                                     WaitToStepAuto        --   \n",
      "14                                     StepToExitAuto        --   \n",
      "15                                     StepToWaitAuto        --   \n",
      "16                                               Sync        --   \n",
      "\n",
      "                   4              5  \n",
      "0                                    \n",
      "1                                    \n",
      "2                                    \n",
      "3                                    \n",
      "4     TypeDefinition  ModellingRule  \n",
      "5                                    \n",
      "6   InitialStateType             --  \n",
      "7          StateType             --  \n",
      "8          StateType             --  \n",
      "9          StateType             --  \n",
      "10    TransitionType             --  \n",
      "11    TransitionType             --  \n",
      "12    TransitionType             --  \n",
      "13    TransitionType             --  \n",
      "14    TransitionType             --  \n",
      "15    TransitionType             --  \n",
      "16                --      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "  \n",
      "  \n",
      "   \n",
      " \n",
      "  \n",
      " \n",
      "  \n",
      "  \n",
      "   \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent Entry which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent Entry which should be of type InitialStateType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent Exit which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent Exit which should be of type StateType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent Wait which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent Wait which should be of type StateType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent Step which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent Step which should be of type StateType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent EntryToExitAuto which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent EntryToExitAuto which should be of type TransitionType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent EntryToWaitAuto which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent EntryToWaitAuto which should be of type TransitionType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent WaitToStep which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent WaitToStep which should be of type TransitionType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent WaitToStepAuto which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent WaitToStepAuto which should be of type TransitionType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent StepToExitAuto which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent StepToExitAuto which should be of type TransitionType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent StepToWaitAuto which should be of datatype --.\n",
      "  \n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent StepToWaitAuto which should be of type TransitionType.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent Sync which should be of datatype --.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent Sync Method which is Mandatory.\n",
      "The Includes all attributes specified for the FiniteStateMachineType HasComponent Sync which should be of type --.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "             0                                                  1           2  \\\n",
      "0    Attribute                                              Value               \n",
      "1   BrowseName                         EnterStepSequenceEventType               \n",
      "2   IsAbstract                                              False               \n",
      "3   References                                          NodeClass  BrowseName   \n",
      "4               Subtype of the BaseEventType defined in OPC 10...               \n",
      "5  HasProperty                                           Variable       Steps   \n",
      "\n",
      "          3               4              5  \n",
      "0                                           \n",
      "1                                           \n",
      "2                                           \n",
      "3  DataType  TypeDefinition  ModellingRule  \n",
      "4                                           \n",
      "5     Int32    PropertyType      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      " \n",
      "  \n",
      " \n",
      "  \n",
      "  \n",
      "   \n",
      "The EnterStepSequenceEventType HasProperty Steps which should be of datatype Int32.\n",
      "The EnterStepSequenceEventType HasProperty Steps Variable which is Mandatory.\n",
      "The EnterStepSequenceEventType HasProperty Steps which should be of type PropertyType.\n",
      "             0                                                  1           2  \\\n",
      "0    Attribute                                              Value               \n",
      "1   BrowseName                                  NextStepEventType               \n",
      "2   IsAbstract                                              False               \n",
      "3   References                                          NodeClass  BrowseName   \n",
      "4               Subtype of the BaseEventType defined in OPC 10...               \n",
      "5  HasProperty                                           Variable        Step   \n",
      "\n",
      "          3               4              5  \n",
      "0                                           \n",
      "1                                           \n",
      "2                                           \n",
      "3  DataType  TypeDefinition  ModellingRule  \n",
      "4                                           \n",
      "5     Int32    PropertyType      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      " \n",
      "  \n",
      " \n",
      "  \n",
      "  \n",
      "   \n",
      "The NextStepEventType HasProperty Step which should be of datatype Int32.\n",
      "The NextStepEventType HasProperty Step Variable which is Mandatory.\n",
      "The NextStepEventType HasProperty Step which should be of type PropertyType.\n",
      "            0                                                  1           2  \\\n",
      "0   Attribute                                              Value               \n",
      "1  BrowseName                         LeaveStepSequenceEventType               \n",
      "2  IsAbstract                                              False               \n",
      "3  References                                          NodeClass  BrowseName   \n",
      "4              Subtype of the BaseEventType defined in OPC 10...               \n",
      "\n",
      "          3               4              5  \n",
      "0                                           \n",
      "1                                           \n",
      "2                                           \n",
      "3  DataType  TypeDefinition  ModellingRule  \n",
      "4                                            \n",
      "----------------------------------------------------------------------\n",
      "\n",
      " \n",
      "  \n",
      " \n",
      "  \n",
      "  \n",
      "   \n",
      "              0                                                  1  \\\n",
      "0     Attribute                                              Value   \n",
      "1    BrowseName                                    VisionEventType   \n",
      "2    IsAbstract                                               True   \n",
      "3    References                                          NodeClass   \n",
      "4                Subtype of the BaseEventType defined in OPC 10...   \n",
      "5    HasSubtype                                         ObjectType   \n",
      "6    HasSubtype                                         ObjectType   \n",
      "7                                                                    \n",
      "8   HasProperty                                           Variable   \n",
      "9   HasProperty                                           Variable   \n",
      "10  HasProperty                                           Variable   \n",
      "11  HasProperty                                           Variable   \n",
      "12  HasProperty                                           Variable   \n",
      "13  HasProperty                                           Variable   \n",
      "14  HasProperty                                           Variable   \n",
      "15  HasProperty                                           Variable   \n",
      "16  HasProperty                                           Variable   \n",
      "17  HasProperty                                           Variable   \n",
      "\n",
      "                                2                         3               4  \\\n",
      "0                                                                             \n",
      "1                                                                             \n",
      "2                                                                             \n",
      "3                      BrowseName                  DataType  TypeDefinition   \n",
      "4                                                                             \n",
      "5   VisionDiagnosticInfoEventType         Defined in 11.4.2                   \n",
      "6      VisionInformationEventType         Defined in 11.4.3                   \n",
      "7                                                                             \n",
      "8                       CausePath                    String    PropertyType   \n",
      "9                          MeasId            MeasIdDataType    PropertyType   \n",
      "10                         PartId            PartIdDataType    PropertyType   \n",
      "11               ExternalRecipeId  RecipeIdExternalDataType    PropertyType   \n",
      "12               InternalRecipeId  RecipeIdInternalDataType    PropertyType   \n",
      "13                      ProductId         ProductIdDataType    PropertyType   \n",
      "14        ExternalConfigurationId   ConfigurationIdDataType    PropertyType   \n",
      "15        InternalConfigurationId   ConfigurationIdDataType    PropertyType   \n",
      "16                          JobId             JobIdDataType    PropertyType   \n",
      "17                       ResultId          ResultIdDataType    PropertyType   \n",
      "\n",
      "                5  \n",
      "0                  \n",
      "1                  \n",
      "2                  \n",
      "3   ModellingRule  \n",
      "4                  \n",
      "5                  \n",
      "6                  \n",
      "7                  \n",
      "8        Optional  \n",
      "9        Optional  \n",
      "10       Optional  \n",
      "11       Optional  \n",
      "12       Optional  \n",
      "13       Optional  \n",
      "14       Optional  \n",
      "15       Optional  \n",
      "16       Optional  \n",
      "17       Optional   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      " \n",
      "  \n",
      " \n",
      "  \n",
      "  \n",
      "   \n",
      "The VisionEventType HasSubtype VisionDiagnosticInfoEventType which should be of datatype Defined in 11.4.2.\n",
      "  \n",
      "The VisionEventType HasSubtype VisionDiagnosticInfoEventType which should be of type .\n",
      "The VisionEventType HasSubtype VisionInformationEventType which should be of datatype Defined in 11.4.3.\n",
      "  \n",
      "The VisionEventType HasSubtype VisionInformationEventType which should be of type .\n",
      "  \n",
      "  \n",
      "   \n",
      "The VisionEventType HasProperty CausePath which should be of datatype String.\n",
      "The VisionEventType HasProperty CausePath Variable which is Optional.\n",
      "The VisionEventType HasProperty CausePath which should be of type PropertyType.\n",
      "The VisionEventType HasProperty MeasId which should be of datatype MeasIdDataType.\n",
      "The VisionEventType HasProperty MeasId Variable which is Optional.\n",
      "The VisionEventType HasProperty MeasId which should be of type PropertyType.\n",
      "The VisionEventType HasProperty PartId which should be of datatype PartIdDataType.\n",
      "The VisionEventType HasProperty PartId Variable which is Optional.\n",
      "The VisionEventType HasProperty PartId which should be of type PropertyType.\n",
      "The VisionEventType HasProperty ExternalRecipeId which should be of datatype RecipeIdExternalDataType.\n",
      "The VisionEventType HasProperty ExternalRecipeId Variable which is Optional.\n",
      "The VisionEventType HasProperty ExternalRecipeId which should be of type PropertyType.\n",
      "The VisionEventType HasProperty InternalRecipeId which should be of datatype RecipeIdInternalDataType.\n",
      "The VisionEventType HasProperty InternalRecipeId Variable which is Optional.\n",
      "The VisionEventType HasProperty InternalRecipeId which should be of type PropertyType.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The VisionEventType HasProperty ProductId which should be of datatype ProductIdDataType.\n",
      "The VisionEventType HasProperty ProductId Variable which is Optional.\n",
      "The VisionEventType HasProperty ProductId which should be of type PropertyType.\n",
      "The VisionEventType HasProperty ExternalConfigurationId which should be of datatype ConfigurationIdDataType.\n",
      "The VisionEventType HasProperty ExternalConfigurationId Variable which is Optional.\n",
      "The VisionEventType HasProperty ExternalConfigurationId which should be of type PropertyType.\n",
      "The VisionEventType HasProperty InternalConfigurationId which should be of datatype ConfigurationIdDataType.\n",
      "The VisionEventType HasProperty InternalConfigurationId Variable which is Optional.\n",
      "The VisionEventType HasProperty InternalConfigurationId which should be of type PropertyType.\n",
      "The VisionEventType HasProperty JobId which should be of datatype JobIdDataType.\n",
      "The VisionEventType HasProperty JobId Variable which is Optional.\n",
      "The VisionEventType HasProperty JobId which should be of type PropertyType.\n",
      "The VisionEventType HasProperty ResultId which should be of datatype ResultIdDataType.\n",
      "The VisionEventType HasProperty ResultId Variable which is Optional.\n",
      "The VisionEventType HasProperty ResultId which should be of type PropertyType.\n",
      "                                0                              1           2  \\\n",
      "0                       Attribute                          Value               \n",
      "1                      BrowseName  VisionDiagnosticInfoEventType               \n",
      "2                      IsAbstract                          False               \n",
      "3                      References                      NodeClass  BrowseName   \n",
      "4  Subtype of the VisionEventType                                              \n",
      "\n",
      "          3               4              5  \n",
      "0                                           \n",
      "1                                           \n",
      "2                                           \n",
      "3  DataType  TypeDefinition  ModellingRule  \n",
      "4                                            \n",
      "----------------------------------------------------------------------\n",
      "\n",
      " \n",
      "  \n",
      " \n",
      "  \n",
      "  \n",
      "   \n",
      "                                0                           1           2  \\\n",
      "0                       Attribute                       Value               \n",
      "1                      BrowseName  VisionInformationEventType               \n",
      "2                      IsAbstract                       False               \n",
      "3                      References                   NodeClass  BrowseName   \n",
      "4  Subtype of the VisionEventType                                           \n",
      "\n",
      "          3               4              5  \n",
      "0                                           \n",
      "1                                           \n",
      "2                                           \n",
      "3  DataType  TypeDefinition  ModellingRule  \n",
      "4                                            \n",
      "----------------------------------------------------------------------\n",
      "\n",
      " \n",
      "  \n",
      " \n",
      "  \n",
      "  \n",
      "   \n",
      "              0                                                  1  \\\n",
      "0     Attribute                                              Value   \n",
      "1    BrowseName                                VisionConditionType   \n",
      "2    IsAbstract                                               True   \n",
      "3    References                                          NodeClass   \n",
      "4                Subtype of the AcknowledgeableConditionType de...   \n",
      "5    HasSubtype                                         ObjectType   \n",
      "6    HasSubtype                                         ObjectType   \n",
      "7    HasSubtype                                         ObjectType   \n",
      "8                                                                    \n",
      "9   HasProperty                                           Variable   \n",
      "10  HasProperty                                           Variable   \n",
      "11  HasProperty                                           Variable   \n",
      "12  HasProperty                                           Variable   \n",
      "13  HasProperty                                           Variable   \n",
      "14  HasProperty                                           Variable   \n",
      "15  HasProperty                                           Variable   \n",
      "16  HasProperty                                           Variable   \n",
      "17  HasProperty                                           Variable   \n",
      "18  HasProperty                                           Variable   \n",
      "19  HasProperty                                           Variable   \n",
      "20  HasProperty                                           Variable   \n",
      "21  HasProperty                                           Variable   \n",
      "22  HasProperty                                           Variable   \n",
      "\n",
      "                                     2                         3  \\\n",
      "0                                                                  \n",
      "1                                                                  \n",
      "2                                                                  \n",
      "3                           BrowseName                  DataType   \n",
      "4                                                                  \n",
      "5           VisionWarningConditionType         Defined in 11.4.5   \n",
      "6             VisionErrorConditionType         Defined in 11.4.6   \n",
      "7   VisionPersistentErrorConditionType         Defined in 11.4.7   \n",
      "8                                                                  \n",
      "9                            CausePath                    String   \n",
      "10                              MeasId            MeasIdDataType   \n",
      "11                              PartId            PartIdDataType   \n",
      "12                    ExternalRecipeId  RecipeIdExternalDataType   \n",
      "13                    InternalRecipeId  RecipeIdInternalDataType   \n",
      "14                           ProductId         ProductIdDataType   \n",
      "15             ExternalConfigurationId   ConfigurationIdDataType   \n",
      "16             InternalConfigurationId   ConfigurationIdDataType   \n",
      "17                               JobId             JobIdDataType   \n",
      "18                            ResultId          ResultIdDataType   \n",
      "19                           ErrorCode                    UInt64   \n",
      "20                         ErrorString                    String   \n",
      "21                        StopReaction                   Boolean   \n",
      "22                       BlockReaction                   Boolean   \n",
      "\n",
      "                                4          5  \n",
      "0                                             \n",
      "1                                             \n",
      "2                                             \n",
      "3   TypeDefinition  ModellingRule             \n",
      "4                                             \n",
      "5                                             \n",
      "6                                             \n",
      "7                                             \n",
      "8                                             \n",
      "9                    PropertyType   Optional  \n",
      "10                   PropertyType   Optional  \n",
      "11                   PropertyType   Optional  \n",
      "12                   PropertyType   Optional  \n",
      "13                   PropertyType   Optional  \n",
      "14                   PropertyType   Optional  \n",
      "15                   PropertyType   Optional  \n",
      "16                   PropertyType   Optional  \n",
      "17                   PropertyType   Optional  \n",
      "18                   PropertyType   Optional  \n",
      "19                   PropertyType   Optional  \n",
      "20                   PropertyType   Optional  \n",
      "21                   PropertyType  Mandatory  \n",
      "22                   PropertyType  Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      " \n",
      "  \n",
      " \n",
      "  \n",
      "  \n",
      "   \n",
      "The VisionConditionType HasSubtype VisionWarningConditionType which should be of datatype Defined in 11.4.5.\n",
      "  \n",
      "The VisionConditionType HasSubtype VisionWarningConditionType which should be of type .\n",
      "The VisionConditionType HasSubtype VisionErrorConditionType which should be of datatype Defined in 11.4.6.\n",
      "  \n",
      "The VisionConditionType HasSubtype VisionErrorConditionType which should be of type .\n",
      "The VisionConditionType HasSubtype VisionPersistentErrorConditionType which should be of datatype Defined in 11.4.7.\n",
      "  \n",
      "The VisionConditionType HasSubtype VisionPersistentErrorConditionType which should be of type .\n",
      "  \n",
      "  \n",
      "   \n",
      "The VisionConditionType HasProperty CausePath which should be of datatype String.\n",
      "The VisionConditionType HasProperty CausePath Variable which is Optional.\n",
      "The VisionConditionType HasProperty CausePath which should be of type PropertyType.\n",
      "The VisionConditionType HasProperty MeasId which should be of datatype MeasIdDataType.\n",
      "The VisionConditionType HasProperty MeasId Variable which is Optional.\n",
      "The VisionConditionType HasProperty MeasId which should be of type PropertyType.\n",
      "The VisionConditionType HasProperty PartId which should be of datatype PartIdDataType.\n",
      "The VisionConditionType HasProperty PartId Variable which is Optional.\n",
      "The VisionConditionType HasProperty PartId which should be of type PropertyType.\n",
      "The VisionConditionType HasProperty ExternalRecipeId which should be of datatype RecipeIdExternalDataType.\n",
      "The VisionConditionType HasProperty ExternalRecipeId Variable which is Optional.\n",
      "The VisionConditionType HasProperty ExternalRecipeId which should be of type PropertyType.\n",
      "The VisionConditionType HasProperty InternalRecipeId which should be of datatype RecipeIdInternalDataType.\n",
      "The VisionConditionType HasProperty InternalRecipeId Variable which is Optional.\n",
      "The VisionConditionType HasProperty InternalRecipeId which should be of type PropertyType.\n",
      "The VisionConditionType HasProperty ProductId which should be of datatype ProductIdDataType.\n",
      "The VisionConditionType HasProperty ProductId Variable which is Optional.\n",
      "The VisionConditionType HasProperty ProductId which should be of type PropertyType.\n",
      "The VisionConditionType HasProperty ExternalConfigurationId which should be of datatype ConfigurationIdDataType.\n",
      "The VisionConditionType HasProperty ExternalConfigurationId Variable which is Optional.\n",
      "The VisionConditionType HasProperty ExternalConfigurationId which should be of type PropertyType.\n",
      "The VisionConditionType HasProperty InternalConfigurationId which should be of datatype ConfigurationIdDataType.\n",
      "The VisionConditionType HasProperty InternalConfigurationId Variable which is Optional.\n",
      "The VisionConditionType HasProperty InternalConfigurationId which should be of type PropertyType.\n",
      "The VisionConditionType HasProperty JobId which should be of datatype JobIdDataType.\n",
      "The VisionConditionType HasProperty JobId Variable which is Optional.\n",
      "The VisionConditionType HasProperty JobId which should be of type PropertyType.\n",
      "The VisionConditionType HasProperty ResultId which should be of datatype ResultIdDataType.\n",
      "The VisionConditionType HasProperty ResultId Variable which is Optional.\n",
      "The VisionConditionType HasProperty ResultId which should be of type PropertyType.\n",
      "The VisionConditionType HasProperty ErrorCode which should be of datatype UInt64.\n",
      "The VisionConditionType HasProperty ErrorCode Variable which is Optional.\n",
      "The VisionConditionType HasProperty ErrorCode which should be of type PropertyType.\n",
      "The VisionConditionType HasProperty ErrorString which should be of datatype String.\n",
      "The VisionConditionType HasProperty ErrorString Variable which is Optional.\n",
      "The VisionConditionType HasProperty ErrorString which should be of type PropertyType.\n",
      "The VisionConditionType HasProperty StopReaction which should be of datatype Boolean.\n",
      "The VisionConditionType HasProperty StopReaction Variable which is Mandatory.\n",
      "The VisionConditionType HasProperty StopReaction which should be of type PropertyType.\n",
      "The VisionConditionType HasProperty BlockReaction which should be of datatype Boolean.\n",
      "The VisionConditionType HasProperty BlockReaction Variable which is Mandatory.\n",
      "The VisionConditionType HasProperty BlockReaction which should be of type PropertyType.\n",
      "                                    0                           1           2  \\\n",
      "0                           Attribute                       Value               \n",
      "1                          BrowseName  VisionWarningConditionType               \n",
      "2                          IsAbstract                       False               \n",
      "3                          References                   NodeClass  BrowseName   \n",
      "4  Subtype of the VisionConditionType                                           \n",
      "\n",
      "          3               4              5  \n",
      "0                                           \n",
      "1                                           \n",
      "2                                           \n",
      "3  DataType  TypeDefinition  ModellingRule  \n",
      "4                                            \n",
      "----------------------------------------------------------------------\n",
      "\n",
      " \n",
      "  \n",
      " \n",
      "  \n",
      "  \n",
      "   \n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "                                    0                         1           2  \\\n",
      "0                           Attribute                     Value               \n",
      "1                          BrowseName  VisionErrorConditionType               \n",
      "2                          IsAbstract                     False               \n",
      "3                          References                 NodeClass  BrowseName   \n",
      "4  Subtype of the VisionConditionType                                         \n",
      "\n",
      "          3               4              5  \n",
      "0                                           \n",
      "1                                           \n",
      "2                                           \n",
      "3  DataType  TypeDefinition  ModellingRule  \n",
      "4                                            \n",
      "----------------------------------------------------------------------\n",
      "\n",
      " \n",
      "  \n",
      " \n",
      "  \n",
      "  \n",
      "   \n",
      "                                    0                                   1  \\\n",
      "0                           Attribute                               Value   \n",
      "1                          BrowseName  VisionPersistentErrorConditionType   \n",
      "2                          IsAbstract                               False   \n",
      "3                          References                           NodeClass   \n",
      "4  Subtype of the VisionConditionType                                       \n",
      "\n",
      "            2         3               4              5  \n",
      "0                                                       \n",
      "1                                                       \n",
      "2                                                       \n",
      "3  BrowseName  DataType  TypeDefinition  ModellingRule  \n",
      "4                                                        \n",
      "----------------------------------------------------------------------\n",
      "\n",
      " \n",
      "  \n",
      " \n",
      "  \n",
      "  \n",
      "   \n",
      "             0                                                  1  \\\n",
      "0    Attribute                                              Value   \n",
      "1   BrowseName                              VisionSafetyEventType   \n",
      "2   IsAbstract                                              False   \n",
      "3   References                                          NodeClass   \n",
      "4               Subtype of the BaseEventType defined in OPC 10...   \n",
      "5  HasProperty                                           Variable   \n",
      "6  HasProperty                                           Variable   \n",
      "\n",
      "                         2         3               4              5  \n",
      "0                                                                    \n",
      "1                                                                    \n",
      "2                                                                    \n",
      "3               BrowseName  DataType  TypeDefinition  ModellingRule  \n",
      "4                                                                    \n",
      "5    VisionSafetyTriggered   Boolean    PropertyType      Mandatory  \n",
      "6  VisionSafetyInformation    String    PropertyType      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      " \n",
      "  \n",
      " \n",
      "  \n",
      "  \n",
      "   \n",
      "The VisionSafetyEventType HasProperty VisionSafetyTriggered which should be of datatype Boolean.\n",
      "The VisionSafetyEventType HasProperty VisionSafetyTriggered Variable which is Mandatory.\n",
      "The VisionSafetyEventType HasProperty VisionSafetyTriggered which should be of type PropertyType.\n",
      "The VisionSafetyEventType HasProperty VisionSafetyInformation which should be of datatype String.\n",
      "The VisionSafetyEventType HasProperty VisionSafetyInformation Variable which is Mandatory.\n",
      "The VisionSafetyEventType HasProperty VisionSafetyInformation which should be of type PropertyType.\n",
      "            0                                                  1           2  \\\n",
      "0   Attribute                                              Value               \n",
      "1  BrowseName                                ResultStateDataType               \n",
      "2  IsAbstract                                              False               \n",
      "3  References                                       Node \\nClass  BrowseName   \n",
      "4              Subtype of the Int32 DataType defined in OPC 1...               \n",
      "\n",
      "          3               4                 5  \n",
      "0                                              \n",
      "1                                              \n",
      "2                                              \n",
      "3  DataType  TypeDefinition  Modelling \\nRule  \n",
      "4                                               \n",
      "----------------------------------------------------------------------\n",
      "\n",
      " \n",
      "  \n",
      " \n",
      "  \n",
      "  \n",
      "   \n"
     ]
    }
   ],
   "source": [
    "# Case 1 or Type 1 - ObjectType Def tables with standard structure \n",
    "\n",
    "countotd1 = 0      \n",
    "ncountotd1 = 0\n",
    "\n",
    "for otdtable1 in tables:\n",
    "\n",
    "    if any(s in otdtable1.df.to_string() for s in objtypdef):\n",
    "        if not any(s in otdtable1.df.to_string() for s in nonobjtypedef):\n",
    "            otd1 = otdtable1.df\n",
    "\n",
    "            try:\n",
    "                if len(otd1.columns) == 6:\n",
    "                    print(otdtable1.df, \"\\n----------------------------------------------------------------------\\n\")\n",
    "                    countotd1 = countotd1 + 1\n",
    "                    \n",
    "                    for o1 in range(3,len(otd1)):\n",
    "                        \n",
    "                    \n",
    "                        Sourcenode = otd1.iat[1,1] or otd1.iat[1,2] or otd1.iat[1,3]\n",
    "                        References = otd1.iat[o1,0]\n",
    "                        NodeClass = otd1.iat[o1,1] \n",
    "                        BrowseName = otd1.iat[o1,2] \n",
    "                        Datatype = otd1.iat[o1,3] \n",
    "                        Typedef = otd1.iat[o1,4] \n",
    "                        Other = otd1.iat[o1,5] \n",
    "                      \n",
    "         # Step 3 - Constraint Identification and Rule formulation              \n",
    "                        \n",
    "                        \n",
    "                        print(Datatype_const(Datatype))\n",
    "                        wb['Datatype_Const'].append(Datatype_const(Datatype))\n",
    "                        \n",
    "                        \n",
    "                        print(Cardinality_existance(Other))\n",
    "                        wb['Cardinality_Existance'].append(Cardinality_existance(Other))\n",
    "\n",
    "                        \n",
    "                        print(DomainRange(BrowseName))\n",
    "                        wb['Domain_Range'].append(DomainRange(BrowseName))\n",
    "                        \n",
    "                        \n",
    "                       \n",
    "                     \n",
    "            except:\n",
    "                if len(otd1.columns) != 6 and otd1.iat[2,0] != \"IsAbstract\":\n",
    "                    ncountotd1 = ncountotd1 + 1\n",
    "                    print(\"-------------------------wrong extraction---------------------------\" )\n",
    "                \n",
    "                    pass\n",
    "            \n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Performance Evaluation Metrics\n",
    "\n",
    "- TP True Positives: occurs when a table of a certain type (e.g., Enumeration) is present in PDF and extracted along with being classified correctly as its type.\n",
    "\n",
    "- FP False Positives: occurs when we are looking for tables of a specific type (e.g., Reference TypeDefinition) but extracted table is of incorrect type (e.g., Enumeration)\n",
    "\n",
    "- FN False Negative : occurs when a table of a different and incorrect type (e.g., Enumeration) is extracted even though there presence of our target table.\n",
    "- NOTE : False negative values for this task as they do not appear so often because of tailoring the algorithm to suit almost every table type as much as possible. \n",
    "In general, false negative situation arises when there is a totally unique table structure that is not covered in algorithm. For instance this also leads to according to Error 6.\n",
    "\n",
    "- TN True Negative situations arise very rarely and are not considered for the purpose of this task. It usually occurs when no extraction of table occurs and in fact there is no table of that specific type in the PDF."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 203,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:10:20.792397Z",
     "start_time": "2021-08-04T07:10:20.786436Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Case1_Number of TP ObjectType Definition tables extracted with constraints : 37\n",
      "Case1_Number of FP ObjectType Definition tables extracted without constraints : 0\n"
     ]
    }
   ],
   "source": [
    "print(\"Case1_Number of TP ObjectType Definition tables extracted with constraints :\",countotd1)\n",
    "print(\"Case1_Number of FP ObjectType Definition tables extracted without constraints :\",ncountotd1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 204,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:07:01.954246Z",
     "start_time": "2021-08-04T07:06:59.184945Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "            0               1           2         3               4  \\\n",
      "0   Attribute           Value                                         \n",
      "1  BrowseName  StartSingleJob                                         \n",
      "2  References       NodeClass  BrowseName  DataType  TypeDefinition   \n",
      "\n",
      "               5  \n",
      "0                 \n",
      "1                 \n",
      "2  ModellingRule   \n",
      "----------------------------------------------------------------------\n",
      "\n"
     ]
    }
   ],
   "source": [
    "countotd2 = 0\n",
    "ncountotd2 = 0\n",
    "x =0\n",
    "y = 0\n",
    "a = 0\n",
    "b=0\n",
    "\n",
    "for otdtable2 in tables:\n",
    "\n",
    "    if any(s in otdtable2.df.to_string() for s in objtypdef):\n",
    "\n",
    "        if not any(s in otdtable2.df.to_string() for s in nonobjtypedef):\n",
    "            otd2 = otdtable2.df\n",
    "            \n",
    "            try:\n",
    "                \n",
    "                if otd2.iat[2,5].lower().strip() or otd2.iat[3,4].lower().strip() == \"modelling\\nrule\":\n",
    "                    if otd2.iat[2,0].lower().strip() or otd2.iat[3,0].lower().strip() != \"references\":\n",
    "\n",
    "                        \n",
    "                        print(otdtable2.df, \"\\n----------------------------------------------------------------------\\n\")\n",
    "                        countotd2 = countotd2 + 1\n",
    "                        for o2 in range(3,len(otd2)):\n",
    "                            \n",
    "                            Sourcenode = otd2.iat[1,1]\n",
    "                            References = otd2.iat[o2,0]\n",
    "                            NodeClass = otd2.iat[o2,1] \n",
    "                            BrowseName = otd2.iat[o2,2] \n",
    "                            Typedef = otd2.iat[o2,3] \n",
    "                            Other = otd2.iat[o2,4]      \n",
    "                            \n",
    "                           \n",
    "                            print(Datatype_const(Datatype))\n",
    "                            wb['Datatype_Const'].append(Datatype_const(Datatype))\n",
    "                        \n",
    "                        \n",
    "                            print(Cardinality_existance(Other))\n",
    "                            wb['Cardinality_Existance'].append(Cardinality_existance(Other))\n",
    "\n",
    "                        \n",
    "                            print(DomainRange(BrowseName))\n",
    "                            wb['Domain_Range'].append(DomainRange(BrowseName))\n",
    "                            \n",
    "                        \n",
    "                        \n",
    "                    \n",
    "                                            \n",
    "            except:\n",
    "                if len(otd2.columns) != 6:\n",
    "                    ncountotd2 = ncountotd2 + 1\n",
    "                    print(\"-------------------------wrong extraction---------------------------\" )\n",
    "                \n",
    "                pass\n",
    "                            \n",
    "\n",
    " "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 205,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:11:37.523552Z",
     "start_time": "2021-08-04T07:11:37.517561Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Case2_Number of TP Type definition tables of Type is : 1\n",
      "Case2_Number of FP Type definition tables of Type is : 0\n"
     ]
    }
   ],
   "source": [
    "print(\"Case2_Number of TP Type definition tables of Type is :\",(countotd2))\n",
    "print(\"Case2_Number of FP Type definition tables of Type is :\",ncountotd2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 206,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:11:38.803847Z",
     "start_time": "2021-08-04T07:11:38.298791Z"
    }
   },
   "outputs": [],
   "source": [
    "# Case 3 or Type 3 Structure of Type definition tables with InstanceType ('Organizedby')\n",
    "# Column 3 sometimes has TypeDefinition while sometimes it has DataType values in this Type 3 tables\n",
    "countotd3 = 0\n",
    "ncountotd3 = 0\n",
    "type3_td = [\"OrganizedBy\",\"Organized by\"]\n",
    "for otdtable3 in tables:                         \n",
    "\n",
    "    if any(s in otdtable3.df.to_string() for s in type3_td):\n",
    " \n",
    "        otd3 = otdtable3.df\n",
    "        try:\n",
    "                \n",
    "            print(otdtable3.df, \"\\n----------------------------------------------------------------------\\n\")\n",
    "            countotd3 = countotd3 + 1\n",
    "            for o3 in range(3,len(otd3)):\n",
    "                \n",
    "                    Sourcenode = otd3.iat[1,1]\n",
    "                    References = otd3.iat[o3,0]\n",
    "                    NodeClass = otd3.iat[o3,1]\n",
    "                    BrowseName = otd3.iat[o3,2] \n",
    "                    Datatype = otd3.iat[o3,3] \n",
    "                    \n",
    "                    #print(Datatype_const(Datatype))\n",
    "                    #wb['Datatype_Const'].append(Datatype_const(Datatype)) \n",
    "                    \n",
    "                    print(DomainRange(BrowseName))\n",
    "                    wb['Domain_Range'].append(DomainRange(BrowseName))\n",
    "        except:\n",
    "            ncountotd3 = ncountotd3 + 1\n",
    "            print(\"-------------wrong extraction------------\")\n",
    "            pass\n",
    "                "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 207,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:11:39.061477Z",
     "start_time": "2021-08-04T07:11:39.056491Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Case3_Number of TP Tables of InstanceType(OrganizedBy) in Typedef tables :  0\n",
      "Case3_Number of FP Tables of InstanceType(OrganizedBy) in Typedef tables :  0\n"
     ]
    }
   ],
   "source": [
    "print(\"Case3_Number of TP Tables of InstanceType(OrganizedBy) in Typedef tables : \",countotd3)\n",
    "print(\"Case3_Number of FP Tables of InstanceType(OrganizedBy) in Typedef tables : \",ncountotd3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 208,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:11:53.728884Z",
     "start_time": "2021-08-04T07:11:53.469239Z"
    }
   },
   "outputs": [],
   "source": [
    " # Type 4 or Case 4 - Structure of Type definition tables with Displayname,IsArray & Optional columns\n",
    "# (Constraint extraction future work as these tabletypes are rare still need to be worked upon in later stages)\n",
    "\n",
    "countotd4 = 0\n",
    "type4_td = [\"IsArray\"]                                               \n",
    "for otdtable4 in tables:                    \n",
    "\n",
    "    if any(s in otdtable4.df.to_string() for s in type4_td):\n",
    "        \n",
    "        \n",
    "        otd4 = otdtable4.df\n",
    "        countotd4 = countotd4 + 1\n",
    "        print(otdtable4.df, \"\\n----------------------------------------------------------------------\\n\")\n",
    "        \n",
    "        "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 209,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:11:54.047196Z",
     "start_time": "2021-08-04T07:11:54.044192Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Case4_Number of Type Def Tables with IsArray, Displayname cols.& without constraints :  0\n"
     ]
    }
   ],
   "source": [
    "print(\"Case4_Number of Type Def Tables with IsArray, Displayname cols.& without constraints : \",countotd4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 210,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:11:57.344001Z",
     "start_time": "2021-08-04T07:11:54.795898Z"
    }
   },
   "outputs": [],
   "source": [
    "# Type 5 or Case 5- Tables with IsAbstract column in 6th column of Typedef type table \n",
    "# For example in AutoID comp spec. such tables have been ignored\n",
    "# (Constraint extraction future work as these tabletypes are rare still need to be worked upon in later stages)\n",
    "countotd5 = 0\n",
    "for otdtable5 in tables:\n",
    "    if any(s in otdtable5.df.to_string() for s in objtypdef):\n",
    "        if not any(s in otdtable5.df.to_string() for s in nonobjtypedef):\n",
    "            otd5 = otdtable5.df\n",
    "            try:\n",
    "                if any(otd5.iat[4,6].lower().strip() == \"isabstract\"):\n",
    "                    print(otdtable5.df, \"\\n----------------------------------------------------------------------\\n\")\n",
    "                    countotd5 = countotd5 + 1\n",
    "            except:\n",
    "                pass\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 211,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:11:57.349591Z",
     "start_time": "2021-08-04T07:11:57.344001Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Case5_Number of Typedef tables with 'IsAbstract column'(no constraints): 0\n"
     ]
    }
   ],
   "source": [
    "print(\"Case5_Number of Typedef tables with 'IsAbstract column'(no constraints):\",countotd5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 212,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:11:59.934582Z",
     "start_time": "2021-08-04T07:11:57.351590Z"
    }
   },
   "outputs": [],
   "source": [
    "# Type6 or Case 6 - build other structure without reference column \n",
    "# For example in powerlink (except DataType constraint other constraints can't be built on this type as there is no reference column)\n",
    "# (Constraint extraction future work as these tabletypes are rare still need to be worked upon in later stages)\n",
    "countotd6 = 0\n",
    "for otdtable6 in tables:\n",
    "    if any(s in otdtable6.df.to_string() for s in objtypdef):\n",
    "        if not any(s in otdtable6.df.to_string() for s in nonobjtypedef):\n",
    "            otd6 = otdtable6.df\n",
    "            try:\n",
    "                if any(otd6.iat[4,0].lower().strip() == \"nodeclass\"):\n",
    "                    print(otdtable6.df, \"\\n----------------------------------------------------------------------\\n\")\n",
    "                    otdtable6 = otdtable6 + 1\n",
    "            except:\n",
    "                pass"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 213,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:11:59.938508Z",
     "start_time": "2021-08-04T07:11:59.935531Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Case6_Number of Typedef tables without 'Reference column'(no constraints): 0\n"
     ]
    }
   ],
   "source": [
    "print(\"Case6_Number of Typedef tables without 'Reference column'(no constraints):\",countotd6)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 214,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:12:00.255404Z",
     "start_time": "2021-08-04T07:11:59.940507Z"
    }
   },
   "outputs": [],
   "source": [
    "# Type 7 or Case 7 tables with comment column\n",
    "countotd7 = 0\n",
    "ncountotd7 = 0\n",
    "type7_td = [\"comment\"]\n",
    "for otdtable7 in tables:\n",
    "    if any(s in otdtable7.df.to_string() for s in type7_td):\n",
    "     \n",
    "        otd7 = otdtable7.df\n",
    "        \n",
    "        try:\n",
    "            if len(otd7.columns) == 5:\n",
    "                \n",
    "                print(otdtable7.df, \"\\n----------------------------------------------------------------------\\n\")\n",
    "                countotd7 = countotd7 + 1\n",
    "                for o7 in range(3,len(otd7)):\n",
    "            \n",
    "                    Sourcenode = otd7.iat[1,3]\n",
    "                    References = otd7.iat[o7,0]\n",
    "                    NodeClass = otd7.iat[o7,1]\n",
    "                    BrowseName = otd7.iat[o7,2] \n",
    "                    Typedef = otd7.iat[o7,3]\n",
    "                    comment = otd7.iat[o7,4]   #no constraint specific to comment column\n",
    "                    \n",
    "\n",
    "                    wb['Domain_Range'].append(DomainRange(BrowseName))\n",
    "                   \n",
    "                  \n",
    "        except:\n",
    "            if len(otd7.columns) != 5:\n",
    "                ncountotd7 = ncountotd7 + 1\n",
    "                print(\"Normal Table type---------------wrong extraction-----------------------\")\n",
    "            \n",
    "    \n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 215,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:12:00.265409Z",
     "start_time": "2021-08-04T07:12:00.256445Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Case7_Number of TP tables with comment column(with Domain-Range constraint only) is : 0\n",
      "Case7_Number of FP tables not with comment column is(without constraints) : 0\n"
     ]
    }
   ],
   "source": [
    "print(\"Case7_Number of TP tables with comment column(with Domain-Range constraint only) is :\", countotd7)\n",
    "print(\"Case7_Number of FP tables not with comment column is(without constraints) :\", ncountotd7)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 216,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:14:15.709649Z",
     "start_time": "2021-08-04T07:14:15.427659Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "----------------------wrong extraction-----------------------\n",
      "----------------------wrong extraction-----------------------\n",
      "               0                                                  1  \\\n",
      "0      Attribute                                              Value   \n",
      "1     BrowseName                                         ResultType   \n",
      "2     IsAbstract                                              False   \n",
      "3      ValueRank                                        -1 {Scalar}   \n",
      "4       DataType                                     ResultDataType   \n",
      "5     References                                         Node Class   \n",
      "6                 Subtype of the BaseDataVariableType defined in...   \n",
      "7   HasComponent                                           Variable   \n",
      "8   HasComponent                                           Variable   \n",
      "9   HasComponent                                           Variable   \n",
      "10  HasComponent                                           Variable   \n",
      "11  HasComponent                                           Variable   \n",
      "12  HasComponent                                           Variable   \n",
      "13  HasComponent                                           Variable   \n",
      "14  HasComponent                                           Variable   \n",
      "15  HasComponent                                           Variable   \n",
      "16  HasComponent                                           Variable   \n",
      "17  HasComponent                                           Variable   \n",
      "18  HasComponent                                           Variable   \n",
      "19  HasComponent                                           Variable   \n",
      "20  HasComponent                                           Variable   \n",
      "21  HasComponent                                           Variable   \n",
      "22  HasComponent                                           Variable   \n",
      "\n",
      "                            2  \\\n",
      "0                               \n",
      "1                               \n",
      "2                               \n",
      "3                               \n",
      "4                               \n",
      "5                  BrowseName   \n",
      "6                               \n",
      "7                    ResultId   \n",
      "8   HasTransferableDataOnFile   \n",
      "9                   IsPartial   \n",
      "10                IsSimulated   \n",
      "11                ResultState   \n",
      "12                     MeasId   \n",
      "13                     PartId   \n",
      "14           ExternalRecipeId   \n",
      "15           InternalRecipeId   \n",
      "16                  ProductId   \n",
      "17    ExternalConfigurationId   \n",
      "18    InternalConfigurationId   \n",
      "19                      JobId   \n",
      "20               CreationTime   \n",
      "21            ProcessingTimes   \n",
      "22              ResultContent   \n",
      "\n",
      "                                                  3              4  \n",
      "0                                                                   \n",
      "1                                                                   \n",
      "2                                                                   \n",
      "3                                                                   \n",
      "4                                                                   \n",
      "5                         DataType / TypeDefinition  ModellingRule  \n",
      "6                                                                   \n",
      "7           ResultIdDataType \\nBaseDataVariableType      Mandatory  \n",
      "8                    Boolean \\nBaseDataVariableType       Optional  \n",
      "9                    Boolean \\nBaseDataVariableType      Mandatory  \n",
      "10                   Boolean \\nBaseDataVariableType       Optional  \n",
      "11       ResultStateDataType \\nBaseDataVariableType      Mandatory  \n",
      "12            MeasIdDataType \\nBaseDataVariableType       Optional  \n",
      "13            PartIdDataType \\nBaseDataVariableType       Optional  \n",
      "14  RecipeIdExternalDataType \\nBaseDataVariableType       Optional  \n",
      "15  RecipeIdInternalDataType \\nBaseDataVariableType      Mandatory  \n",
      "16         ProductIdDataType \\nBaseDataVariableType       Optional  \n",
      "17   ConfigurationIdDataType \\nBaseDataVariableType       Optional  \n",
      "18   ConfigurationIdDataType \\nBaseDataVariableType      Mandatory  \n",
      "19             JobIdDataType \\nBaseDataVariableType      Mandatory  \n",
      "20                   UtcTime \\nBaseDataVariableType      Mandatory  \n",
      "21   ProcessingTimesDataType \\nBaseDataVariableType       Optional  \n",
      "22            BaseDataType[] \\nBaseDataVariableType       Optional   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "----------------------wrong extraction-----------------------\n"
     ]
    }
   ],
   "source": [
    "count_otd8_1 = 0\n",
    "ncountotd8_1 = 0\n",
    "valrank = [\"ValueRank\"]                                                                     \n",
    "for otdtype8_1 in tables:\n",
    "    if any(n in otdtype8_1.df.to_string() for n in valrank):\n",
    "        otdt8_1 = otdtype8_1.df\n",
    "        try:\n",
    "            if otdt8_1.iat[5,2] or otdt8_1.iat[5,3] == \"BrowseName\":\n",
    "                \n",
    "                count_otd8_1 = count_otd8_1 + 1\n",
    "                print(otdtype8_1.df,\"\\n----------------------------------------------------------------------\\n\")\n",
    "                \n",
    "                \n",
    "                for o8_1 in range(5, len(otdt8_1)):\n",
    "                    \n",
    "                    #valuerank = otdt8_1.iat[3,1] \n",
    "                    Sourcenode = otdt8_1.iat[1,1]\n",
    "                    References = otdt8_1.iat[o8_1,0]\n",
    "                    NodeClass = otdt8_1.iat[o8_1,1]\n",
    "                    BrowseName = otdt8_1.iat[o8_1,2] \n",
    "                    Datatype = otdt8_1.iat[o8_1,3] \n",
    "                    Typedef = otdt8_1.iat[o8_1,4] \n",
    "                    Other = otdt8_1.iat[o8_1,5] \n",
    "                    \n",
    "                \n",
    "                    \n",
    "                    print(Datatype_const(Datatype))\n",
    "                    wb['Datatype_Const'].append(Datatype_const(Datatype))\n",
    "                    #wb['Datatype_Const'].append(\"The ValueRank of \" + Sourcenode + \"VariableType is : '\" + valuerank + \"'.\")    \n",
    "                        \n",
    "                    print(Cardinality_existance(Other))\n",
    "                    wb['Cardinality_Existance'].append(Cardinality_existance(Other))\n",
    "\n",
    "                        \n",
    "                    print(DomainRange(BrowseName))\n",
    "                    wb['Domain_Range'].append(DomainRange(BrowseName))\n",
    "                    \n",
    "                   \n",
    "\n",
    "        except:\n",
    "            if len(otdt8_1.columns) != 6:\n",
    "                ncountotd8_1 = ncountotd8_1 + 1    \n",
    "                print(\"----------------------wrong extraction-----------------------\")\n",
    "                pass\n",
    "                "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 217,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:14:27.343754Z",
     "start_time": "2021-08-04T07:14:27.340721Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Case8_1Number of TP Variable Type Def Tables with ValueRank attribute: 1\n",
      "Case8_1Number of FP Variable Type Def Tables with ValueRank attribute: 3\n"
     ]
    }
   ],
   "source": [
    "print(\"Case8_1Number of TP Variable Type Def Tables with ValueRank attribute:\",count_otd8_1)\n",
    "print(\"Case8_1Number of FP Variable Type Def Tables with ValueRank attribute:\",ncountotd8_1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 220,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:14:28.390919Z",
     "start_time": "2021-08-04T07:14:28.383921Z"
    }
   },
   "outputs": [],
   "source": [
    "# ObjectType Def tables with column index 6 (Access, Access Level)\n",
    "##In CSP+4M spec inplce of AccessLevl we have 'Details'\n",
    "countotd9 = 0      \n",
    "ncountotd9 = 0\n",
    "\n",
    "for otdtable9 in tables:\n",
    "    if any(s in otdtable9.df.to_string() for s in objtypdef):\n",
    "        if not any(s in otdtable9.df.to_string() for s in nonobjtypedef):\n",
    "            otd9 = otdtable9.df\n",
    "            \n",
    "            \n",
    "            # Applying the pattern to all tables\n",
    "            try:\n",
    "                if otd9.iat[3,6] == \"RW\" or otd9.iat[3,6] == \"R\\nW\" or otd9.iat[3,6] == \"Access\" or otd9.iat[3,6] == \"Access Level\" or otd9.iat[3,6] == \"Details\":\n",
    "                    \n",
    "                \n",
    "                    print(otdtable9,\"\\n----------------------------------------------------------------------\\n\")\n",
    "                    countotd9 = countotd9 + 1\n",
    "                \n",
    "                    for o9 in range(3,len(otd9)):\n",
    "                    #countotd_with_constraints = countotd_with_constraints + 1\n",
    "\n",
    "                        Sourcenode = otd9.iat[1,1] or otd9.iat[1,2] or otd9.iat[1,3]\n",
    "                        References = otd9.iat[o9,0]\n",
    "                        NodeClass = otd9.iat[o9,1] \n",
    "                        BrowseName = otd9.iat[o9,2] \n",
    "                        Datatype = otd9.iat[o9,3] \n",
    "                        Typedef = otd9.iat[o9,4] \n",
    "                    #ModellingRule = x.iat[a,5]\n",
    "                        Other = otd9.iat[o9,5] \n",
    "                        Accesslevel = otd9.iat[o9,6]\n",
    "                     \n",
    "                    #countotd_with_constraints = countotd_with_constraints + 1\n",
    "\n",
    "                        print(Datatype_const(Datatype))\n",
    "                        print(Cardinality_existance(Other))\n",
    "                        print(DomainRange(BrowseName))\n",
    "                                                                     \n",
    "                        if Accesslevel == \"R\" or Accesslevel == \"RO\" or Accesslevel == \"Access\":\n",
    "                            \n",
    "                            print(\"4.Accesslevel Constraint : \"+ NodeClass + \" Nodeclass with \" + BrowseName + \"Browsename of \" +\n",
    "                                    Sourcenode + \"Sourcenode is Readable only. \")\n",
    "                        elif Accesslevel == \"W\" or Accesslevel == \"WO\":\n",
    "                            print(\"4.Accesslevel Constraint : \"+ NodeClass + \" Nodeclass with \" + BrowseName + \"Browsename of \" +\n",
    "                                    Sourcenode + \"Sourcenode is Writable only. \")\n",
    "                        elif Accesslevel == \"RW\":\n",
    "                            print(\"4.Accesslevel Constraint : \"+ NodeClass + \" Nodeclass with \" + BrowseName + \"Browsename of \" +\n",
    "                                    Sourcenode + \"Sourcenode is both Read and Writeable. \")\n",
    "                        else:\n",
    "                            print(\"Has no AccessLevel Constraint\")\n",
    "                        \n",
    "            except:\n",
    "               \n",
    "                if len(otd9.columns) != 6:\n",
    "                    \n",
    "                    ncountotd9 = ncountotd9 + 1\n",
    "                    print(\"--------------------wrong extraction--------------------------\" )\n",
    "                \n",
    "                    pass\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 221,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:14:29.164383Z",
     "start_time": "2021-08-04T07:14:29.159377Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Case9_Number of TP ObjectType Definition tables (with accesslvl) : 0\n",
      "Case9_Number of FP ObjectType Definition tables extracted without constraints : 0\n"
     ]
    }
   ],
   "source": [
    "print(\"Case9_Number of TP ObjectType Definition tables (with accesslvl) :\",countotd9)\n",
    "print(\"Case9_Number of FP ObjectType Definition tables extracted without constraints :\",ncountotd9)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 222,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:14:30.648476Z",
     "start_time": "2021-08-04T07:14:30.643440Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Number of Object+Variable Type Definition tables correctly extracted with constraints   39\n"
     ]
    }
   ],
   "source": [
    "#Computation of True Positive values for the above table types extracted correctly (only those with constraints)\n",
    "TP_OVTypedef = countotd1 + countotd2 + countotd3 + countotd7 + count_otd8_1 + countotd9\n",
    "print(\"Number of Object+Variable Type Definition tables correctly extracted with constraints  \",TP_OVTypedef)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 223,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:14:31.531781Z",
     "start_time": "2021-08-04T07:14:31.528781Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Number of Object+Variable Type Definition tables extracted(but wrongly) without constraints   3\n"
     ]
    }
   ],
   "source": [
    "#Computation of False Negative values for the above table types extracted incorrectly\n",
    "FP_OVTypedef = ncountotd1 + ncountotd2 + ncountotd3 + ncountotd7 + ncountotd8_1 + ncountotd9\n",
    "print(\"Number of Object+Variable Type Definition tables extracted(but wrongly) without constraints  \",FP_OVTypedef)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 224,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:14:32.773180Z",
     "start_time": "2021-08-04T07:14:32.769176Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Precision Value of Reference Type Definition tables   0.9285714285714286\n"
     ]
    }
   ],
   "source": [
    "# Computing Precision Value -> Precision = True Positive / (TruePositive + False Positive)\n",
    "if (TP_OVTypedef + FP_OVTypedef) == 0:\n",
    "    Precision_OVTypedef = \"doesnotexist\"\n",
    "else:\n",
    "    Precision_OVTypedef = TP_OVTypedef / (TP_OVTypedef + FP_OVTypedef)\n",
    "    \n",
    "print(\"Precision Value of Reference Type Definition tables  \",Precision_OVTypedef)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 225,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:14:35.407389Z",
     "start_time": "2021-08-04T07:14:35.398424Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Parameter</th>\n",
       "      <th>Value</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>(TP) - Number of ObjectType Definition tables ...</td>\n",
       "      <td>39.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>(FP) - Number of ObjectType Definition tables ...</td>\n",
       "      <td>3.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Precision Value of ObjectType Definition tables</td>\n",
       "      <td>0.928571</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                           Parameter      Value\n",
       "0  (TP) - Number of ObjectType Definition tables ...  39.000000\n",
       "1  (FP) - Number of ObjectType Definition tables ...   3.000000\n",
       "2    Precision Value of ObjectType Definition tables   0.928571"
      ]
     },
     "execution_count": 225,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "OVeval = pd.DataFrame({\"Parameter\":[\"(TP) - Number of ObjectType Definition tables correctly extracted with constraints\",\n",
    "                                    \"(FP) - Number of ObjectType Definition tables extracted(but wrongly) without constraints\",\n",
    "                                    \"Precision Value of ObjectType Definition tables\"],\n",
    "                       \"Value\":[TP_OVTypedef,FP_OVTypedef,Precision_OVTypedef]})\n",
    "OVeval                       \n",
    "                      \n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "If TP is more that number of tables of that type in spec then that is because some tables of one type also got extracted in other type in some cases or some tables repeatedly get extracted due to presence of same table multiple times in PDF sometimes "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 194,
   "metadata": {},
   "outputs": [],
   "source": [
    "#print((wb['Datatype_Const'])) #(display output to be written into excel file)\n",
    "#print((wb['Cardinality_Existance']))\n",
    "#print((wb['Domain_Range']))\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Datatype_Const</th>\n",
       "      <th>Cardinality_Existance</th>\n",
       "      <th>Domain_Range</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td></td>\n",
       "      <td></td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td></td>\n",
       "      <td></td>\n",
       "      <td></td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>The VisionSystemType HasComponent Configuratio...</td>\n",
       "      <td>The VisionSystemType HasComponent Configuratio...</td>\n",
       "      <td>The VisionSystemType HasComponent Configuratio...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>The VisionSystemType HasComponent RecipeManage...</td>\n",
       "      <td>The VisionSystemType HasComponent RecipeManage...</td>\n",
       "      <td>The VisionSystemType HasComponent RecipeManage...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>The VisionSystemType HasComponent ResultManage...</td>\n",
       "      <td>The VisionSystemType HasComponent ResultManage...</td>\n",
       "      <td>The VisionSystemType HasComponent ResultManage...</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                      Datatype_Const  \\\n",
       "0                                                      \n",
       "1                                                      \n",
       "2  The VisionSystemType HasComponent Configuratio...   \n",
       "3  The VisionSystemType HasComponent RecipeManage...   \n",
       "4  The VisionSystemType HasComponent ResultManage...   \n",
       "\n",
       "                               Cardinality_Existance  \\\n",
       "0                                                      \n",
       "1                                                      \n",
       "2  The VisionSystemType HasComponent Configuratio...   \n",
       "3  The VisionSystemType HasComponent RecipeManage...   \n",
       "4  The VisionSystemType HasComponent ResultManage...   \n",
       "\n",
       "                                        Domain_Range  \n",
       "0                                                     \n",
       "1                                                     \n",
       "2  The VisionSystemType HasComponent Configuratio...  \n",
       "3  The VisionSystemType HasComponent RecipeManage...  \n",
       "4  The VisionSystemType HasComponent ResultManage...  "
      ]
     },
     "execution_count": 41,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df_1 = pd.DataFrame(wb) #(uncomment for writing output into excelsheet in workbook)\n",
    "df_1.head()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### ReferenceType Definition tables"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:15:27.114587Z",
     "start_time": "2021-08-04T07:15:27.110824Z"
    }
   },
   "outputs": [],
   "source": [
    "#strings for Reference Type tables\n",
    "strings_ref=[\"InverseName\",\"Symmetric\", \"Subtype of HierarchialReferences defined\"]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "- strings_ref - list type - holds strings that help to filter and extract only Reference type tables from all the tables"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [],
   "source": [
    "rf = {'ReferenceType':[]}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Reference type tables Type 1 -\n",
    "- count_ref1 - int type - variable holds count of correctly extracted tables with constraints of type 1\n",
    "- ncount_ref1 - int type - variable that holds count of incorrectly extracted tables without constraints of type 1\n",
    "- strings_ref - list type - varible with list of strings that help to filter and extract type 1 tables\n",
    "- table_ref1 - pandas.core.frame.dataframe type - variable that holds tables that are to be extracted from total 'tables'based on the strings_ref\n",
    "- n - string type - variable that denotes one string at a time and compares strings in strings_ref with the presence of strings in table 'table_ref1', helping to exactly filter the ref table of type1 from actual 'tables'.\n",
    "- r1 - pandas.core.frame.DataFrame type - variable that holds tables or dataframes,'table_ref1.df' of type 1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:16:13.083412Z",
     "start_time": "2021-08-04T07:16:12.327994Z"
    }
   },
   "outputs": [],
   "source": [
    "count_ref1 = 0\n",
    "ncount_ref1 = 0\n",
    "for table_ref1 in tables:\n",
    "                                                     \n",
    "    if any(n in table_ref1.df.to_string() for n in strings_ref):\n",
    "        r1 = table_ref1.df\n",
    "        \n",
    "        try:\n",
    "            \n",
    "            print(table_ref1.df, \"\\n----------------------------------------------------------------------\\n\")\n",
    "            count_ref1 = count_ref1 + 1\n",
    "        \n",
    "            for a in r1:\n",
    "                                              \n",
    "                Referencename = r1.iat[1,1]  #BrowseName\n",
    "                Inversename = r1.iat[2,1]\n",
    "                Symmetric = r1.iat[3,1]\n",
    "                \n",
    "                \n",
    "                if Symmetric == \"False\":\n",
    "                    \n",
    "                    print(\"The \" + Referencename + \" is not symmetric. Therefore, it must provide an inverse \" + Inversename + \" reference.\")\n",
    "                    rf['ReferenceType'].append(\"The \" + Referencename + \" is not symmetric. Therefore, it must provide an inverse \" + Inversename + \" reference.\")\n",
    "               \n",
    "        except:\n",
    "            \n",
    "            if r1.iat[2,0]== \"InverseName\" and r1.iat[3,0] == \"Symmetric\":\n",
    "                \n",
    "                ncount_ref1 = ncount_ref1 + 1\n",
    "                print(\"-----------------------------wrong extraction-----------------------------\")\n",
    "                pass\n",
    "            \n",
    "                    \n",
    "               "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:16:19.313530Z",
     "start_time": "2021-08-04T07:16:19.308492Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Case1_Number of TP referencetype tables extracted 0\n",
      "Case1_Number of FP referencetype tables extracted 0\n"
     ]
    }
   ],
   "source": [
    "print(\"Case1_Number of TP referencetype tables extracted\",count_ref1 )\n",
    "print(\"Case1_Number of FP referencetype tables extracted\",ncount_ref1 )"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Reference type tables Type 2 - No Inverse Name attribute present\n",
    "- count_ref2 - int type - variable holds count of correctly extracted tables with constraints of type 2\n",
    "- ncount_ref2 - int type - variable that holds count of incorrectly extracted tables without constraints of type 2\n",
    "- strings_ref - list type - varible with list of strings that help to filter and extract type 2 tables\n",
    "- table_ref2 - pandas.core.frame.dataframe type - variable that holds tables that are to be extracted from total 'tables'based on the strings_ref\n",
    "- n - string type - variable that denotes one string at a time and compares strings in strings_ref with the presence of strings intable 'table_ref2', helping to exactly filter the ref table of type2 from actual 'tables'.\n",
    "- r2 - pandas.core.frame.DataFrame type - variable that holds tables or dataframes,'table_ref2.df' of type 2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:16:20.569623Z",
     "start_time": "2021-08-04T07:16:19.836795Z"
    }
   },
   "outputs": [],
   "source": [
    "count_ref2 = 0\n",
    "ncount_ref2 = 0\n",
    "for table_ref2 in tables:\n",
    "                                                     \n",
    "    if any(n in table_ref2.df.to_string() for n in strings_ref):\n",
    "        r2 = table_ref2.df\n",
    "        \n",
    "        try:\n",
    "            if r2.iat[2,0] == \"Symmetric\":\n",
    "                count_ref2 = count_ref2 + 1\n",
    "                print(table_ref2.df, \"\\n----------------------------------------------------------------------\\n\")\n",
    "                for a2 in r2:\n",
    "                    BrowseName = r2.iat[1,1]\n",
    "                    Symmetric = r2.iat[2,1]\n",
    "                    \n",
    "                    if Symmetric == \"True\":\n",
    "                        \n",
    "                        rf['ReferenceType'].append(\"The \" + BrowseName + \" is symmetric. Therefore, it should not provide an inverse \" + Inversename +\" reference.\")\n",
    "        \n",
    "        except:\n",
    "            ncount_ref2 = ncount_ref2 + 1\n",
    "            \n",
    "            print(\"--------------------------------wrong extraction-------------------------\")\n",
    "            pass"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:16:20.574549Z",
     "start_time": "2021-08-04T07:16:20.569623Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Case2_Number of TP referencetype tables extracted 0\n",
      "Case2_Number of FP referencetype tables extracted 0\n"
     ]
    }
   ],
   "source": [
    "print(\"Case2_Number of TP referencetype tables extracted\",count_ref2 )\n",
    "print(\"Case2_Number of FP referencetype tables extracted\",ncount_ref2 )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:16:22.547177Z",
     "start_time": "2021-08-04T07:16:21.819855Z"
    }
   },
   "outputs": [],
   "source": [
    "# Type 3 - just another structurally different reference type typedefinition table.\n",
    "count_ref3 = 0\n",
    "ncount_ref3 = 0\n",
    "for table_ref3 in tables:\n",
    "                                                     # select only tables which contain at least one of the key word\n",
    "    if any(n in table_ref3.df.to_string() for n in strings_ref):\n",
    "        r3 = table_ref3.df\n",
    "        \n",
    "        try:\n",
    "            if r3.iat[2,0]== \"InverseName\" and r3.iat[3,0] == \"Symmetric\":\n",
    "                \n",
    "                count_ref3 = count_ref3 + 1\n",
    "                print(table_ref3.df, \"\\n----------------------------------------------------------------------\\n\")\n",
    "                for a3 in r3:\n",
    "                    \n",
    "                    BrowseName = r3.iat[1,1]\n",
    "                    Inversename = r3.iat[2,1]\n",
    "                    Symmetric = r3.iat[3,1]\n",
    "                    \n",
    "                    if Symmetric == \"True\":\n",
    "                        \n",
    "                        rf['ReferenceType'].append(\"The \" + BrowseName + \" is symmetric. Therefore, it should not provide an inverse \" + Inversename +\" reference.\")\n",
    "        \n",
    "        \n",
    "        except:\n",
    "            ncount_ref3 = ncount_ref3 + 1\n",
    "            print(\"------------------------wrong extraction---------------------------\")\n",
    "            pass"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:16:29.943356Z",
     "start_time": "2021-08-04T07:16:29.937347Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Case2_Number of TP referencetype tables extracted 0\n",
      "Case2_Number of FP referencetype tables extracted 0\n"
     ]
    }
   ],
   "source": [
    "print(\"Case2_Number of TP referencetype tables extracted\",count_ref3 )\n",
    "print(\"Case2_Number of FP referencetype tables extracted\",ncount_ref3 )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 51,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:16:30.644276Z",
     "start_time": "2021-08-04T07:16:30.640311Z"
    },
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Number of TP Reference Type tables extracted : 0\n",
      "Number of FP Reference Type tables extracted : 0\n"
     ]
    }
   ],
   "source": [
    "# Sum of Number of True positive and False Negative extractions\n",
    "print(\"Number of TP Reference Type tables extracted :\",count_ref1 + count_ref2 + count_ref3)\n",
    "print(\"Number of FP Reference Type tables extracted :\",ncount_ref1 + ncount_ref2 + ncount_ref3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:16:31.249013Z",
     "start_time": "2021-08-04T07:16:31.243979Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Precision Value of Reference Type Definition tables   doesnotexist\n"
     ]
    }
   ],
   "source": [
    "TP_ref = (count_ref1 + count_ref2 + count_ref3)\n",
    "FP_ref = (ncount_ref1 + ncount_ref2 + ncount_ref3)\n",
    "\n",
    "if (TP_ref + FP_ref) == 0:\n",
    "    Precision_RefTypedef = \"doesnotexist\"\n",
    "else:\n",
    "    Precision_RefTypedef = TP_ref / (TP_ref + FP_ref)\n",
    "    \n",
    "print(\"Precision Value of Reference Type Definition tables  \",Precision_RefTypedef)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 57,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:16:31.978411Z",
     "start_time": "2021-08-04T07:16:31.967454Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Parameter</th>\n",
       "      <th>Value</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Number of TP Reference Type tables extracted</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Number of FP Reference Type tables extracted</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Precision Value of Reference Type Definition t...</td>\n",
       "      <td>doesnotexist</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                           Parameter         Value\n",
       "0       Number of TP Reference Type tables extracted             0\n",
       "1       Number of FP Reference Type tables extracted             0\n",
       "2  Precision Value of Reference Type Definition t...  doesnotexist"
      ]
     },
     "execution_count": 57,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Refeval = pd.DataFrame({'Parameter':['Number of TP Reference Type tables extracted',\n",
    "                                    'Number of FP Reference Type tables extracted','Precision Value of Reference Type Definition tables'],\n",
    "                       'Value':[TP_ref,FP_ref,Precision_RefTypedef]})\n",
    "Refeval"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Empty DataFrame\n",
      "Columns: [ReferenceType]\n",
      "Index: []\n"
     ]
    }
   ],
   "source": [
    "df_2 = pd.DataFrame(rf)\n",
    "print(df_2.head())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### Method AddressSpace Definition"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:17:34.718466Z",
     "start_time": "2021-08-04T07:17:34.714498Z"
    }
   },
   "outputs": [],
   "source": [
    "#Keystrings for Method Address Space\n",
    "\n",
    "strings_mad = [\"Argument[]\",\"InputArguments\",\"OutputArguments\"]\n",
    "notstrings_mad = [\"IsAbstract\",\"InverseName\",\"Symmetric\",\"HasTypeDefinition\",\"Transitions\",\"FromState\",\"ToState\",\"NamespaceUri\",\"Use\",\n",
    "                  \"InputArguments: NONE\",\"OutputArguments: NONE\"]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "- Strings_mad, notstrings_mad - list type - variables with a list of strings that help to filter and extract method addressspace tables from all the tables"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "metadata": {},
   "outputs": [],
   "source": [
    "ma = {'Has_Property': []} #writed output to excel sheet"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "All Method AddressSpace Definition Type 1 - method addressspace tables which have \"BrowseName\" string in 1st row , 0th column\n",
    "- count_mad1 - int type - variable holds count of correctly extracted tables with constraints that is TP of type 1\n",
    "- ncount_mad1 - int type - variable that holds count of incorrectly extracted tables without constraints that is FN of type 1\n",
    "- strings_mad, notstrings_mad - list type - varibles with list of strings that help to filter and extract type 1 tables\n",
    "- table_mad1 - pandas.core.frame.dataframe type - variable that holds tables that are to be extracted from total 'tables' based on the strings_mad , notstrings_mad\n",
    "- n - string type - variable that denotes one string at a time and compares strings in strings_mad,notstrings_mad with the presence of strings in table 'table_mad1', helping to exactly filter the methodaddressspace table of type1 from actual 'tables'.\n",
    "- mad1 - pandas.core.frame.DataFrame type - variable that holds tables or dataframes,'table_mad1.df' of type 1\n",
    "- m1 - int type - variable that holds the row index value through out the range() of all the rows present in the table starting from 3rd row\n",
    "- len() function gives the length, that is the count of rows in the table"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:17:48.989234Z",
     "start_time": "2021-08-04T07:17:48.147085Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "             0                 1                2           3               4  \\\n",
      "0    Attribute             Value                                                \n",
      "1   BrowseName  AddConfiguration                                                \n",
      "2   References         NodeClass       BrowseName    DataType  TypeDefinition   \n",
      "3  HasProperty          Variable   InputArguments  Argument[]    PropertyType   \n",
      "4  HasProperty          Variable  OutputArguments  Argument[]    PropertyType   \n",
      "\n",
      "               5  \n",
      "0                 \n",
      "1                 \n",
      "2  ModellingRule  \n",
      "3      Mandatory  \n",
      "4      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "The AddConfiguration Method HasProperty InputArguments which is Mandatory.\n",
      "The AddConfiguration Method HasProperty OutputArguments which is Mandatory.\n",
      "             0                     1                2           3  \\\n",
      "0    Attribute                 Value                                \n",
      "1   BrowseName  GetConfigurationById                                \n",
      "2   References             NodeClass       BrowseName    DataType   \n",
      "3  HasProperty              Variable   InputArguments  Argument[]   \n",
      "4  HasProperty              Variable  OutputArguments  Argument[]   \n",
      "\n",
      "                4              5  \n",
      "0                                 \n",
      "1                                 \n",
      "2  TypeDefinition  ModellingRule  \n",
      "3    PropertyType      Mandatory  \n",
      "4    PropertyType      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "The GetConfigurationById Method HasProperty InputArguments which is Mandatory.\n",
      "The GetConfigurationById Method HasProperty OutputArguments which is Mandatory.\n",
      "             0                     1                2           3  \\\n",
      "0    Attribute                 Value                                \n",
      "1   BrowseName  GetConfigurationList                                \n",
      "2   References             NodeClass       BrowseName    DataType   \n",
      "3  HasProperty              Variable   InputArguments  Argument[]   \n",
      "4  HasProperty              Variable  OutputArguments  Argument[]   \n",
      "\n",
      "                4              5  \n",
      "0                                 \n",
      "1                                 \n",
      "2  TypeDefinition  ModellingRule  \n",
      "3    PropertyType      Mandatory  \n",
      "4    PropertyType      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "The GetConfigurationList Method HasProperty InputArguments which is Mandatory.\n",
      "The GetConfigurationList Method HasProperty OutputArguments which is Mandatory.\n",
      "             0                           1                2           3  \\\n",
      "0    Attribute                       Value                                \n",
      "1   BrowseName  ReleaseConfigurationHandle                                \n",
      "2   References                   NodeClass       BrowseName    DataType   \n",
      "3  HasProperty                    Variable   InputArguments  Argument[]   \n",
      "4  HasProperty                    Variable  OutputArguments  Argument[]   \n",
      "\n",
      "                4              5  \n",
      "0                                 \n",
      "1                                 \n",
      "2  TypeDefinition  ModellingRule  \n",
      "3    PropertyType      Mandatory  \n",
      "4    PropertyType      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "The ReleaseConfigurationHandle Method HasProperty InputArguments which is Mandatory.\n",
      "The ReleaseConfigurationHandle Method HasProperty OutputArguments which is Mandatory.\n",
      "             0                    1                2           3  \\\n",
      "0    Attribute                Value                                \n",
      "1   BrowseName  RemoveConfiguration                                \n",
      "2   References            NodeClass       BrowseName    DataType   \n",
      "3  HasProperty             Variable   InputArguments  Argument[]   \n",
      "4  HasProperty             Variable  OutputArguments  Argument[]   \n",
      "\n",
      "                4              5  \n",
      "0                                 \n",
      "1                                 \n",
      "2  TypeDefinition  ModellingRule  \n",
      "3    PropertyType      Mandatory  \n",
      "4    PropertyType      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "The RemoveConfiguration Method HasProperty InputArguments which is Mandatory.\n",
      "The RemoveConfiguration Method HasProperty OutputArguments which is Mandatory.\n",
      "             0                      1                2           3  \\\n",
      "0    Attribute                  Value                                \n",
      "1   BrowseName  ActivateConfiguration                                \n",
      "2   References              NodeClass       BrowseName    DataType   \n",
      "3  HasProperty               Variable   InputArguments  Argument[]   \n",
      "4  HasProperty               Variable  OutputArguments  Argument[]   \n",
      "\n",
      "                4              5  \n",
      "0                                 \n",
      "1                                 \n",
      "2  TypeDefinition  ModellingRule  \n",
      "3    PropertyType      Mandatory  \n",
      "4    PropertyType      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "The ActivateConfiguration Method HasProperty InputArguments which is Mandatory.\n",
      "The ActivateConfiguration Method HasProperty OutputArguments which is Mandatory.\n",
      "             0                    1                2           3  \\\n",
      "0    Attribute                Value                                \n",
      "1   BrowseName  GenerateFileForRead                                \n",
      "2   References            NodeClass       BrowseName    DataType   \n",
      "3  HasProperty             Variable   InputArguments  Argument[]   \n",
      "4  HasProperty             Variable  OutputArguments  Argument[]   \n",
      "\n",
      "                4              5  \n",
      "0                                 \n",
      "1                                 \n",
      "2  TypeDefinition  ModellingRule  \n",
      "3    PropertyType      Mandatory  \n",
      "4    PropertyType      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "The GenerateFileForRead Method HasProperty InputArguments which is Mandatory.\n",
      "The GenerateFileForRead Method HasProperty OutputArguments which is Mandatory.\n",
      "             0                     1                2           3  \\\n",
      "0    Attribute                 Value                                \n",
      "1   BrowseName  GenerateFileForWrite                                \n",
      "2   References             NodeClass       BrowseName    DataType   \n",
      "3  HasProperty              Variable   InputArguments  Argument[]   \n",
      "4  HasProperty              Variable  OutputArguments  Argument[]   \n",
      "\n",
      "                4              5  \n",
      "0                                 \n",
      "1                                 \n",
      "2  TypeDefinition  ModellingRule  \n",
      "3    PropertyType      Mandatory  \n",
      "4    PropertyType      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "The GenerateFileForWrite Method HasProperty InputArguments which is Mandatory.\n",
      "The GenerateFileForWrite Method HasProperty OutputArguments which is Mandatory.\n",
      "             0             1                2           3               4  \\\n",
      "0    Attribute         Value                                                \n",
      "1   BrowseName     AddRecipe                                                \n",
      "2   References  Node \\nClass       BrowseName    DataType  TypeDefinition   \n",
      "3  HasProperty      Variable   InputArguments  Argument[]    PropertyType   \n",
      "4  HasProperty      Variable  OutputArguments  Argument[]    PropertyType   \n",
      "\n",
      "               5  \n",
      "0                 \n",
      "1                 \n",
      "2  ModellingRule  \n",
      "3      Mandatory  \n",
      "4      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "The AddRecipe Method HasProperty InputArguments which is Mandatory.\n",
      "The AddRecipe Method HasProperty OutputArguments which is Mandatory.\n",
      "             0              1                2           3               4  \\\n",
      "0    Attribute          Value                                                \n",
      "1   BrowseName  PrepareRecipe                                                \n",
      "2   References   Node \\nClass       BrowseName    DataType  TypeDefinition   \n",
      "3  HasProperty       Variable   InputArguments  Argument[]    PropertyType   \n",
      "4  HasProperty       Variable  OutputArguments  Argument[]    PropertyType   \n",
      "\n",
      "               5  \n",
      "0                 \n",
      "1                 \n",
      "2  ModellingRule  \n",
      "3      Mandatory  \n",
      "4      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "The PrepareRecipe Method HasProperty InputArguments which is Mandatory.\n",
      "The PrepareRecipe Method HasProperty OutputArguments which is Mandatory.\n",
      "             0                1                2           3               4  \\\n",
      "0    Attribute            Value                                                \n",
      "1   BrowseName  UnprepareRecipe                                                \n",
      "2   References        NodeClass       BrowseName    DataType  TypeDefinition   \n",
      "3  HasProperty         Variable   InputArguments  Argument[]    PropertyType   \n",
      "4  HasProperty         Variable  OutputArguments  Argument[]    PropertyType   \n",
      "\n",
      "               5  \n",
      "0                 \n",
      "1                 \n",
      "2  ModellingRule  \n",
      "3      Mandatory  \n",
      "4      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "The UnprepareRecipe Method HasProperty InputArguments which is Mandatory.\n",
      "The UnprepareRecipe Method HasProperty OutputArguments which is Mandatory.\n",
      "             0                      1                2           3  \\\n",
      "0    Attribute                  Value                                \n",
      "1   BrowseName  GetRecipeListFiltered                                \n",
      "2   References           Node \\nClass       BrowseName    DataType   \n",
      "3  HasProperty               Variable   InputArguments  Argument[]   \n",
      "4  HasProperty               Variable  OutputArguments  Argument[]   \n",
      "\n",
      "                4              5  \n",
      "0                                 \n",
      "1                                 \n",
      "2  TypeDefinition  ModellingRule  \n",
      "3    PropertyType      Mandatory  \n",
      "4    PropertyType      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "The GetRecipeListFiltered Method HasProperty InputArguments which is Mandatory.\n",
      "The GetRecipeListFiltered Method HasProperty OutputArguments which is Mandatory.\n",
      "             0                    1                2           3  \\\n",
      "0    Attribute                Value                                \n",
      "1   BrowseName  ReleaseRecipeHandle                                \n",
      "2   References         Node \\nClass       BrowseName    DataType   \n",
      "3  HasProperty             Variable   InputArguments  Argument[]   \n",
      "4  HasProperty             Variable  OutputArguments  Argument[]   \n",
      "\n",
      "                4              5  \n",
      "0                                 \n",
      "1                                 \n",
      "2  TypeDefinition  ModellingRule  \n",
      "3    PropertyType      Mandatory  \n",
      "4    PropertyType      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "The ReleaseRecipeHandle Method HasProperty InputArguments which is Mandatory.\n",
      "The ReleaseRecipeHandle Method HasProperty OutputArguments which is Mandatory.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "             0             1                2           3               4  \\\n",
      "0    Attribute         Value                                                \n",
      "1   BrowseName  RemoveRecipe                                                \n",
      "2   References     NodeClass       BrowseName    DataType  TypeDefinition   \n",
      "3  HasProperty      Variable   InputArguments  Argument[]    PropertyType   \n",
      "4  HasProperty      Variable  OutputArguments  Argument[]    PropertyType   \n",
      "\n",
      "               5  \n",
      "0                 \n",
      "1                 \n",
      "2  ModellingRule  \n",
      "3      Mandatory  \n",
      "4      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "The RemoveRecipe Method HasProperty InputArguments which is Mandatory.\n",
      "The RemoveRecipe Method HasProperty OutputArguments which is Mandatory.\n",
      "             0               1                2           3               4  \\\n",
      "0    Attribute           Value                                                \n",
      "1   BrowseName  PrepareProduct                                                \n",
      "2   References       NodeClass       BrowseName    DataType  TypeDefinition   \n",
      "3  HasProperty        Variable   InputArguments  Argument[]    PropertyType   \n",
      "4  HasProperty        Variable  OutputArguments  Argument[]    PropertyType   \n",
      "\n",
      "               5  \n",
      "0                 \n",
      "1                 \n",
      "2  ModellingRule  \n",
      "3      Mandatory  \n",
      "4      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "The PrepareProduct Method HasProperty InputArguments which is Mandatory.\n",
      "The PrepareProduct Method HasProperty OutputArguments which is Mandatory.\n",
      "             0                 1                2           3               4  \\\n",
      "0    Attribute             Value                                                \n",
      "1   BrowseName  UnprepareProduct                                                \n",
      "2   References         NodeClass       BrowseName    DataType  TypeDefinition   \n",
      "3  HasProperty          Variable   InputArguments  Argument[]    PropertyType   \n",
      "4  HasProperty          Variable  OutputArguments  Argument[]    PropertyType   \n",
      "\n",
      "               5  \n",
      "0                 \n",
      "1                 \n",
      "2  ModellingRule  \n",
      "3      Mandatory  \n",
      "4      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "The UnprepareProduct Method HasProperty InputArguments which is Mandatory.\n",
      "The UnprepareProduct Method HasProperty OutputArguments which is Mandatory.\n",
      "             0              1                2           3               4  \\\n",
      "0    Attribute          Value                                                \n",
      "1   BrowseName  UnlinkProduct                                                \n",
      "2   References      NodeClass       BrowseName    DataType  TypeDefinition   \n",
      "3  HasProperty       Variable   InputArguments  Argument[]    PropertyType   \n",
      "4  HasProperty       Variable  OutputArguments  Argument[]    PropertyType   \n",
      "\n",
      "               5  \n",
      "0                 \n",
      "1                 \n",
      "2  ModellingRule  \n",
      "3      Mandatory  \n",
      "4      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "The UnlinkProduct Method HasProperty InputArguments which is Mandatory.\n",
      "The UnlinkProduct Method HasProperty OutputArguments which is Mandatory.\n",
      "             0                    1                2           3  \\\n",
      "0    Attribute                Value                                \n",
      "1   BrowseName  GenerateFileForRead                                \n",
      "2   References            NodeClass       BrowseName    DataType   \n",
      "3  HasProperty             Variable   InputArguments  Argument[]   \n",
      "4  HasProperty             Variable  OutputArguments  Argument[]   \n",
      "\n",
      "                4              5  \n",
      "0                                 \n",
      "1                                 \n",
      "2  TypeDefinition  ModellingRule  \n",
      "3    PropertyType      Mandatory  \n",
      "4    PropertyType      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "The GenerateFileForRead Method HasProperty InputArguments which is Mandatory.\n",
      "The GenerateFileForRead Method HasProperty OutputArguments which is Mandatory.\n",
      "             0                     1                2           3  \\\n",
      "0    Attribute                 Value                                \n",
      "1   BrowseName  GenerateFileForWrite                                \n",
      "2   References             NodeClass       BrowseName    DataType   \n",
      "3  HasProperty              Variable   InputArguments  Argument[]   \n",
      "4  HasProperty              Variable  OutputArguments  Argument[]   \n",
      "\n",
      "                4              5  \n",
      "0                                 \n",
      "1                                 \n",
      "2  TypeDefinition  ModellingRule  \n",
      "3    PropertyType      Mandatory  \n",
      "4    PropertyType      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "The GenerateFileForWrite Method HasProperty InputArguments which is Mandatory.\n",
      "The GenerateFileForWrite Method HasProperty OutputArguments which is Mandatory.\n",
      "             0            1                2           3               4  \\\n",
      "0    Attribute        Value                                                \n",
      "1   BrowseName  LinkProduct                                                \n",
      "2   References    NodeClass       BrowseName    DataType  TypeDefinition   \n",
      "3  HasProperty     Variable   InputArguments  Argument[]    PropertyType   \n",
      "4  HasProperty     Variable  OutputArguments  Argument[]    PropertyType   \n",
      "\n",
      "               5  \n",
      "0                 \n",
      "1                 \n",
      "2  ModellingRule  \n",
      "3      Mandatory  \n",
      "4      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "The LinkProduct Method HasProperty InputArguments which is Mandatory.\n",
      "The LinkProduct Method HasProperty OutputArguments which is Mandatory.\n",
      "             0              1                2           3               4  \\\n",
      "0    Attribute          Value                                                \n",
      "1   BrowseName  UnlinkProduct                                                \n",
      "2   References      NodeClass       BrowseName    DataType  TypeDefinition   \n",
      "3  HasProperty       Variable   InputArguments  Argument[]    PropertyType   \n",
      "4  HasProperty       Variable  OutputArguments  Argument[]    PropertyType   \n",
      "\n",
      "               5  \n",
      "0                 \n",
      "1                 \n",
      "2  ModellingRule  \n",
      "3      Mandatory  \n",
      "4      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "The UnlinkProduct Method HasProperty InputArguments which is Mandatory.\n",
      "The UnlinkProduct Method HasProperty OutputArguments which is Mandatory.\n",
      "             0          1                2           3               4  \\\n",
      "0    Attribute      Value                                                \n",
      "1   BrowseName    Prepare                                                \n",
      "2   References  NodeClass       BrowseName    DataType  TypeDefinition   \n",
      "3  HasProperty   Variable  OutputArguments  Argument[]    PropertyType   \n",
      "\n",
      "               5  \n",
      "0                 \n",
      "1                 \n",
      "2  ModellingRule  \n",
      "3      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "The Prepare Method HasProperty OutputArguments which is Mandatory.\n",
      "             0          1                2           3               4  \\\n",
      "0    Attribute      Value                                                \n",
      "1   BrowseName  Unprepare                                                \n",
      "2   References  NodeClass       BrowseName    DataType  TypeDefinition   \n",
      "3  HasProperty   Variable  OutputArguments  Argument[]    PropertyType   \n",
      "\n",
      "               5  \n",
      "0                 \n",
      "1                 \n",
      "2  ModellingRule  \n",
      "3      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "The Unprepare Method HasProperty OutputArguments which is Mandatory.\n",
      "             0              1                2           3               4  \\\n",
      "0    Attribute          Value                                                \n",
      "1   BrowseName  GetResultById                                                \n",
      "2   References      NodeClass       BrowseName    DataType  TypeDefinition   \n",
      "3  HasProperty       Variable   InputArguments  Argument[]    PropertyType   \n",
      "4  HasProperty       Variable  OutputArguments  Argument[]    PropertyType   \n",
      "\n",
      "               5  \n",
      "0                 \n",
      "1                 \n",
      "2  ModellingRule  \n",
      "3      Mandatory  \n",
      "4      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "The GetResultById Method HasProperty InputArguments which is Mandatory.\n",
      "The GetResultById Method HasProperty OutputArguments which is Mandatory.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "             0              1                2           3               4  \\\n",
      "0    Attribute          Value                                                \n",
      "1   BrowseName  GetResultById                                                \n",
      "2   References      NodeClass       BrowseName    DataType  TypeDefinition   \n",
      "3  HasProperty       Variable   InputArguments  Argument[]    PropertyType   \n",
      "4  HasProperty       Variable  OutputArguments  Argument[]    PropertyType   \n",
      "\n",
      "               5  \n",
      "0                 \n",
      "1                 \n",
      "2  ModellingRule  \n",
      "3      Mandatory  \n",
      "4      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "The GetResultById Method HasProperty InputArguments which is Mandatory.\n",
      "The GetResultById Method HasProperty OutputArguments which is Mandatory.\n",
      "             0                      1                2           3  \\\n",
      "0    Attribute                  Value                                \n",
      "1   BrowseName  GetResultListFiltered                                \n",
      "2   References              NodeClass       BrowseName    DataType   \n",
      "3  HasProperty               Variable   InputArguments  Argument[]   \n",
      "4  HasProperty               Variable  OutputArguments  Argument[]   \n",
      "\n",
      "                4              5  \n",
      "0                                 \n",
      "1                                 \n",
      "2  TypeDefinition  ModellingRule  \n",
      "3    PropertyType      Mandatory  \n",
      "4    PropertyType      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "The GetResultListFiltered Method HasProperty InputArguments which is Mandatory.\n",
      "The GetResultListFiltered Method HasProperty OutputArguments which is Mandatory.\n",
      "             0                    1               2           3  \\\n",
      "0    Attribute                Value                               \n",
      "1   BrowseName  ReleaseResultHandle                               \n",
      "2   References            NodeClass      BrowseName    DataType   \n",
      "3  HasProperty             Variable  InputArguments  Argument[]   \n",
      "\n",
      "                4              5  \n",
      "0                                 \n",
      "1                                 \n",
      "2  TypeDefinition  ModellingRule  \n",
      "3    PropertyType      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "The ReleaseResultHandle Method HasProperty InputArguments which is Mandatory.\n",
      "-------------------------------wrong extraction------------------------------\n",
      "             0                    1                2           3  \\\n",
      "0    Attribute                Value                                \n",
      "1   BrowseName  GenerateFileForRead                                \n",
      "2   References            NodeClass       BrowseName    DataType   \n",
      "3  HasProperty             Variable   InputArguments  Argument[]   \n",
      "4  HasProperty             Variable  OutputArguments  Argument[]   \n",
      "\n",
      "                4              5  \n",
      "0                                 \n",
      "1                                 \n",
      "2  TypeDefinition  ModellingRule  \n",
      "3    PropertyType      Mandatory  \n",
      "4    PropertyType      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "The GenerateFileForRead Method HasProperty InputArguments which is Mandatory.\n",
      "The GenerateFileForRead Method HasProperty OutputArguments which is Mandatory.\n",
      "             0                  1                2           3  \\\n",
      "0    Attribute              Value                                \n",
      "1   BrowseName  ReportSafetyState                                \n",
      "2   References          NodeClass       BrowseName    DataType   \n",
      "3  HasProperty           Variable   InputArguments  Argument[]   \n",
      "4  HasProperty           Variable  OutputArguments  Argument[]   \n",
      "\n",
      "                4              5  \n",
      "0                                 \n",
      "1                                 \n",
      "2  TypeDefinition  ModellingRule  \n",
      "3    PropertyType      Mandatory  \n",
      "4    PropertyType      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "The ReportSafetyState Method HasProperty InputArguments which is Mandatory.\n",
      "The ReportSafetyState Method HasProperty OutputArguments which is Mandatory.\n",
      "             0          1                2           3               4  \\\n",
      "0    Attribute      Value                                                \n",
      "1   BrowseName       Halt                                                \n",
      "2   References  NodeClass       BrowseName    DataType  TypeDefinition   \n",
      "3  HasProperty   Variable   InputArguments  Argument[]    PropertyType   \n",
      "4  HasProperty   Variable  OutputArguments  Argument[]    PropertyType   \n",
      "\n",
      "               5  \n",
      "0                 \n",
      "1                 \n",
      "2  ModellingRule  \n",
      "3      Mandatory  \n",
      "4      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "The Halt Method HasProperty InputArguments which is Mandatory.\n",
      "The Halt Method HasProperty OutputArguments which is Mandatory.\n",
      "             0          1                2           3               4  \\\n",
      "0    Attribute      Value                                                \n",
      "1   BrowseName      Reset                                                \n",
      "2   References  NodeClass       BrowseName    DataType  TypeDefinition   \n",
      "3  HasProperty   Variable   InputArguments  Argument[]    PropertyType   \n",
      "4  HasProperty   Variable  OutputArguments  Argument[]    PropertyType   \n",
      "\n",
      "               5  \n",
      "0                 \n",
      "1                 \n",
      "2  ModellingRule  \n",
      "3      Mandatory  \n",
      "4      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "The Reset Method HasProperty InputArguments which is Mandatory.\n",
      "The Reset Method HasProperty OutputArguments which is Mandatory.\n",
      "             0                    1                2           3  \\\n",
      "0    Attribute                Value                                \n",
      "1   BrowseName  SelectModeAutomatic                                \n",
      "2   References            NodeClass       BrowseName    DataType   \n",
      "3  HasProperty             Variable  OutputArguments  Argument[]   \n",
      "\n",
      "                4              5  \n",
      "0                                 \n",
      "1                                 \n",
      "2  TypeDefinition  ModellingRule  \n",
      "3    PropertyType      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "The SelectModeAutomatic Method HasProperty OutputArguments which is Mandatory.\n",
      "             0           1               2           3               4  \\\n",
      "0    Attribute       Value                                               \n",
      "1   BrowseName  ConfirmAll                                               \n",
      "2   References   NodeClass      BrowseName    DataType  TypeDefinition   \n",
      "3  HasProperty    Variable  InputArguments  Argument[]    PropertyType   \n",
      "\n",
      "               5  \n",
      "0                 \n",
      "1                 \n",
      "2  ModellingRule  \n",
      "3      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "The ConfirmAll Method HasProperty InputArguments which is Mandatory.\n",
      "             0                1                2           3               4  \\\n",
      "0    Attribute            Value                                                \n",
      "1   BrowseName  StartContinuous                                                \n",
      "2   References        NodeClass       BrowseName    DataType  TypeDefinition   \n",
      "3  HasProperty         Variable   InputArguments  Argument[]    PropertyType   \n",
      "4  HasProperty         Variable  OutputArguments  Argument[]    PropertyType   \n",
      "\n",
      "               5  \n",
      "0                 \n",
      "1                 \n",
      "2  ModellingRule  \n",
      "3      Mandatory  \n",
      "4      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "The StartContinuous Method HasProperty InputArguments which is Mandatory.\n",
      "The StartContinuous Method HasProperty OutputArguments which is Mandatory.\n",
      "             0          1                2           3               4  \\\n",
      "0    Attribute      Value                                                \n",
      "1   BrowseName      Abort                                                \n",
      "2   References  NodeClass       BrowseName    DataType  TypeDefinition   \n",
      "3  HasProperty   Variable   InputArguments  Argument[]    PropertyType   \n",
      "4  HasProperty   Variable  OutputArguments  Argument[]    PropertyType   \n",
      "\n",
      "               5  \n",
      "0                 \n",
      "1                 \n",
      "2  ModellingRule  \n",
      "3      Mandatory  \n",
      "4      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "The Abort Method HasProperty InputArguments which is Mandatory.\n",
      "The Abort Method HasProperty OutputArguments which is Mandatory.\n",
      "             0          1                2           3               4  \\\n",
      "0    Attribute      Value                                                \n",
      "1   BrowseName       Stop                                                \n",
      "2   References  NodeClass       BrowseName    DataType  TypeDefinition   \n",
      "3  HasProperty   Variable   InputArguments  Argument[]    PropertyType   \n",
      "4  HasProperty   Variable  OutputArguments  Argument[]    PropertyType   \n",
      "\n",
      "               5  \n",
      "0                 \n",
      "1                 \n",
      "2  ModellingRule  \n",
      "3      Mandatory  \n",
      "4      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "The Stop Method HasProperty InputArguments which is Mandatory.\n",
      "The Stop Method HasProperty OutputArguments which is Mandatory.\n",
      "             0               1                2           3               4  \\\n",
      "0    Attribute           Value                                                \n",
      "1   BrowseName  SimulationMode                                                \n",
      "2   References       NodeClass       BrowseName    DataType  TypeDefinition   \n",
      "3  HasProperty        Variable   InputArguments  Argument[]    PropertyType   \n",
      "4  HasProperty        Variable  OutputArguments  Argument[]    PropertyType   \n",
      "\n",
      "               5  \n",
      "0                 \n",
      "1                 \n",
      "2  ModellingRule  \n",
      "3      Mandatory  \n",
      "4      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "The SimulationMode Method HasProperty InputArguments which is Mandatory.\n",
      "The SimulationMode Method HasProperty OutputArguments which is Mandatory.\n",
      "             0          1                2           3               4  \\\n",
      "0    Attribute      Value                                                \n",
      "1   BrowseName       Sync                                                \n",
      "2   References  NodeClass       BrowseName    DataType  TypeDefinition   \n",
      "3  HasProperty   Variable   InputArguments  Argument[]    PropertyType   \n",
      "4  HasProperty   Variable  OutputArguments  Argument[]    PropertyType   \n",
      "\n",
      "               5  \n",
      "0                 \n",
      "1                 \n",
      "2  ModellingRule  \n",
      "3      Mandatory  \n",
      "4      Mandatory   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "The Sync Method HasProperty InputArguments which is Mandatory.\n",
      "The Sync Method HasProperty OutputArguments which is Mandatory.\n"
     ]
    }
   ],
   "source": [
    "count_mad1 = 0\n",
    "ncount_mad1 = 0\n",
    "for table_mad1 in tables:\n",
    "                                                     # select only tables which contain at least one of the key word\n",
    "    if any(n in table_mad1.df.to_string() for n in strings_mad):\n",
    "        if not any(n in table_mad1.df.to_string() for n in notstrings_mad):\n",
    "            mad1 = table_mad1.df\n",
    "            try:\n",
    "                if mad1.iat[1,0] == \"BrowseName\":\n",
    "                    print(table_mad1.df, \"\\n----------------------------------------------------------------------\\n\")\n",
    "                    count_mad1 = count_mad1 + 1\n",
    "                    for m1 in range(3,len(mad1)):\n",
    "                        Method = mad1.iat[1,1] #BrowseName\n",
    "                        Reference = mad1.iat[m1,0]\n",
    "                        Prop = mad1.iat[m1,2]\n",
    "                        Type = mad1.iat[m1,3]\n",
    "                        Mod_rule = mad1.iat[m1,5]\n",
    "                        # defining the constraints for Method addressspace tables using string concationation, \n",
    "                        # taking the cellwise values from tables and assigning them based on the lexical template designed below.\n",
    "                        \n",
    "                        \n",
    "                        if Reference == \"HasProperty\":\n",
    "                            print(\"The \"+ Method + \" Method \" + Reference + \" \" + Prop + \" which is \" + Mod_rule + \".\")\n",
    "                            ma['Has_Property'].append(\"The \"+ Method + \" Method \"+ Reference + \" \" + Prop + \" which is \" + Mod_rule + \".\")  \n",
    "                        else:\n",
    "                            print(\"Method-AddressSpace Constraint: The Method \" + Method + \" does not take anymore input arguments. \")\n",
    "                            #ma['Has_No_Property'].append(\"The Method \" + Method + \" does not take anymore input arguments. \")\n",
    "            except:\n",
    "                ncount_mad1 = ncount_mad1 + 1\n",
    "                print(\"-------------------------------wrong extraction------------------------------\")\n",
    "                pass\n",
    "            "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "All Method AddressSpace Definition Type 2 - methodaddressspace tables which have \"IsAbstract\" string in the 2nd row 0th column\n",
    "- count_mad2 - int type - variable holds count of correctly extracted tables with constraints that is TP of type 2\n",
    "- ncount_mad2 - int type - variable that holds count of incorrectly extracted tables without constraints that is FN of type 2\n",
    "- strings_mad, notstrings_mad - list type - varibles with list of strings that help to filter and extract type 2 tables\n",
    "- table_mad2 - pandas.core.frame.dataframe type - variable that holds tables that are to be extracted from total 'tables' based on the strings_mad , notstrings_mad\n",
    "- n - string type - variable that denotes one string at a time and compares strings in strings_mad,notstrings_mad with the presence of strings in table 'table_mad2', helping to exactly filter the methodaddressspace table of type1 from actual 'tables'.\n",
    "- mad2 - pandas.core.frame.DataFrame type - variable that holds tables or dataframes,'table_mad2.df' of type 2\n",
    "- m2 - int type - variable that holds the row index value through out the range() of all the rows present in the table starting from 3rd row\n",
    "- len() function gives the length, that is the count of rows in the table"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:17:49.888535Z",
     "start_time": "2021-08-04T07:17:48.990234Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "------------------------------wrong extraction------------------------------------\n",
      "------------------------------wrong extraction------------------------------------\n"
     ]
    }
   ],
   "source": [
    "count_mad2 = 0\n",
    "ncount_mad2 = 0\n",
    "for table_mad2 in tables:\n",
    "                                                     # select only tables which contain at least one of the key word\n",
    "    if any(n in table_mad2.df.to_string() for n in strings_mad):\n",
    "        if not any(n in table_mad2.df.to_string() for n in notstrings_mad):\n",
    "            mad2 = table_mad2.df\n",
    "            try:\n",
    "                if mad2.iat[2,0] == \"IsAbstract\":\n",
    "                    #print(table_mad2.df, \"\\n----------------------------------------------------------------------\\n\")\n",
    "                    count_mad2 = count_mad2 + 1\n",
    "                    for m2 in range(3,len(mad2)):\n",
    "                        Method = mad2.iat[1,1] #BrowseName\n",
    "                        Reference = mad2.iat[m2,0]\n",
    "                        Prop = mad2.iat[m2,2]\n",
    "                        Type = mad2.iat[m2,3]\n",
    "                        Mod_rule = mad2.iat[m2,5]\n",
    "                        \n",
    "                        if Reference == \"HasProperty\":\n",
    "                            print(\"The \"+ Method + \" Method \" + Reference + \" \" + Prop + \" which is \" + Mod_rule + \".\")\n",
    "                            ma['Has_Property'].append(\"The \"+ Method + \" Method \" + Reference + \" \" + Prop + \" which is \" + Mod_rule + \".\")\n",
    "                        else:\n",
    "                            print(\"Method-AddressSpace Constraint: The Method \" + Method + \" does not take anymore input arguments. \")\n",
    "                            #ma['Has_No_Property'].append(\"The Method \" + Method + \" does not take anymore input arguments. \")\n",
    "            except:\n",
    "                ncount_mad2 = ncount_mad2 + 1\n",
    "                print(\"------------------------------wrong extraction------------------------------------\")\n",
    "                pass"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 71,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:17:50.888353Z",
     "start_time": "2021-08-04T07:17:50.883313Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Number of TP MethodAddressspace Type tables extracted : 38\n",
      "Number of FP MethodAddressspace Type tables extracted : 3\n"
     ]
    }
   ],
   "source": [
    "print(\"Number of TP MethodAddressspace Type tables extracted :\",count_mad1 + count_mad2 )\n",
    "print(\"Number of FP MethodAddressspace Type tables extracted :\",ncount_mad1 + ncount_mad2 )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:17:51.591080Z",
     "start_time": "2021-08-04T07:17:51.584091Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0.926829268292683\n"
     ]
    }
   ],
   "source": [
    "TP_mad = (count_mad1 + count_mad2)\n",
    "FP_mad = (ncount_mad1 + ncount_mad2)\n",
    "Precision_MADTypedef = 0\n",
    "\n",
    "#Precision_MADTypedef = TP_mad / (TP_mad + FP_mad)\n",
    "if(TP_mad+FP_mad) == 0:\n",
    "    Preision_MADTypedef = 'doesnotexist'\n",
    "else:\n",
    "    Precision_MADTypedef = TP_mad/(TP_mad+FP_mad)\n",
    "print(Precision_MADTypedef)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:17:52.360875Z",
     "start_time": "2021-08-04T07:17:52.348878Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Parameter</th>\n",
       "      <th>Value</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Number of TP MethodAddressspace Type tables ex...</td>\n",
       "      <td>38.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Number of FP MethodAddressspace Type tables ex...</td>\n",
       "      <td>3.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Precision Value of MethodAddressspace Type Def...</td>\n",
       "      <td>0.926829</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                           Parameter      Value\n",
       "0  Number of TP MethodAddressspace Type tables ex...  38.000000\n",
       "1  Number of FP MethodAddressspace Type tables ex...   3.000000\n",
       "2  Precision Value of MethodAddressspace Type Def...   0.926829"
      ]
     },
     "execution_count": 74,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "MAD = pd.DataFrame({'Parameter':['Number of TP MethodAddressspace Type tables extracted',\n",
    "                                 'Number of FP MethodAddressspace Type tables extracted','Precision Value of MethodAddressspace Type Definition tables'],\n",
    "                   'Value':[TP_mad,FP_mad,Precision_MADTypedef]})\n",
    "MAD"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "                                        Has_Property\n",
      "0  The AddConfiguration Method HasProperty InputA...\n",
      "1  The AddConfiguration Method HasProperty Output...\n",
      "2  The GetConfigurationById Method HasProperty In...\n",
      "3  The GetConfigurationById Method HasProperty Ou...\n",
      "4  The GetConfigurationList Method HasProperty In...\n"
     ]
    }
   ],
   "source": [
    "df_3 = pd.DataFrame(ma)\n",
    "print(df_3.head())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### DataType Structure Tables"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "- dstr, notdstr - list type - variables with a list of strings that help to filter and extract datatypestructure tables from all the tables"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:17:57.867182Z",
     "start_time": "2021-08-04T07:17:57.862499Z"
    }
   },
   "outputs": [],
   "source": [
    "#Keywords for DataType Structure tables\n",
    "\n",
    "dstr = [\"Name\",\"Structure\",\"O / M\",\"UNECE/ncode\",\"UnitId\",\"structure\",\"Descriptor\",\"Remote\",\"EUInformation\",\"CmdValue\",\"PackMLDescriptorDataType\"]\n",
    "notdstr = [\"User\",\"Used\",\"Namespace Index\", \"Example\",\"Definition of Term\",\"DisplayName\",\"TypeDefinition\",\"Attributes\", \"PropertyType\",\n",
    "           \"ComponentType\",\"Is Abstract\", \"NodeClass\", \"ModellingRule\", \"Enumeration\", \"EnumString\",\"ConformanceUnit\",\"onformance Unit\",\"Server\",\n",
    "           \"Notation\", \"ValueRank\",\"NamespaceURI\",\"Namespace Index\",\"Remarks\",\"Result Code\",\"Argument\",\"Optional/ \\nMandatory\",\"Category\",\n",
    "           \"NamespaceVersion\",\"StateMachine\",\"Organizes\", \"100\",\"TaskControlType\",\"Notes –  Notes referencing footnotes of the table content.\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 78,
   "metadata": {},
   "outputs": [],
   "source": [
    "dt = {'DataType':[]}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "All datatypestructure tables Type 1 - datatypestructure tables which have \"Name\" string in 0st row , 0th column, but \"Description\" string not in 0th row 2nd column\n",
    "- countds1 - int type - variable holds count of correctly extracted tables with constraints that is TP of type 1\n",
    "- ncountds1 - int type - variable that holds count of incorrectly extracted tables without constraints that is FN of type 1\n",
    "- dstr, notdstr - list type - varibles with list of strings that help to filter and extract type 1 tables\n",
    "- table_ds1 - pandas.core.frame.dataframe type - variable that holds tables that are to be extracted from total 'tables'based on the dstr, notdstr\n",
    "- n - string type - variable that denotes one string at a time and compares strings in dstr, notdstr with the presence of strings in table 'table_ds1', helping to exactly filter the datatypestructure table of type1 from actual 'tables'.\n",
    "- ds1 - pandas.core.frame.DataFrame type - variable that holds tables or dataframes,'table_ds1.df' of type 1\n",
    "- d1 - int type - variable that holds the row index value through out the range() of all the rows present in the table starting from 2nd row\n",
    "- len() function gives the length, that is the count of rows in the table"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 79,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:18:00.874190Z",
     "start_time": "2021-08-04T07:18:00.824952Z"
    }
   },
   "outputs": [],
   "source": [
    "countds1 = 0\n",
    "ncountds1 = 0\n",
    "\n",
    "for table_ds1 in tables:\n",
    "                                                     \n",
    "    if any(n in (table_ds1.df).astype(str) for n in dstr):\n",
    "        if not any(n in (table_ds1.df).astype(str) for n in notdstr):\n",
    "            ds1 = table_ds1.df\n",
    "            \n",
    "            try:\n",
    "                if len(ds1.columns) == 2 and ds1.iat[0,0].lower().strip() == \"name\" and ds1.iat[0,2].lower().strip() != \"description\":\n",
    "                    \n",
    "                    \n",
    "                    print(table_ds1.df, \"\\n----------------------------------------------------------------------\\n\")\n",
    "                    count_ds1 = count_ds1 + 1\n",
    "                \n",
    "                    for d1 in range(2,len(ds1)):\n",
    "                        \n",
    "                        DataType = ds1.iat[1,0]                              \n",
    "                        Name = ds1.iat[d1,0] #ElementName\n",
    "                        elementType = ds1.iat[d1,1]\n",
    "                        \n",
    "                \n",
    "                        print(\"The \" + DataType + \" is composed of elements: \"+ Name + \" of type \" + elementType + \".\")\n",
    "                        dt['DataType'].append(\"The \" + DataType + \" is composed of elements: \"+ Name + \" of type \" + elementType + \".\")\n",
    "            except:\n",
    "                if len(ds1.columns) != 2:\n",
    "                    ncountds1 = ncountds1 + 1\n",
    "                    print(\"------------------wrong extraction-----------------\")\n",
    "                    pass"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:18:03.239555Z",
     "start_time": "2021-08-04T07:18:01.417671Z"
    }
   },
   "outputs": [],
   "source": [
    "countds2 = 0\n",
    "ncountds2 = 0\n",
    "for table_ds2 in tables:\n",
    "                                                     \n",
    "    if any(n in table_ds2.df.to_string() for n in dstr):\n",
    "        if not any(n in table_ds2.df.to_string() for n in notdstr):\n",
    "            ds2 = table_ds2.df\n",
    "            \n",
    "            try:\n",
    "                if len(ds2.columns) == 3 and ds2.iat[0,0].lower().strip() == \"name\" and ds2.iat[0,1].lower().strip() == \"type\" and ds2.iat[0,2].lower().strip() == \"description\":\n",
    "                    \n",
    "                    \n",
    "                    #print(table_ds2.df, \"\\n----------------------------------------------------------------------\\n\")\n",
    "                    countds2 = countds2 + 1\n",
    "                \n",
    "                    for d2 in range(2,len(ds2)):\n",
    "                        \n",
    "                        DataType = ds2.iat[1,0].strip('\\n')\n",
    "                        Name = ds2.iat[d2,0] #ElementName\n",
    "                        elementType = ds2.iat[d2,1]\n",
    "                        desc = ds2.iat[d2,2]\n",
    "                        #Type = t.iat[a,3]\n",
    "                        print(\"The \" + DataType + \" is composed of elements: \"+ Name + \" of type \" + elementType + \".\")\n",
    "                        dt['DataType'].append(\"The \" + DataType + \" is composed of elements: \"+ Name + \" of type \" + elementType + \".\")\n",
    "            except:\n",
    "                if len(ds2.columns) != 3:\n",
    "                    ncountds2 = ncountds2 + 0\n",
    "                    print(\"---------\")\n",
    "                    pass"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 81,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:18:05.055536Z",
     "start_time": "2021-08-04T07:18:03.240598Z"
    }
   },
   "outputs": [],
   "source": [
    "countds3 = 0\n",
    "ncountds3 = 0\n",
    "for table_ds3 in tables:\n",
    "                                                     # select only tables which contain at least one of the key word\n",
    "    if any(n in table_ds3.df.to_string() for n in dstr):\n",
    "        if not any(n in table_ds3.df.to_string() for n in notdstr):\n",
    "            ds3 = table_ds3.df\n",
    "            \n",
    "            try:\n",
    "                if len(ds3.columns) == 4 and ds2.iat[0,0].lower().strip() == \"name\" and ds3.iat[0,1].lower().strip() == \"type\" and ds3.iat[0,2].lower().strip() == \"description\" and ds3.iat[0,3] == \"O / M\":\n",
    "                    \n",
    "                    \n",
    "                    #print(table_ds3.df, \"\\n----------------------------------------------------------------------\\n\")\n",
    "                    countds3 = countds3 + 1\n",
    "                \n",
    "                    for d3 in range(1,len(ds3)):\n",
    "                        \n",
    "                        DataType = ds3.iat[1,0]                              \n",
    "                        Name = ds3.iat[d3,0] #ElementName\n",
    "                        elementType = ds3.iat[d3,1]\n",
    "                        desc = ds3.iat[d3,2]\n",
    "                        condition = ds3.iat[d3,3]\n",
    "                #Type = t.iat[a,3]\n",
    "                        #print(\"The \" + DataType + \" is composed of elements: \"+ Name + \" of type \" + elementType + \".\")\n",
    "                        dt['DataType'].append(\"The \" + DataType + \"is composed of elements: \"+ Name + \" of type \" + elementType + \".\")\n",
    "            except:\n",
    "                if len(ds3.columns) != 4:\n",
    "                    ncountds3 = ncountds3 + 0\n",
    "                    print(\"------------------wrong extraction-----------------\")\n",
    "                    pass"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 83,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:18:05.078695Z",
     "start_time": "2021-08-04T07:18:05.073695Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Number of TP Datatype Structure Type tables extracted : 14\n",
      "Number of FP Datatype Structure Type tables extracted : 0\n"
     ]
    }
   ],
   "source": [
    "print(\"Number of TP Datatype Structure Type tables extracted :\",countds1 + countds2 + countds3 )\n",
    "print(\"Number of FP Datatype Structure Type tables extracted :\",ncountds1 + ncountds2 + ncountds3 )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 84,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:18:05.085694Z",
     "start_time": "2021-08-04T07:18:05.080703Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1.0\n"
     ]
    }
   ],
   "source": [
    "TP_dstr = (countds1 + countds2 + countds3)\n",
    "FP_dstr = (ncountds1 + ncountds2 + ncountds3 )\n",
    "if  (TP_dstr+FP_dstr) == 0:\n",
    "    Precision_Dstr = 'doesnotexist'\n",
    "else:\n",
    "    Precision_Dstr = TP_dstr/(TP_dstr+FP_dstr)\n",
    "print(Precision_Dstr)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 85,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:18:05.095694Z",
     "start_time": "2021-08-04T07:18:05.087693Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Parameter</th>\n",
       "      <th>Value</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Number of TP Datatype Structure Type tables ex...</td>\n",
       "      <td>14.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Number of FP Datatype Structure Type tables ex...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Precision value of DataTypeStructure tables</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                           Parameter  Value\n",
       "0  Number of TP Datatype Structure Type tables ex...   14.0\n",
       "1  Number of FP Datatype Structure Type tables ex...    0.0\n",
       "2        Precision value of DataTypeStructure tables    1.0"
      ]
     },
     "execution_count": 85,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Dstreval = pd.DataFrame({'Parameter':['Number of TP Datatype Structure Type tables extracted',\n",
    "                                 'Number of FP Datatype Structure Type tables extracted','Precision value of DataTypeStructure tables'],\n",
    "                        'Value':[TP_dstr,FP_dstr,Precision_Dstr]})\n",
    "Dstreval"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 87,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "                                            DataType\n",
      "0  The ProcessingTimesDataTypeis composed of elem...\n",
      "1  The ProcessingTimesDataTypeis composed of elem...\n",
      "2  The ProcessingTimesDataTypeis composed of elem...\n",
      "3  The ProcessingTimesDataTypeis composed of elem...\n",
      "4  The ProcessingTimesDataTypeis composed of elem...\n"
     ]
    }
   ],
   "source": [
    "df_4 = pd.DataFrame(dt)\n",
    "print(df_4.head())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### Enumeration Type tables"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "- strings_enum, nonstring_enum - list type - variables with a list of strings that help to filter and extract enumeration tables from all the tables"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 88,
   "metadata": {},
   "outputs": [],
   "source": [
    "strings_enum = ['Enum','EnumType','EnumValue','Value','Enumeration','enumeration','Name','Index','EnumString','Required',\n",
    "                'Seq.number']\n",
    "nonstring_enum = [\"IsAbstract False True\",\"Symmetric\",\"InverseName\",\" HasComponent HasProperty Requires\",\n",
    "                  \"NodeClass Object Variable\",\"TypeDefinition\",\"ModellingRule MandatoryPlaceholder OptionalPlaceholder\",\n",
    "                  \"Details\",\"DisplayName\",\"OrganizedBy\",\"Organized by\",\"ValueRank\",\"Powerlink Attributes\",\n",
    "                  \"Access level\",\"InverseName\",\"Symmetric\", \"Subtype of HierarchialReferences defined\",\"Argument[]\",\n",
    "                  \"InputArguments\", \"OutputArguments\",\"Namespace\",\"ConformanceUnit\",\"Conformance Unit\",\n",
    "                  \"ToState\",\"FromState\",\"HasEffect\",\"Notes –  Notes referencing footnotes of the table content.\",\n",
    "                  \"NOTE  Notes referencing footnotes of the table content.\",\"SourceBrowsePath\",\"Source Path\",\n",
    "                  \"Structure\",\"O / M\",\"UNECE/ncode\",\"UnitId\",\"structure\",\"Namespace\", \"Use\",'NamespaceURI','property','Property',\n",
    "                  'DataType','MandatoryPlaceholder','ReadWrite','Mandatory','Optional','OptionalPlaceholder','Accesslevel',\n",
    "                  'ReadOnly','WriteOnly','ModellingRule','Other','Attribute','BrowseName','Method','Argument']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 89,
   "metadata": {},
   "outputs": [],
   "source": [
    "Et = {'EnumerationType': []}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 90,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:19:12.371182Z",
     "start_time": "2021-08-04T07:18:49.703320Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "EnumType allows only the following value_string combinations : FALSE_0,TRUE_1,DONTCARE_2. \n",
      "EnumType allows only the following value_string combinations : PRD_1,SBY_2,ENG_3,SDT_4,UDT_5,NST_6. \n"
     ]
    }
   ],
   "source": [
    "Count_enum1 = 0\n",
    "nCount_enum1 = 0\n",
    "for table_e1 in tables:\n",
    "                                                     # select only tables which contain at least one of the key word\n",
    "    if any(n in table_e1.df.to_string() for n in strings_enum):\n",
    "        \n",
    "        if not any(n in table_e1.df.to_string() for n in nonstring_enum):\n",
    "            \n",
    "            e1 = table_e1.df\n",
    "            try:\n",
    "                \n",
    "            \n",
    "                if len(e1.columns) == 2 and e1.iat[0,0] == \"Value\":\n",
    "                \n",
    "                    #print(table_e1.df, \"\\n----------------------------------------------------------------------\\n\")\n",
    "                    Count_enum1 = Count_enum1 + 1\n",
    "                    e_s1 = []\n",
    "                \n",
    "                    for ev1 in range(1,len(e1)):\n",
    "                    \n",
    "                        Value_str = e1.iat[ev1,0]\n",
    "                        #Desc = e1.iat[ev1,1]\n",
    "                        e_s1.append(Value_str)\n",
    "                        \n",
    "                            \n",
    "                    print(\"EnumType allows only the following value_string combinations : \"+ (','.join(str(x) for x in e_s1)) +\". \")\n",
    "                    Et['EnumerationType'].append(\"EnumType allows only the following value_string combinations : \"+ (','.join(str(x) for x in e_s1)) +\". \")\n",
    "                        \n",
    "            except:\n",
    "                if len(e1.columns) != 2:\n",
    "                    nCount_enum1 = nCount_enum1 + 1\n",
    "                    print(\"------------------------wrong extraction--------------------------\")\n",
    "                    pass"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 91,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:19:12.376900Z",
     "start_time": "2021-08-04T07:19:12.371182Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "2\n",
      "0\n"
     ]
    }
   ],
   "source": [
    "print(Count_enum1)\n",
    "print(nCount_enum1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 92,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:19:35.077189Z",
     "start_time": "2021-08-04T07:19:12.378899Z"
    }
   },
   "outputs": [],
   "source": [
    "Count_enum2 = 0\n",
    "nCount_enum2 = 0\n",
    "for table_e2 in tables:\n",
    "                                                     # select only tables which contain at least one of the key word\n",
    "    if any(n in table_e2.df.to_string() for n in strings_enum):\n",
    "        \n",
    "        if not any(n in table_e2.df.to_string() for n in nonstring_enum):\n",
    "            \n",
    "            e2 = table_e2.df\n",
    "            try:\n",
    "                \n",
    "                if len(e2.columns) == 2 and e2.iat[0,0] == \"Name\" and e2.iat[0,1] == \"Description\":\n",
    "                    \n",
    "                \n",
    "                    #print(table_e2.df, \"\\n----------------------------------------------------------------------\\n\")\n",
    "                    Count_enum2 = Count_enum2 + 1\n",
    "                    e_s2 = []\n",
    "                \n",
    "                    for ev2 in range(1,len(e2)):\n",
    "                \n",
    "                        Name = e2.iat[ev2,0]\n",
    "                        Desc = e2.iat[ev2,1]\n",
    "                        e_s2.append(Name)\n",
    "                        \n",
    "                            \n",
    "                    #print(\"EnumType allows only the following value_string/string_value combinations : \"+ (','.join(str(x) for x in e_s2)) +\". \")\n",
    "                    Et['EnumerationType'].append(\"EnumType allows only the following value_string/string_value combinations : \"+ (','.join(str(x) for x in e_s2)) +\". \")\n",
    "            except:\n",
    "                if len(e2.columns) != 2:\n",
    "                    nCount_enum2 = nCount_enum2 + 1\n",
    "                    print(\"--------------------------wrong extraction----------------------\")\n",
    "                    pass\n",
    "                          "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 93,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:19:35.084316Z",
     "start_time": "2021-08-04T07:19:35.079216Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0\n",
      "0\n"
     ]
    }
   ],
   "source": [
    "print(Count_enum2)\n",
    "print(nCount_enum2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 94,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:19:58.061030Z",
     "start_time": "2021-08-04T07:19:35.085835Z"
    }
   },
   "outputs": [],
   "source": [
    "Count_enum3 = 0\n",
    "nCount_enum3 = 0\n",
    "for table_e3 in tables:\n",
    "                                                     # select only tables which contain at least one of the key word\n",
    "    if any(n in table_e3.df.to_string() for n in strings_enum):\n",
    "        if not any(n in table_e3.df.to_string() for n in nonstring_enum):\n",
    "            \n",
    "            e3 = table_e3.df\n",
    "            try:\n",
    "                \n",
    "            \n",
    "                if (len(e3.columns) == 2 or len(e3.columns) == 3) and e3.iat[0,0] == \"Name\" and e3.iat[0,1] == \"Index\" and e3.iat[0,2] == \"Description\":\n",
    "                \n",
    "                    #print(table_e3.df, \"\\n----------------------------------------------------------------------\\n\")\n",
    "                    Count_enum3 = Count_enum3 + 1\n",
    "                    e_s3 = []\n",
    "                \n",
    "                    for ev3 in range(1,len(e3)):\n",
    "                        Name = e3.iat[ev3,0]\n",
    "                        Index = e3.iat[ev3,1]\n",
    "                        e_s3.append(Index + \"-\" + Name)\n",
    "                        \n",
    "                    #print(\"EnumType allows (only the following) value_string combinations : \" + (','.join(str(x) for x in e_s3)) + \".\")\n",
    "                    Et['EnumerationType'].append(\"EnumType allows (only the following) value_string combinations : \" + (','.join(str(x) for x in e_s3)) + \".\")\n",
    "            except:\n",
    "                if len(e3.columns) != 2:\n",
    "                    nCount_enum3 = nCount_enum3 + 1\n",
    "                    print(\"------------------------------wrong extraction---------------------------\")\n",
    "                    pass\n",
    "                    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 95,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:19:58.067254Z",
     "start_time": "2021-08-04T07:19:58.061030Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0\n",
      "0\n"
     ]
    }
   ],
   "source": [
    "print(Count_enum3)\n",
    "print(nCount_enum3)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 96,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:20:21.212246Z",
     "start_time": "2021-08-04T07:19:58.068252Z"
    }
   },
   "outputs": [],
   "source": [
    "Count_enum4 = 0\n",
    "nCount_enum4 = 0\n",
    "for table_e4 in tables:\n",
    "                                                     # select only tables which contain at least one of the key word\n",
    "    if any(n in table_e4.df.to_string() for n in strings_enum):\n",
    "        if not any(n in table_e4.df.to_string() for n in nonstring_enum):\n",
    "            \n",
    "            e4 = table_e4.df\n",
    "            try:\n",
    "                \n",
    "                if len(e4.columns)==3 and e4.iat[0,1] == \"EnumString\" and e4.iat[0,2] == \"Description\":\n",
    "                    \n",
    "                    \n",
    "                \n",
    "                    #print(table_e4.df, \"\\n----------------------------------------------------------------------\\n\")\n",
    "                    Count_enum4 = Count_enum4 + 1\n",
    "                    e_s4 = []\n",
    "                \n",
    "                    for ev4 in range(1,len(e4)):\n",
    "                    \n",
    "                        str_val = e4.iat[ev4,1]\n",
    "                        Desc = e4.iat[ev4,2]\n",
    "                        e_s4.append(str_val)\n",
    "                        \n",
    "                            \n",
    "                    #print(\"EnumType allows (only the following) string_value combinations : \"+ (','.join(str(x) for x in e_s4)) +\". \")\n",
    "                    Et['EnumerationType'].append(\"EnumType allows (only the following) string_value combinations : \"+ (','.join(str(x) for x in e_s4)) +\". \")\n",
    "            except:\n",
    "                if len(e4.columns) !=3 and e4.iat[0,0] != \"Seq.number\" and e4.iat[0,1] != \"EnumString\":\n",
    "                    \n",
    "                    nCount_enum4 = nCount_enum4 + 1\n",
    "            \n",
    "                    print(\"-------------------------wrong extraction-----------------------\")\n",
    "                    pass"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 97,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:20:21.219366Z",
     "start_time": "2021-08-04T07:20:21.214306Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0\n",
      "0\n"
     ]
    }
   ],
   "source": [
    "print(Count_enum4)\n",
    "print(nCount_enum4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 98,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:20:44.023526Z",
     "start_time": "2021-08-04T07:20:21.221368Z"
    }
   },
   "outputs": [],
   "source": [
    "Count_enum5 = 0\n",
    "nCount_enum5 = 0\n",
    "\n",
    "for table_e5 in tables:\n",
    "    \n",
    "    if any(n in table_e5.df.to_string() for n in strings_enum):\n",
    "        if not any(n in table_e5.df.to_string() for n in nonstring_enum):\n",
    "            \n",
    "            \n",
    "            \n",
    "            e5 = table_e5.df\n",
    "            \n",
    "            try:\n",
    "                if len(e5.columns) == 3 and (e5.iat[0,0] == \"Name\" or e5.iat[0,0] == \"EnumString\") and e5.iat[0,1] == \"Value\" and e5.iat[0,2] == \"Description\":\n",
    "                    \n",
    "                    \n",
    "                    \n",
    "                    #print(table_e5.df, \"\\n----------------------------------------------------------------------\\n\")\n",
    "                    Count_enum5 = Count_enum5 + 1\n",
    "                    e_s5 = []\n",
    "                    for ev5 in range(0,len(e5)):\n",
    "                        \n",
    "                    #EnumType = e.iat[4,2]\n",
    "                        Name = e5.iat[ev5,0]\n",
    "                        Value = e5.iat[ev5,1]\n",
    "                        #Value_str = e1.iat[a1,0]\n",
    "                        Desc = e5.iat[ev5,2]\n",
    "                        e_s5.append(Value +\"_(\"+ Name +\")\")\n",
    "                        \n",
    "                    #print(\"EnumType allows (only the following) value_string combinations : \"+ (','.join(str(x) for x in e_s5)) + \".\")\n",
    "                    Et['EnumerationType'].append(\"EnumType allows (only the following) value_string combinations : \"+ (','.join(str(x) for x in e_s5)) + \".\")\n",
    "            except:\n",
    "                \n",
    "                #if len(e5.columns) != 3:\n",
    "                    \n",
    "                #if e5.iat[0,0].lower().strip() == \"name\" and e5.iat[0,1].lower().strip() == \"type\" and e5.iat[1,1].lower().strip() == \"structure\":\n",
    "                \n",
    "                nCount_enum5 = nCount_enum5 + 1\n",
    "                print(\"------------------------wrong extraction----------------------\")\n",
    "                pass\n",
    "            \n",
    "         \n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 99,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:20:44.029396Z",
     "start_time": "2021-08-04T07:20:44.023526Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0\n",
      "0\n"
     ]
    }
   ],
   "source": [
    "print(Count_enum5)\n",
    "print(nCount_enum5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 100,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:20:44.037363Z",
     "start_time": "2021-08-04T07:20:44.030359Z"
    }
   },
   "outputs": [],
   "source": [
    "Count_enum6 = 0                       #e6.iat[2,1] == \"Value\" or e6.iat[1,1] == \"Value\"\n",
    "nCount_enum6 = 0\n",
    "key_words_e = [\"EnumString\"] # special type of enum table seen in Roboitcs\n",
    "\n",
    "n= 1\n",
    "for table_e in tables:\n",
    "                                                     # select only tables which contain at least one of the key word\n",
    "    if any(n in table_e.df.to_string() for n in key_words_e):\n",
    "        #if not any(n in table_ns.df.to_string() for n in not_keywords_e):\n",
    "            e = table_e.df\n",
    "            \n",
    "        \n",
    "            print(table_e.df, \"\\n----------------------------------------------------------------------\\n\")\n",
    "            Count_enum6 = Count_enum6 + 1\n",
    "            n = n+ 1\n",
    "            \n",
    "            # When this <EnumType> is used in an array representing human-readable representations of an <EnumString>, \n",
    "            # each <EnumValue> shall be unique in that array.\n",
    "           # When it is used to define the <EnumString> representation of an <EnumType>, \n",
    "           # the <EnumValue> range is limited to Int32, because the <EnumType> is subtype of Int32.\n",
    "            e_s6 = []\n",
    "           \n",
    "            for a in range(2,len(e)):\n",
    "                \n",
    "                EnumType = e.iat[0,0] or e.iat[0,1]\n",
    "                EnumString = e.iat[a,0]\n",
    "                EnumValue = e.iat[a,1]\n",
    "                e_s6.append(EnumString+\"_\"+EnumValue)\n",
    "                #e_val.append(EnumValue)\n",
    "                \n",
    "            #print(e_s6)\n",
    "            print(EnumType +\" Enumtype\"+\" allows only the following string_value combinations : \"+ (','.join(str(x) for x in e_s6))+\".\")     \n",
    "            Et['EnumerationType'].append(EnumType +\" Enumtype\"+\" allows only the following string_value combinations : \" + (','.join(str(x) for x in e_s6)) + \".\") \n",
    "                \n",
    "              "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 101,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0\n",
      "0\n"
     ]
    }
   ],
   "source": [
    "print(Count_enum6)\n",
    "print(nCount_enum6)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 102,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:21:07.293487Z",
     "start_time": "2021-08-04T07:20:44.062362Z"
    }
   },
   "outputs": [],
   "source": [
    "Count_enum7 = 0\n",
    "nCount_enum7 = 0\n",
    "for table_e7 in tables:\n",
    "                                                     \n",
    "    if any(n in table_e7.df.to_string() for n in strings_enum):\n",
    "        if not any(n in table_e7.df.to_string() for n in nonstring_enum):\n",
    "            \n",
    "            e7 = table_e7.df\n",
    "            try:\n",
    "                \n",
    "                if len(e7.columns) == 3 and e7.iat[0,0] == \"Seq./nnumber\" and e7.iat[0,1] == \"EnumString\" and e7.iat[0,2] == \"Description\":\n",
    "                    \n",
    "                \n",
    "                    #print(table_e7.df, \"\\n----------------------------------------------------------------------\\n\")\n",
    "                    Count_enum7 = Count_enum7 + 1\n",
    "                    e_s7 = []\n",
    "                \n",
    "                    for ev7 in range(1,len(e7)):\n",
    "                    \n",
    "                        str_val = e7.iat[ev7,1]\n",
    "                        Desc = e7.iat[ev7,2]\n",
    "                        e_s7.append(str_val)\n",
    "                        \n",
    "                            \n",
    "                    #print(\"EnumType allows only the following string_value combinations : \"+ (','.join(str(x) for x in e_s7)) +\".\")\n",
    "                    Et['EnumerationType'].append(\"EnumType allows only the following string_value combinations : \"+ (','.join(str(x) for x in e_s7)) +\".\")\n",
    "            except:\n",
    "                if len(e7.columns) != 3 and e7.iat[0,0] != \"Seq./nnumber\" and e7.iat[0,1] != \"EnumString\":\n",
    "                    \n",
    "                    nCount_enum7 = nCount_enum7 + 1\n",
    "            \n",
    "                    print(\"--------------------wrong extraction---------------------\")\n",
    "                    pass"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 103,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:21:07.300943Z",
     "start_time": "2021-08-04T07:21:07.293487Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0\n",
      "0\n"
     ]
    }
   ],
   "source": [
    "print(Count_enum7)\n",
    "print(nCount_enum7)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 104,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:21:30.100617Z",
     "start_time": "2021-08-04T07:21:07.302940Z"
    }
   },
   "outputs": [],
   "source": [
    "Count_enum8 = 0\n",
    "nCount_enum8 = 0\n",
    "\n",
    "for table_e8 in tables:\n",
    "    \n",
    "    if any(n in table_e8.df.to_string() for n in strings_enum):\n",
    "        if not any(n in table_e8.df.to_string() for n in nonstring_enum):\n",
    "            \n",
    "            \n",
    "            e8 = table_e8.df\n",
    "            \n",
    "            try:\n",
    "                if len(e8.columns) == 2 and e8.iat[0,0] == \"Name\" and e8.iat[0,1] == \"Value\" :\n",
    "                    \n",
    "                    \n",
    "                    \n",
    "                    #print(table_e8.df, \"\\n----------------------------------------------------------------------\\n\")\n",
    "                    Count_enum8 = Count_enum8 + 1\n",
    "                    e_s8 = []\n",
    "                    \n",
    "                    for ev8 in range(1,len(e8)):\n",
    "                        \n",
    "                    #EnumType = e.iat[4,2]\n",
    "                        Name = e8.iat[ev8,0]\n",
    "                        Value = e8.iat[ev8,1]\n",
    "                        e_s8.append(Name +\"_(\"+ Value +\")\")\n",
    "                        #Value_str = e1.iat[a1,0]\n",
    "                        #Desc = e5.iat[ev5,2]\n",
    "                        \n",
    "                    #print(\"6. Enumeration Constraint : To this EnumType has only a particular corresponding string_value pair : \"+ Name +\"_(\"+ Value +\"), to it. \")\n",
    "                    Et['EnumerationType'].append(\"EnumType allows only the following string_value combinations : \"+ (','.join(str(x) for x in e_s8)) + \".\")\n",
    "            except:\n",
    "                if len(e8.columns) != 2:\n",
    "                    nCount_enum8 = nCount_enum8 + 1\n",
    "                    print(\"------------------------wrong extraction----------------------\")\n",
    "                    pass\n",
    "            \n",
    "         "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 105,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:21:30.107451Z",
     "start_time": "2021-08-04T07:21:30.102665Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0\n",
      "0\n"
     ]
    }
   ],
   "source": [
    "print(Count_enum8)\n",
    "print(nCount_enum8)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 109,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:21:30.118389Z",
     "start_time": "2021-08-04T07:21:30.108620Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "TP of Enumeration tables with constraints extracted :  2\n",
      "FP of Enumeration tables without constraints and wrongly extracted 0\n"
     ]
    }
   ],
   "source": [
    "Count_enum = (Count_enum1 + Count_enum2 + Count_enum3 + Count_enum4 + Count_enum5 + Count_enum6 + Count_enum7+ Count_enum8)# + n )\n",
    "nCount_enum = (nCount_enum1 + nCount_enum2 + nCount_enum3 + nCount_enum4 + nCount_enum5 + nCount_enum6 + nCount_enum7 + nCount_enum8 )\n",
    "print(\"TP of Enumeration tables with constraints extracted : \",Count_enum)\n",
    "print(\"FP of Enumeration tables without constraints and wrongly extracted\", nCount_enum)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 110,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:27:04.741746Z",
     "start_time": "2021-08-04T07:27:04.733743Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1.0\n"
     ]
    }
   ],
   "source": [
    "if (Count_enum + nCount_enum) == 0:\n",
    "    Precision_Enum = 'doesnotexist'\n",
    "else:\n",
    "    Precision_Enum = Count_enum /(Count_enum + nCount_enum)\n",
    "print(Precision_Enum)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 111,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:27:05.610709Z",
     "start_time": "2021-08-04T07:27:05.597715Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Parameter</th>\n",
       "      <th>Value</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>TP of Enumeration tables with constraints extr...</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>FP of Enumeration tables without constraints a...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Precision of Enumeration Type tables</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                           Parameter  Value\n",
       "0  TP of Enumeration tables with constraints extr...    2.0\n",
       "1  FP of Enumeration tables without constraints a...    0.0\n",
       "2               Precision of Enumeration Type tables    1.0"
      ]
     },
     "execution_count": 111,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Enumeval = pd.DataFrame({'Parameter':['TP of Enumeration tables with constraints extracted',\n",
    "                                     'FP of Enumeration tables without constraints and wrongly extracted','Precision of Enumeration Type tables'],\n",
    "                        'Value':[Count_enum,nCount_enum,Precision_Enum]})\n",
    "Enumeval"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 112,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "                                     EnumerationType\n",
      "0  EnumType allows only the following value_strin...\n",
      "1  EnumType allows only the following value_strin...\n"
     ]
    }
   ],
   "source": [
    "df_5 = pd.DataFrame(Et)\n",
    "print(df_5.head())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### Method Result Code Type tables"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "- mrc - list type - variables with a list of strings that help to filter and extract method resultcode tables from all the 'tables'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 113,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:30:33.944505Z",
     "start_time": "2021-08-04T07:30:33.941544Z"
    }
   },
   "outputs": [],
   "source": [
    "mrc = [\"Result Code\",\"ResultCode\",\"Result code\",\"Symbolic Id\"]\n",
    "#notmrc = [\"Argument[]\"] "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 114,
   "metadata": {},
   "outputs": [],
   "source": [
    "Mr = {'MethodResult':[]}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 115,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:30:36.459151Z",
     "start_time": "2021-08-04T07:30:35.352027Z"
    }
   },
   "outputs": [],
   "source": [
    "count_mrc = 0\n",
    "ncount_mrc = 0\n",
    "for table_mrc in tables:\n",
    "    if any(n in table_mrc.df.to_string() for n in mrc):\n",
    "        #if not any(n in table_mp.df.to_string() for n in notmrc):\n",
    "            mrc0 = table_mrc.df\n",
    "            \n",
    "            try:\n",
    "                \n",
    "                #if mrc0.iat[0,0].lower().strip() == \"resultcode\":\n",
    "                    \n",
    "                if len(mrc0.columns) == 2:\n",
    "                    print(table_mrc.df, \"\\n----------------------------------------------------------------------\\n\")\n",
    "                    count_mrc = count_mrc + 1\n",
    "                    mrc_1 = []\n",
    "                    for mr in range(1,len(mrc0)):\n",
    "                        Result_code = mrc0.iat[mr,0]\n",
    "                        Desc = mrc0.iat[mr,1]\n",
    "                        mrc_1.append(Result_code)\n",
    "                \n",
    "                        #if Result_code:\n",
    "                        \n",
    "                    print(\"The Method must provide the following result codes only - \"+ (','.join(str(x) for x in mrc_1)) + \".\")\n",
    "                    Mr['MethodResult'].append(\"The Method must provide the following result codes only - \"+ (','.join(str(x) for x in mrc_1)) + \".\")\n",
    "                        #else:\n",
    "                            #print(\"No more Result codes are present and desribed in this Method\")\n",
    "                            #Mr['MethodResult'].append(\" \")\n",
    "                            \n",
    "            except:\n",
    "                if len(mrc0.columns) != 2:\n",
    "                    ncount_mrc = ncount_mrc + 1\n",
    "                \n",
    "                    print(\"----------------------------wrong extraction------------------------------\")\n",
    "                    pass"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 116,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:30:37.784208Z",
     "start_time": "2021-08-04T07:30:36.461150Z"
    }
   },
   "outputs": [],
   "source": [
    "count1_mrc = 0\n",
    "ncount1_mrc = 0\n",
    "for table_mrc1 in tables:\n",
    "    if any(n in table_mrc1.df.to_string() for n in mrc):\n",
    "        #if not any(n in table_mp.df.to_string() for n in notmrc):\n",
    "            mrc1 = table_mrc1.df\n",
    "            try:\n",
    "                if len(mrc1.columns) == 3 and mrc1.iat[0,0].lower().strip() == \"resultcode\":\n",
    "                    count1_mrc = count1_mrc + 1\n",
    "                    mrc_2 = []\n",
    "                    for mr1 in range(1,len(mrc1)):\n",
    "                        Result_code = mrc1.iat[mr1,0]\n",
    "                \n",
    "                        Desc = mrc1.iat[mr1,2]\n",
    "                        mrc_2.append(Result_code)\n",
    "                        \n",
    "                \n",
    "                        #if Result_code:\n",
    "                        \n",
    "                    print(\"The Method must provide the following result codes only - \"+ (','.join(str(x) for x in mrc_2)) + \".\")\n",
    "                    Mr['MethodResult'].append(\"The Method must provide the following result codes only - \"+ (','.join(str(x) for x in mrc_2)) + \".\")\n",
    "                        #else:\n",
    "                            #print(\"No more Result codes are present and desribed in this Method\")\n",
    "                            #Mr['MethodResult'].append(\" \")\n",
    "                            \n",
    "            except:\n",
    "                if len(mrc1.columns) != 3:\n",
    "                    ncount1_mrc = ncount1_mrc + 1\n",
    "                \n",
    "                    print(\"-----------------------wrong extraction------------------------\")\n",
    "                    pass"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 118,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:30:37.790932Z",
     "start_time": "2021-08-04T07:30:37.786239Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "TP Number of MethodResultcode tables extracted with constraints 0\n",
      "FP Number of MethodResultcode tables wrongly extracted without constraints 0\n"
     ]
    }
   ],
   "source": [
    "print(\"TP Number of MethodResultcode tables extracted with constraints\",(count_mrc + count1_mrc))\n",
    "print(\"FP Number of MethodResultcode tables wrongly extracted without constraints\",(ncount_mrc + ncount1_mrc))\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 119,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:30:37.799933Z",
     "start_time": "2021-08-04T07:30:37.793928Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "doesnotexist\n"
     ]
    }
   ],
   "source": [
    "TP_mrc = (count_mrc + count1_mrc)\n",
    "FP_mrc = (ncount_mrc + ncount1_mrc)\n",
    "if (FP_mrc + TP_mrc) == 0:\n",
    "    Precision_MRC = 'doesnotexist'\n",
    "else:\n",
    "    Precision_MRC = TP_mrc /(TP_mrc + FP_mrc)\n",
    "print(Precision_MRC)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 120,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:30:37.813935Z",
     "start_time": "2021-08-04T07:30:37.801927Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Parameter</th>\n",
       "      <th>Value</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>TP Number of MethodResultcode tables extracted...</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>FP Number of MethodResultcode tables wrongly e...</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Precision value of Method resultcode type tabl...</td>\n",
       "      <td>doesnotexist</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                           Parameter         Value\n",
       "0  TP Number of MethodResultcode tables extracted...             0\n",
       "1  FP Number of MethodResultcode tables wrongly e...             0\n",
       "2  Precision value of Method resultcode type tabl...  doesnotexist"
      ]
     },
     "execution_count": 120,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "MRCeval = pd.DataFrame({'Parameter':['TP Number of MethodResultcode tables extracted with constraints',\n",
    "                                    'FP Number of MethodResultcode tables wrongly extracted without constraints',\n",
    "                                    'Precision value of Method resultcode type tables extracted'],\n",
    "                       'Value':[TP_mrc,FP_mrc,Precision_MRC]})\n",
    "MRCeval"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 121,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Empty DataFrame\n",
      "Columns: [MethodResult]\n",
      "Index: []\n"
     ]
    }
   ],
   "source": [
    "df_6 = pd.DataFrame(Mr)\n",
    "print(df_6.head())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### Method Parameter Type"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "- mp, notmp - list type - variables with a list of strings that help to filter and extract method parameter tables from all the 'tables'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 122,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:30:37.829939Z",
     "start_time": "2021-08-04T07:30:37.824928Z"
    }
   },
   "outputs": [],
   "source": [
    "#Keywords for Method Parameter Type Tables\n",
    "\n",
    "mp = [\"Argument\"]\n",
    "notmp = [\"Argument[]\",\"Result Code\",\"ResultCode\",\"Parameter Type\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 123,
   "metadata": {},
   "outputs": [],
   "source": [
    "Mpt = {'MethodParameterType':[]}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 124,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:31:33.800067Z",
     "start_time": "2021-08-04T07:31:33.744111Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The method must take the following input arguments externalId,internalId,configuration,transferRequired,error.\n",
      "The method must take the following input arguments internalId,Timeout,configurationHandle,configuration,error.\n",
      "The method must take the following input arguments maxResults,startIndex,timeout,isComplete,resultCount,configurationHandle,configurationList,error.\n",
      "The method must take the following input arguments configurationHandle,error.\n",
      "The method must take the following input arguments internalId,error.\n",
      "The method must take the following input arguments internalId,error.\n",
      "The method must take the following input arguments generateOptions,fileNodeId,fileHandle,completionStateMachine.\n",
      "The method must take the following input arguments generateOptions,fileNodeId,fileHandle.\n",
      "The method must take the following input arguments externalId,productId,internalId,recipe,product,transferRequired,error.\n",
      "The method must take the following input arguments externalId,internalIdIn,internalIdOut,isCompleted,Error.\n",
      "The method must take the following input arguments externalId,internalIdIn,internalIdOut,error.\n",
      "The method must take the following input arguments externalId,productId,isPrepared,maxResults,startIndex,Timeout,isComplete,resultCount,recipeHandle,recipeList,error.\n",
      "The method must take the following input arguments recipeHandle,error.\n",
      "The method must take the following input arguments externalId,error.\n",
      "The method must take the following input arguments productId,internalId,error.\n",
      "The method must take the following input arguments productId,internalId,error.\n",
      "The method must take the following input arguments internalId,productId,error.\n",
      "The method must take the following input arguments generateOptions,fileNodeId,fileHandle,completionStateMachine.\n",
      "The method must take the following input arguments generateOptions,fileNodeId,fileHandle.\n",
      "The method must take the following input arguments productId,error.\n",
      "The method must take the following input arguments productId,error.\n",
      "The method must take the following input arguments isCompleted,error.\n",
      "The method must take the following input arguments error.\n",
      "The method must take the following input arguments resultId,timeout,resultHandle,result,error.\n",
      "The method must take the following input arguments resultId,timeout,hasTransferableDataOnFile,resultHandle,isPartial,isSimulated,resultState,measId,partId,externalRecipeId,internalRecipeId,productId,externalConfigurationId,InternalConfigurationId,jobId.\n",
      "The method must take the following input arguments ,creationTime,processingTimes,resultContent,error.\n",
      "The method must take the following input arguments resultState,measId,partId,externalRecipeId,internalRecipeId,externalConfigurationId,internalConfigurationId,productId,jobId,maxResults,startIndex,timeout,isComplete,resultCount,resultHandle,resultList,error.\n",
      "The method must take the following input arguments resultHandle,Error.\n",
      "The method must take the following input arguments generateOptions,fileNodeId,fileHandle,completionStateMachine.\n",
      "The method must take the following input arguments safetyTriggered,safetyInformation,Error.\n",
      "The method must take the following input arguments cause,causeDescription,error.\n",
      "The method must take the following input arguments cause,causeDescription,error.\n",
      "The method must take the following input arguments error.\n",
      "The method must take the following input arguments Comment.\n",
      "The method must take the following input arguments measId,partId,recipeId,productId,parameters,jobId,error.\n",
      "The method must take the following input arguments cause,causeDescription,error.\n",
      "The method must take the following input arguments cause,causeDescription,error.\n",
      "The method must take the following input arguments activate,cause,causeDescription,error.\n",
      "The method must take the following input arguments cause,causeDescription,error.\n"
     ]
    }
   ],
   "source": [
    "count_mp = 0\n",
    "ncount_mp = 0\n",
    "for table_mp in tables:\n",
    "                                                     # select only tables which contain at least one of the key word\n",
    "    if any(n in table_mp.df.to_string() for n in mp):\n",
    "        if not any(n in table_mp.df.to_string() for n in notmp):\n",
    "            #print(table_mp.df, \"\\n----------------------------------------------------------------------\\n\")\n",
    "            mpp = table_mp.df\n",
    "            \n",
    "            try:\n",
    "                #Method name can only be taken from the title of the table\n",
    "                if len(mpp.columns) == 2 and (mpp.iat[0,0] == \"Argument\" or mpp.iat[0,0] == \"Command Argument\") and mpp.iat[0,1] == \"Description\":\n",
    "                    #print(table_mp.df, \"\\n----------------------------------------------------------------------\\n\")\n",
    "                    count_mp = count_mp + 1\n",
    "                    mp_1 = []\n",
    "                    \n",
    "                    for a in range(1,len(mpp)):\n",
    "                        \n",
    "                        Arg = mpp.iat[a,0]\n",
    "                        Desc = mpp.iat[a,1]\n",
    "                        \n",
    "                        mp_1.append(re.sub(\"\\n\", \"\", Arg))\n",
    "                        #print(Arg)\n",
    "                        #if Arg:\n",
    "                    print(\"The method must take the following input arguments \"+ (','.join(str(x) for x in mp_1)) + \".\")\n",
    "                    Mpt['MethodParameterType'].append(\"The method must take the following input arguments \"+ (','.join(str(x) for x in mp_1)) + \".\")\n",
    "                        #else:\n",
    "                            #print(\"No more Arguments are present and desribed in this Method\")\n",
    "                            #Mpt['MethodParameterType'].append(\" \")\n",
    "            except:\n",
    "                if len(mpp.columns) != 2:\n",
    "                    ncount_mp = ncount_mp + 1\n",
    "                    print(\"--------------------wrong extraction-----------------\")\n",
    "                    pass"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 126,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:31:37.708477Z",
     "start_time": "2021-08-04T07:31:37.697484Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "TP Value of Method Paramter Type tables extracted  39\n",
      "FN Value of Method Paramter Type tables extracted  0\n",
      "1.0\n"
     ]
    }
   ],
   "source": [
    "print(\"TP Value of Method Paramter Type tables extracted \",count_mp)\n",
    "print(\"FN Value of Method Paramter Type tables extracted \",ncount_mp)\n",
    "if (count_mp + ncount_mp) == 0 :\n",
    "    Recall_MP = 'doesnotexist'\n",
    "\n",
    "else:\n",
    "    Recall_MP = count_mp /(count_mp + ncount_mp)\n",
    "print(Recall_MP)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 128,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:31:38.746999Z",
     "start_time": "2021-08-04T07:31:38.736967Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Parameter</th>\n",
       "      <th>Value</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>TP Value of Method Paramter Type tables extracted</td>\n",
       "      <td>39.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>FP Value of Method Paramter Type tables extracted</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Recall Value of Method Parameter Type tables</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                           Parameter  Value\n",
       "0  TP Value of Method Paramter Type tables extracted   39.0\n",
       "1  FP Value of Method Paramter Type tables extracted    0.0\n",
       "2       Recall Value of Method Parameter Type tables    1.0"
      ]
     },
     "execution_count": 128,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "MPeval = pd.DataFrame({'Parameter':['TP Value of Method Paramter Type tables extracted',\n",
    "                                   'FP Value of Method Paramter Type tables extracted','Recall Value of Method Parameter Type tables'],\n",
    "                      'Value':[count_mp,ncount_mp,Recall_MP]})\n",
    "MPeval"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 129,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:31:41.921818Z",
     "start_time": "2021-08-04T07:31:41.915766Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "                                 MethodParameterType\n",
      "0  The method must take the following input argum...\n",
      "1  The method must take the following input argum...\n",
      "2  The method must take the following input argum...\n",
      "3  The method must take the following input argum...\n",
      "4  The method must take the following input argum...\n"
     ]
    }
   ],
   "source": [
    "df_7 = pd.DataFrame(Mpt)\n",
    "print(df_7.head())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### Transition Type tables"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 138,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:31:42.993581Z",
     "start_time": "2021-08-04T07:31:42.987539Z"
    }
   },
   "outputs": [],
   "source": [
    "# All TransitionType Tables\n",
    "\n",
    "#The <HasCause> method will cause a <transition name> transition from <FromState> to <ToState>\n",
    "#The <transition name> is a transition from <FromState> to <ToState>. \n",
    "\n",
    "transition = [ \"ToState\",\"FromState\",\"HasEffect\"]\n",
    "not_keywords_trans = [\"IsAbstract\",\"False\", \"True\",\"Symmetric\",\"InverseName\",\"HasComponent\",\"HasProperty\",\"Requires\",\n",
    "                      \"NodeClass\",\"Object\",\"Variable\",\"TypeDefinition\",\"ModellingRule\",\"MandatoryPlaceholder\",\n",
    "                      \"OptionalPlaceholder\"]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "- tran - int type - variable that helps to count the number of extracted transition state type tables from actual 'tables', It always gets autoincremented by 1 whenever there is a new transition table extraction and finally gives the count\n",
    "- working logic is same as the previous table types"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 139,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:31:44.493511Z",
     "start_time": "2021-08-04T07:31:43.742172Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "                                  0            1  \\\n",
      "0                        BrowseName   References   \n",
      "1            PreoperationalToHalted  HasProperty   \n",
      "2                                      FromState   \n",
      "3                                        ToState   \n",
      "4                                       HasCause   \n",
      "5                                      HasEffect   \n",
      "6        PreoperationalToHaltedAuto  HasProperty   \n",
      "7                                      FromState   \n",
      "8                                        ToState   \n",
      "9                                      HasEffect   \n",
      "10        PreoperationalToErrorAuto  HasProperty   \n",
      "11                                     FromState   \n",
      "12                                       ToState   \n",
      "13                                     HasEffect   \n",
      "14                                     HasEffect   \n",
      "15      PreoperationalToOperational  HasProperty   \n",
      "16                                     FromState   \n",
      "17                                       ToState   \n",
      "18                                      HasCause   \n",
      "19                                     HasEffect   \n",
      "20  PreoperationalToOperationalAuto  HasProperty   \n",
      "21                                     FromState   \n",
      "22                                       ToState   \n",
      "23                                     HasEffect   \n",
      "24      PreoperationalToInitialized  HasProperty   \n",
      "25                                     FromState   \n",
      "26                                       ToState   \n",
      "27                                      HasCause   \n",
      "28                                     HasEffect   \n",
      "29  PreoperationalToInitializedAuto  HasProperty   \n",
      "30                                     FromState   \n",
      "31                                       ToState   \n",
      "32                                     HasEffect   \n",
      "33           HaltedToPreoperational  HasProperty   \n",
      "34                                     FromState   \n",
      "35                                       ToState   \n",
      "36                                      HasCause   \n",
      "37                                     HasEffect   \n",
      "38       HaltedToPreoperationalAuto  HasProperty   \n",
      "39                                     FromState   \n",
      "40                                       ToState   \n",
      "\n",
      "                                        2      3                      4      5  \n",
      "0                       Target BrowseName  Value  Target TypeDefinition  Notes  \n",
      "1                        TransitionNumber    121           PropertyType     --  \n",
      "2                          Preoperational                     StateType     --  \n",
      "3                                  Halted                     StateType     --  \n",
      "4                                    Halt                        Method     --  \n",
      "5                   StateChangedEventType                                   --  \n",
      "6                        TransitionNumber    120           PropertyType     --  \n",
      "7                          Preoperational                     StateType     --  \n",
      "8                                  Halted                     StateType     --  \n",
      "9                   StateChangedEventType                                   --  \n",
      "10                       TransitionNumber    130           PropertyType     --  \n",
      "11                         Preoperational                     StateType     --  \n",
      "12                                  Error                     StateType     --  \n",
      "13                  StateChangedEventType                                   --  \n",
      "14                         ErrorEventType                                   --  \n",
      "15                       TransitionNumber    141           PropertyType     --  \n",
      "16                         Preoperational                     StateType     --  \n",
      "17                            Operational                     StateType     --  \n",
      "18                    SelectModeAutomatic                        Method     --  \n",
      "19                  StateChangedEventType                                   --  \n",
      "20                       TransitionNumber    140           PropertyType     --  \n",
      "21                         Preoperational                     StateType     --  \n",
      "22                            Operational                     StateType     --  \n",
      "23                  StateChangedEventType                                   --  \n",
      "24                       TransitionNumber    151           PropertyType     --  \n",
      "25                         Preoperational                     StateType     --  \n",
      "26  AutomaticModeStateMachine.Initialized                     StateType     --  \n",
      "27                    SelectModeAutomatic                        Method     --  \n",
      "28                  StateChangedEventType                                   --  \n",
      "29                       TransitionNumber    150           PropertyType     --  \n",
      "30                         Preoperational                     StateType     --  \n",
      "31  AutomaticModeStateMachine.Initialized                     StateType     --  \n",
      "32                  StateChangedEventType                                   --  \n",
      "33                       TransitionNumber    211           PropertyType     --  \n",
      "34                                 Halted                     StateType     --  \n",
      "35                         Preoperational                     StateType     --  \n",
      "36                                  Reset                        Method     --  \n",
      "37                  StateChangedEventType                                   --  \n",
      "38                       TransitionNumber    210           PropertyType     --  \n",
      "39                                 Halted                     StateType     --  \n",
      "40                         Preoperational                     StateType     --   \n",
      "-----------------------------------------------------------------------------\n",
      "\n",
      "                                  0            1                       2  \\\n",
      "0                        BrowseName   References       Target BrowseName   \n",
      "1                                      HasEffect   StateChangedEventType   \n",
      "2             ErrorToPreoperational  HasProperty        TransitionNumber   \n",
      "3                                      FromState                   Error   \n",
      "4                                        ToState          Preoperational   \n",
      "5                                       HasCause                   Reset   \n",
      "6                                      HasEffect   StateChangedEventType   \n",
      "7         ErrorToPreoperationalAuto  HasProperty        TransitionNumber   \n",
      "8                                      FromState                   Error   \n",
      "9                                        ToState          Preoperational   \n",
      "10                                     HasEffect   StateChangedEventType   \n",
      "11                    ErrorToHalted  HasProperty        TransitionNumber   \n",
      "12                                     FromState                   Error   \n",
      "13                                       ToState                  Halted   \n",
      "14                                      HasCause                    Halt   \n",
      "15                                     HasEffect   StateChangedEventType   \n",
      "16                ErrorToHaltedAuto  HasProperty        TransitionNumber   \n",
      "17                                     FromState                   Error   \n",
      "18                                       ToState                  Halted   \n",
      "19                                     HasEffect   StateChangedEventType   \n",
      "20           ErrorToOperationalAuto  HasProperty        TransitionNumber   \n",
      "21                                     FromState                   Error   \n",
      "22                                       ToState             Operational   \n",
      "23                                     HasEffect   StateChangedEventType   \n",
      "24                                     HasEffect  ErrorResolvedEventType   \n",
      "25      OperationalToPreoperational  HasProperty        TransitionNumber   \n",
      "26                                     FromState             Operational   \n",
      "27                                       ToState          Preoperational   \n",
      "28                                      HasCause                   Reset   \n",
      "29                                     HasEffect   StateChangedEventType   \n",
      "30  OperationalToPreoperationalAuto  HasProperty        TransitionNumber   \n",
      "31                                     FromState             Operational   \n",
      "32                                       ToState          Preoperational   \n",
      "33                                     HasEffect   StateChangedEventType   \n",
      "34              OperationalToHalted  HasProperty        TransitionNumber   \n",
      "35                                     FromState             Operational   \n",
      "36                                       ToState                  Halted   \n",
      "37                                      HasCause                    Halt   \n",
      "38                                     HasEffect   StateChangedEventType   \n",
      "39          OperationalToHaltedAuto  HasProperty        TransitionNumber   \n",
      "40                                     FromState             Operational   \n",
      "41                                       ToState                  Halted   \n",
      "\n",
      "        3                      4      5  \n",
      "0   Value  Target TypeDefinition  Notes  \n",
      "1                                    --  \n",
      "2     311           PropertyType     --  \n",
      "3                      StateType     --  \n",
      "4                      StateType     --  \n",
      "5                         Method     --  \n",
      "6                                    --  \n",
      "7     310           PropertyType     --  \n",
      "8                      StateType     --  \n",
      "9                      StateType     --  \n",
      "10                                       \n",
      "11    321           PropertyType     --  \n",
      "12                     StateType     --  \n",
      "13                     StateType     --  \n",
      "14                        Method     --  \n",
      "15                                   --  \n",
      "16    320           PropertyType     --  \n",
      "17                     StateType     --  \n",
      "18                     StateType     --  \n",
      "19                                   --  \n",
      "20    340           PropertyType     --  \n",
      "21                     StateType     --  \n",
      "22                     StateType     --  \n",
      "23                                   --  \n",
      "24                                   --  \n",
      "25    411           PropertyType     --  \n",
      "26                     StateType     --  \n",
      "27                     StateType     --  \n",
      "28                        Method     --  \n",
      "29                                   --  \n",
      "30    410           PropertyType     --  \n",
      "31                     StateType     --  \n",
      "32                     StateType     --  \n",
      "33                                   --  \n",
      "34    421           PropertyType     --  \n",
      "35                     StateType     --  \n",
      "36                     StateType     --  \n",
      "37                        Method     --  \n",
      "38                                   --  \n",
      "39    420           PropertyType     --  \n",
      "40                     StateType     --  \n",
      "41                     StateType     --   \n",
      "-----------------------------------------------------------------------------\n",
      "\n",
      "                        0            1                      2      3  \\\n",
      "0              BrowseName   References      Target BrowseName  Value   \n",
      "1                            HasEffect  StateChangedEventType          \n",
      "2  OperationalToErrorAuto  HasProperty       TransitionNumber    430   \n",
      "3                            FromState            Operational          \n",
      "4                              ToState                  Error          \n",
      "5                            HasEffect  StateChangedEventType          \n",
      "\n",
      "                       4      5  \n",
      "0  Target TypeDefinition  Notes  \n",
      "1                            --  \n",
      "2           PropertyType     --  \n",
      "3              StateType     --  \n",
      "4              StateType     --  \n",
      "5                            --   \n",
      "-----------------------------------------------------------------------------\n",
      "\n",
      "                            0            1                        2      3  \\\n",
      "0                  BrowseName   References        Target BrowseName  Value   \n",
      "1    InitializedToReadyRecipe  HasProperty         TransitionNumber    561   \n",
      "2                                FromState              Initialized          \n",
      "3                                  ToState                    Ready          \n",
      "4                                 HasCause            PrepareRecipe          \n",
      "5                                HasEffect    StateChangedEventType          \n",
      "6                                HasEffect  RecipePreparedEventType          \n",
      "7   InitializedToReadyProduct  HasProperty         TransitionNumber    562   \n",
      "8                                FromState              Initialized          \n",
      "9                                  ToState                    Ready          \n",
      "10                                HasCause           PrepareProduct          \n",
      "11                               HasEffect    StateChangedEventType          \n",
      "12                               HasEffect  RecipePreparedEventType          \n",
      "13     InitializedToReadyAuto  HasProperty         TransitionNumber    560   \n",
      "14                               FromState              Initialized          \n",
      "15                                 ToState                    Ready          \n",
      "16                               HasEffect    StateChangedEventType          \n",
      "17   ReadyToInitializedRecipe  HasProperty         TransitionNumber    651   \n",
      "18                               FromState                    Ready          \n",
      "19                                 ToState              Initialized          \n",
      "20                                HasCause          UnprepareRecipe          \n",
      "21                               HasEffect    StateChangedEventType          \n",
      "22  ReadyToInitializedProduct  HasProperty         TransitionNumber    652   \n",
      "23                               FromState                    Ready          \n",
      "24                                 ToState              Initialized          \n",
      "25                                HasCause         UnprepareProduct          \n",
      "26                               HasEffect    StateChangedEventType          \n",
      "27     ReadyToInitializedAuto  HasProperty         TransitionNumber    650   \n",
      "28                               FromState                    Ready          \n",
      "29                                 ToState              Initialized          \n",
      "30                               HasEffect    StateChangedEventType          \n",
      "31     ReadyToSingleExecution  HasProperty         TransitionNumber    671   \n",
      "32                               FromState                    Ready          \n",
      "33                                 ToState          SingleExecution          \n",
      "34                                HasCause           StartSingleJob          \n",
      "35                               HasEffect    StateChangedEventType          \n",
      "36                               HasEffect      JobStartedEventType          \n",
      "\n",
      "                        4      5  \n",
      "0   Target TypeDefinition  Notes  \n",
      "1            PropertyType     --  \n",
      "2               StateType     --  \n",
      "3               StateType     --  \n",
      "4                  Method     --  \n",
      "5                             --  \n",
      "6                             --  \n",
      "7            PropertyType     --  \n",
      "8               StateType     --  \n",
      "9               StateType     --  \n",
      "10                 Method     --  \n",
      "11                            --  \n",
      "12                            --  \n",
      "13           PropertyType     --  \n",
      "14              StateType     --  \n",
      "15              StateType     --  \n",
      "16                            --  \n",
      "17           PropertyType     --  \n",
      "18              StateType     --  \n",
      "19              StateType     --  \n",
      "20                 Method     --  \n",
      "21                            --  \n",
      "22           PropertyType     --  \n",
      "23              StateType     --  \n",
      "24              StateType     --  \n",
      "25                 Method     --  \n",
      "26                            --  \n",
      "27           PropertyType     --  \n",
      "28              StateType     --  \n",
      "29              StateType     --  \n",
      "30                            --  \n",
      "31           PropertyType     --  \n",
      "32              StateType     --  \n",
      "33              StateType     --  \n",
      "34                 Method     --  \n",
      "35                            --  \n",
      "36                            --   \n",
      "-----------------------------------------------------------------------------\n",
      "\n",
      "                            0            1                      2    3  \\\n",
      "0  ReadyToSingleExecutionAuto  HasProperty       TransitionNumber  670   \n",
      "1                                FromState                  Ready        \n",
      "2                                  ToState        SingleExecution        \n",
      "3                                HasEffect  StateChangedEventType        \n",
      "4                                HasEffect    JobStartedEventType        \n",
      "\n",
      "              4   5  \n",
      "0  PropertyType  --  \n",
      "1     StateType  --  \n",
      "2     StateType  --  \n",
      "3                --  \n",
      "4                --   \n",
      "-----------------------------------------------------------------------------\n",
      "\n",
      "                            0            1                      2    3  \\\n",
      "0  ReadyToContinuousExecution  HasProperty       TransitionNumber  681   \n",
      "1                                FromState                  Ready        \n",
      "2                                  ToState    ContinuousExecution        \n",
      "3                                 HasCause        StartContinuous        \n",
      "4                                HasEffect  StateChangedEventType        \n",
      "5                                HasEffect    JobStartedEventType        \n",
      "\n",
      "              4   5  \n",
      "0  PropertyType  --  \n",
      "1     StateType  --  \n",
      "2     StateType  --  \n",
      "3        Method  --  \n",
      "4                --  \n",
      "5                --   \n",
      "-----------------------------------------------------------------------------\n",
      "\n",
      "                                0            1                      2    3  \\\n",
      "0  ReadyToContinuousExecutionAuto  HasProperty       TransitionNumber  680   \n",
      "1                                    FromState                  Ready        \n",
      "2                                      ToState    ContinuousExecution        \n",
      "3                                    HasEffect  StateChangedEventType        \n",
      "4                                    HasEffect    JobStartedEventType        \n",
      "\n",
      "              4   5  \n",
      "0  PropertyType  --  \n",
      "1     StateType  --  \n",
      "2     StateType  --  \n",
      "3                --  \n",
      "4                --   \n",
      "-----------------------------------------------------------------------------\n",
      "\n",
      "                            0            1                      2    3  \\\n",
      "0  SingleExecutionToReadyAuto  HasProperty       TransitionNumber  760   \n",
      "1                                FromState        SingleExecution        \n",
      "2                                  ToState                  Ready        \n",
      "3                                HasEffect  StateChangedEventType        \n",
      "4                                HasEffect         ReadyEventType        \n",
      "\n",
      "              4   5  \n",
      "0  PropertyType  --  \n",
      "1     StateType  --  \n",
      "2     StateType  --  \n",
      "3                --  \n",
      "4                --   \n",
      "-----------------------------------------------------------------------------\n",
      "\n",
      "                            0            1                      2    3  \\\n",
      "0  SingleExecutionToReadyStop  HasProperty       TransitionNumber  761   \n",
      "1                                FromState        SingleExecution        \n",
      "2                                  ToState                  Ready        \n",
      "3                                 HasCause                   Stop        \n",
      "4                                HasEffect  StateChangedEventType        \n",
      "5                                HasEffect         ReadyEventType        \n",
      "\n",
      "              4   5  \n",
      "0  PropertyType      \n",
      "1     StateType  --  \n",
      "2     StateType  --  \n",
      "3        Method  --  \n",
      "4                --  \n",
      "5                --   \n",
      "-----------------------------------------------------------------------------\n",
      "\n",
      "                             0            1                      2    3  \\\n",
      "0  SingleExecutionToReadyAbort  HasProperty       TransitionNumber  762   \n",
      "1                                 FromState        SingleExecution        \n",
      "2                                   ToState                  Ready        \n",
      "3                                  HasCause                  Abort        \n",
      "4                                 HasEffect  StateChangedEventType        \n",
      "5                                 HasEffect         ReadyEventType        \n",
      "\n",
      "              4   5  \n",
      "0  PropertyType  --  \n",
      "1     StateType  --  \n",
      "2     StateType  --  \n",
      "3        Method  --  \n",
      "4                --  \n",
      "5                --   \n",
      "-----------------------------------------------------------------------------\n",
      "\n",
      "                                0            1                      2    3  \\\n",
      "0  ContinuousExecutionToReadyAuto  HasProperty       TransitionNumber  860   \n",
      "1                                    FromState    ContinuousExecution        \n",
      "2                                      ToState                  Ready        \n",
      "3                                    HasEffect  StateChangedEventType        \n",
      "4                                    HasEffect         ReadyEventType        \n",
      "\n",
      "              4   5  \n",
      "0  PropertyType  --  \n",
      "1     StateType  --  \n",
      "2     StateType  --  \n",
      "3                --  \n",
      "4                --   \n",
      "-----------------------------------------------------------------------------\n",
      "\n",
      "                                0            1                    2    3  \\\n",
      "0  ContinuousExecutionToReadyStop  HasProperty     TransitionNumber  861   \n",
      "1                                    FromState  ContinuousExecution        \n",
      "2                                      ToState                Ready        \n",
      "3                                     HasCause                 Stop        \n",
      "\n",
      "              4   5  \n",
      "0  PropertyType  --  \n",
      "1     StateType  --  \n",
      "2     StateType  --  \n",
      "3        Method  --   \n",
      "-----------------------------------------------------------------------------\n",
      "\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "            0           1                      2      3  \\\n",
      "0  BrowseName  References      Target BrowseName  Value   \n",
      "1               HasEffect  StateChangedEventType          \n",
      "2               HasEffect         ReadyEventType          \n",
      "\n",
      "                       4      5  \n",
      "0  Target TypeDefinition  Notes  \n",
      "1                            --  \n",
      "2                            --   \n",
      "-----------------------------------------------------------------------------\n",
      "\n",
      "                                 0            1                      2    3  \\\n",
      "0  ContinuousExecutionToReadyAbort  HasProperty       TransitionNumber  862   \n",
      "1                                     FromState    ContinuousExecution        \n",
      "2                                       ToState                  Ready        \n",
      "3                                      HasCause                  Abort        \n",
      "4                                     HasEffect  StateChangedEventType        \n",
      "5                                     HasEffect         ReadyEventType        \n",
      "\n",
      "              4   5  \n",
      "0  PropertyType  --  \n",
      "1     StateType  --  \n",
      "2     StateType  --  \n",
      "3        Method  --  \n",
      "4                --  \n",
      "5                --   \n",
      "-----------------------------------------------------------------------------\n",
      "\n",
      "                  0            1                           2      3  \\\n",
      "0        BrowseName   References           Target BrowseName  Value   \n",
      "1   EntryToExitAuto  HasProperty            TransitionNumber  11120   \n",
      "2                      FromState                       Entry          \n",
      "3                        ToState                        Exit          \n",
      "4                      HasEffect       StateChangedEventType          \n",
      "5   EntryToWaitAuto  HasProperty            TransitionNumber  11130   \n",
      "6                      FromState                       Entry          \n",
      "7                        ToState                        Wait          \n",
      "8                      HasEffect  EnterStepSequenceEventType          \n",
      "9                      HasEffect       StateChangedEventType          \n",
      "10       WaitToStep  HasProperty            TransitionNumber  13141   \n",
      "11                     FromState                        Wait          \n",
      "12                       ToState                        Step          \n",
      "13                      HasCause                        Sync          \n",
      "14                     HasEffect       StateChangedEventType          \n",
      "15   WaitToStepAuto  HasProperty            TransitionNumber  13140   \n",
      "16                     FromState                        Wait          \n",
      "17                       ToState                        Step          \n",
      "18                     HasEffect       StateChangedEventType          \n",
      "19   StepToExitAuto  HasProperty            TransitionNumber  14120   \n",
      "20                     FromState                        Step          \n",
      "\n",
      "                        4      5  \n",
      "0   Target TypeDefinition  Notes  \n",
      "1            PropertyType     --  \n",
      "2               StateType     --  \n",
      "3               StateType     --  \n",
      "4                             --  \n",
      "5            PropertyType     --  \n",
      "6               StateType     --  \n",
      "7               StateType     --  \n",
      "8                             --  \n",
      "9                             --  \n",
      "10           PropertyType     --  \n",
      "11              StateType     --  \n",
      "12              StateType     --  \n",
      "13                 Method     --  \n",
      "14                            --  \n",
      "15           PropertyType     --  \n",
      "16              StateType     --  \n",
      "17              StateType     --  \n",
      "18                            --  \n",
      "19           PropertyType     --  \n",
      "20              StateType     --   \n",
      "-----------------------------------------------------------------------------\n",
      "\n",
      "                0            1                           2      3  \\\n",
      "0      BrowseName   References           Target BrowseName  Value   \n",
      "1                      ToState                        Exit          \n",
      "2                    HasEffect  LeaveStepSequenceEventType          \n",
      "3                    HasEffect       StateChangedEventType          \n",
      "4  StepToWaitAuto  HasProperty            TransitionNumber  14130   \n",
      "5                    FromState                        Step          \n",
      "6                      ToState                        Wait          \n",
      "7                    HasEffect           NextStepEventType          \n",
      "8                    HasEffect       StateChangedEventType          \n",
      "\n",
      "                       4      5  \n",
      "0  Target TypeDefinition  Notes  \n",
      "1              StateType     --  \n",
      "2                            --  \n",
      "3                            --  \n",
      "4           PropertyType     --  \n",
      "5              StateType     --  \n",
      "6              StateType     --  \n",
      "7                            --  \n",
      "8                            --   \n",
      "-----------------------------------------------------------------------------\n",
      "\n"
     ]
    }
   ],
   "source": [
    "tran = 0\n",
    "for trans in tables:\n",
    "    if any(n in trans.df.to_string() for n in transition):\n",
    "        ttype = trans.df\n",
    "        tran = tran + 1\n",
    "        print(trans.df, \"\\n-----------------------------------------------------------------------------\\n\")\n",
    "    "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 140,
   "metadata": {},
   "outputs": [],
   "source": [
    "Tt = {'TransitionType': []}"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Stemming and Lemmatization both generate the foundation sort of the inflected words and therefore the only difference is that stem may not be an actual word whereas, lemma is an actual language word. Stemming follows an algorithm with steps to perform on the words which makes it faster."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 141,
   "metadata": {},
   "outputs": [],
   "source": [
    "def lemma(word):\n",
    "    for suffix in ['ing', 'ed','ning','ping','ped','ged']:\n",
    "        if word.endswith(suffix):\n",
    "            return word[:-len(suffix)]\n",
    "    return word"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 142,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['begg', 'hugg', 'stopp', 'runn', 'hold', 'suspend']\n"
     ]
    }
   ],
   "source": [
    "l = ['begged', 'hugged','stopped','running', 'holding','suspended']\n",
    "h = [lemma(word) for word in l]\n",
    "#h1 = [stem(word) for word in l]\n",
    "print(h)\n",
    "#print(h1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 143,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:31:45.325099Z",
     "start_time": "2021-08-04T07:31:44.494552Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "                                  0            1  \\\n",
      "0                        BrowseName   References   \n",
      "1            PreoperationalToHalted  HasProperty   \n",
      "2                                      FromState   \n",
      "3                                        ToState   \n",
      "4                                       HasCause   \n",
      "5                                      HasEffect   \n",
      "6        PreoperationalToHaltedAuto  HasProperty   \n",
      "7                                      FromState   \n",
      "8                                        ToState   \n",
      "9                                      HasEffect   \n",
      "10        PreoperationalToErrorAuto  HasProperty   \n",
      "11                                     FromState   \n",
      "12                                       ToState   \n",
      "13                                     HasEffect   \n",
      "14                                     HasEffect   \n",
      "15      PreoperationalToOperational  HasProperty   \n",
      "16                                     FromState   \n",
      "17                                       ToState   \n",
      "18                                      HasCause   \n",
      "19                                     HasEffect   \n",
      "20  PreoperationalToOperationalAuto  HasProperty   \n",
      "21                                     FromState   \n",
      "22                                       ToState   \n",
      "23                                     HasEffect   \n",
      "24      PreoperationalToInitialized  HasProperty   \n",
      "25                                     FromState   \n",
      "26                                       ToState   \n",
      "27                                      HasCause   \n",
      "28                                     HasEffect   \n",
      "29  PreoperationalToInitializedAuto  HasProperty   \n",
      "30                                     FromState   \n",
      "31                                       ToState   \n",
      "32                                     HasEffect   \n",
      "33           HaltedToPreoperational  HasProperty   \n",
      "34                                     FromState   \n",
      "35                                       ToState   \n",
      "36                                      HasCause   \n",
      "37                                     HasEffect   \n",
      "38       HaltedToPreoperationalAuto  HasProperty   \n",
      "39                                     FromState   \n",
      "40                                       ToState   \n",
      "\n",
      "                                        2      3                      4      5  \n",
      "0                       Target BrowseName  Value  Target TypeDefinition  Notes  \n",
      "1                        TransitionNumber    121           PropertyType     --  \n",
      "2                          Preoperational                     StateType     --  \n",
      "3                                  Halted                     StateType     --  \n",
      "4                                    Halt                        Method     --  \n",
      "5                   StateChangedEventType                                   --  \n",
      "6                        TransitionNumber    120           PropertyType     --  \n",
      "7                          Preoperational                     StateType     --  \n",
      "8                                  Halted                     StateType     --  \n",
      "9                   StateChangedEventType                                   --  \n",
      "10                       TransitionNumber    130           PropertyType     --  \n",
      "11                         Preoperational                     StateType     --  \n",
      "12                                  Error                     StateType     --  \n",
      "13                  StateChangedEventType                                   --  \n",
      "14                         ErrorEventType                                   --  \n",
      "15                       TransitionNumber    141           PropertyType     --  \n",
      "16                         Preoperational                     StateType     --  \n",
      "17                            Operational                     StateType     --  \n",
      "18                    SelectModeAutomatic                        Method     --  \n",
      "19                  StateChangedEventType                                   --  \n",
      "20                       TransitionNumber    140           PropertyType     --  \n",
      "21                         Preoperational                     StateType     --  \n",
      "22                            Operational                     StateType     --  \n",
      "23                  StateChangedEventType                                   --  \n",
      "24                       TransitionNumber    151           PropertyType     --  \n",
      "25                         Preoperational                     StateType     --  \n",
      "26  AutomaticModeStateMachine.Initialized                     StateType     --  \n",
      "27                    SelectModeAutomatic                        Method     --  \n",
      "28                  StateChangedEventType                                   --  \n",
      "29                       TransitionNumber    150           PropertyType     --  \n",
      "30                         Preoperational                     StateType     --  \n",
      "31  AutomaticModeStateMachine.Initialized                     StateType     --  \n",
      "32                  StateChangedEventType                                   --  \n",
      "33                       TransitionNumber    211           PropertyType     --  \n",
      "34                                 Halted                     StateType     --  \n",
      "35                         Preoperational                     StateType     --  \n",
      "36                                  Reset                        Method     --  \n",
      "37                  StateChangedEventType                                   --  \n",
      "38                       TransitionNumber    210           PropertyType     --  \n",
      "39                                 Halted                     StateType     --  \n",
      "40                         Preoperational                     StateType     --   \n",
      "-----------------------------------------------------------------------------\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "For PreoperationalToHaltedAuto transition only Preoperational,HaltedAuto states are allowed.\n",
      "The HaltedAuto method should trigger a change of state to HaltedAuto from Preoperational state, for PreoperationalToHaltedAuto transition.\n",
      "\n",
      "\n",
      "\n",
      "For PreoperationalToErrorAuto transition only Preoperational,ErrorAuto states are allowed.\n",
      "The ErrorAuto method should trigger a change of state to ErrorAuto from Preoperational state, for PreoperationalToErrorAuto transition.\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "For PreoperationalToOperational transition only Preoperational,Operational states are allowed.\n",
      "The Operational method should trigger a change of state to Operational from Preoperational state, for PreoperationalToOperational transition.\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "For PreoperationalToOperationalAuto transition only Preoperational,OperationalAuto states are allowed.\n",
      "The OperationalAuto method should trigger a change of state to OperationalAuto from Preoperational state, for PreoperationalToOperationalAuto transition.\n",
      "\n",
      "\n",
      "\n",
      "For PreoperationalToInitialized transition only Preoperational,Initialized states are allowed.\n",
      "The Initializ method should trigger a change of state to Initialized from Preoperational state, for PreoperationalToInitialized transition.\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "For PreoperationalToInitializedAuto transition only Preoperational,InitializedAuto states are allowed.\n",
      "The InitializedAuto method should trigger a change of state to InitializedAuto from Preoperational state, for PreoperationalToInitializedAuto transition.\n",
      "\n",
      "\n",
      "\n",
      "For HaltedToPreoperational transition only Halted,Preoperational states are allowed.\n",
      "The Preoperational method should trigger a change of state to Preoperational from Halted state, for HaltedToPreoperational transition.\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "For HaltedToPreoperationalAuto transition only Halted,PreoperationalAuto states are allowed.\n",
      "The PreoperationalAuto method should trigger a change of state to PreoperationalAuto from Halted state, for HaltedToPreoperationalAuto transition.\n",
      "\n",
      "\n",
      "                                  0            1                       2  \\\n",
      "0                        BrowseName   References       Target BrowseName   \n",
      "1                                      HasEffect   StateChangedEventType   \n",
      "2             ErrorToPreoperational  HasProperty        TransitionNumber   \n",
      "3                                      FromState                   Error   \n",
      "4                                        ToState          Preoperational   \n",
      "5                                       HasCause                   Reset   \n",
      "6                                      HasEffect   StateChangedEventType   \n",
      "7         ErrorToPreoperationalAuto  HasProperty        TransitionNumber   \n",
      "8                                      FromState                   Error   \n",
      "9                                        ToState          Preoperational   \n",
      "10                                     HasEffect   StateChangedEventType   \n",
      "11                    ErrorToHalted  HasProperty        TransitionNumber   \n",
      "12                                     FromState                   Error   \n",
      "13                                       ToState                  Halted   \n",
      "14                                      HasCause                    Halt   \n",
      "15                                     HasEffect   StateChangedEventType   \n",
      "16                ErrorToHaltedAuto  HasProperty        TransitionNumber   \n",
      "17                                     FromState                   Error   \n",
      "18                                       ToState                  Halted   \n",
      "19                                     HasEffect   StateChangedEventType   \n",
      "20           ErrorToOperationalAuto  HasProperty        TransitionNumber   \n",
      "21                                     FromState                   Error   \n",
      "22                                       ToState             Operational   \n",
      "23                                     HasEffect   StateChangedEventType   \n",
      "24                                     HasEffect  ErrorResolvedEventType   \n",
      "25      OperationalToPreoperational  HasProperty        TransitionNumber   \n",
      "26                                     FromState             Operational   \n",
      "27                                       ToState          Preoperational   \n",
      "28                                      HasCause                   Reset   \n",
      "29                                     HasEffect   StateChangedEventType   \n",
      "30  OperationalToPreoperationalAuto  HasProperty        TransitionNumber   \n",
      "31                                     FromState             Operational   \n",
      "32                                       ToState          Preoperational   \n",
      "33                                     HasEffect   StateChangedEventType   \n",
      "34              OperationalToHalted  HasProperty        TransitionNumber   \n",
      "35                                     FromState             Operational   \n",
      "36                                       ToState                  Halted   \n",
      "37                                      HasCause                    Halt   \n",
      "38                                     HasEffect   StateChangedEventType   \n",
      "39          OperationalToHaltedAuto  HasProperty        TransitionNumber   \n",
      "40                                     FromState             Operational   \n",
      "41                                       ToState                  Halted   \n",
      "\n",
      "        3                      4      5  \n",
      "0   Value  Target TypeDefinition  Notes  \n",
      "1                                    --  \n",
      "2     311           PropertyType     --  \n",
      "3                      StateType     --  \n",
      "4                      StateType     --  \n",
      "5                         Method     --  \n",
      "6                                    --  \n",
      "7     310           PropertyType     --  \n",
      "8                      StateType     --  \n",
      "9                      StateType     --  \n",
      "10                                       \n",
      "11    321           PropertyType     --  \n",
      "12                     StateType     --  \n",
      "13                     StateType     --  \n",
      "14                        Method     --  \n",
      "15                                   --  \n",
      "16    320           PropertyType     --  \n",
      "17                     StateType     --  \n",
      "18                     StateType     --  \n",
      "19                                   --  \n",
      "20    340           PropertyType     --  \n",
      "21                     StateType     --  \n",
      "22                     StateType     --  \n",
      "23                                   --  \n",
      "24                                   --  \n",
      "25    411           PropertyType     --  \n",
      "26                     StateType     --  \n",
      "27                     StateType     --  \n",
      "28                        Method     --  \n",
      "29                                   --  \n",
      "30    410           PropertyType     --  \n",
      "31                     StateType     --  \n",
      "32                     StateType     --  \n",
      "33                                   --  \n",
      "34    421           PropertyType     --  \n",
      "35                     StateType     --  \n",
      "36                     StateType     --  \n",
      "37                        Method     --  \n",
      "38                                   --  \n",
      "39    420           PropertyType     --  \n",
      "40                     StateType     --  \n",
      "41                     StateType     --   \n",
      "-----------------------------------------------------------------------------\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "For ErrorToPreoperationalAuto transition only Error,PreoperationalAuto states are allowed.\n",
      "The PreoperationalAuto method should trigger a change of state to PreoperationalAuto from Error state, for ErrorToPreoperationalAuto transition.\n",
      "\n",
      "\n",
      "\n",
      "For ErrorToHalted transition only Error,Halted states are allowed.\n",
      "The Halt method should trigger a change of state to Halted from Error state, for ErrorToHalted transition.\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "For ErrorToHaltedAuto transition only Error,HaltedAuto states are allowed.\n",
      "The HaltedAuto method should trigger a change of state to HaltedAuto from Error state, for ErrorToHaltedAuto transition.\n",
      "\n",
      "\n",
      "\n",
      "For ErrorToOperationalAuto transition only Error,OperationalAuto states are allowed.\n",
      "The OperationalAuto method should trigger a change of state to OperationalAuto from Error state, for ErrorToOperationalAuto transition.\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "For OperationalToPreoperational transition only Operational,Preoperational states are allowed.\n",
      "The Preoperational method should trigger a change of state to Preoperational from Operational state, for OperationalToPreoperational transition.\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "For OperationalToPreoperationalAuto transition only Operational,PreoperationalAuto states are allowed.\n",
      "The PreoperationalAuto method should trigger a change of state to PreoperationalAuto from Operational state, for OperationalToPreoperationalAuto transition.\n",
      "\n",
      "\n",
      "\n",
      "For OperationalToHalted transition only Operational,Halted states are allowed.\n",
      "The Halt method should trigger a change of state to Halted from Operational state, for OperationalToHalted transition.\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "For OperationalToHaltedAuto transition only Operational,HaltedAuto states are allowed.\n",
      "The HaltedAuto method should trigger a change of state to HaltedAuto from Operational state, for OperationalToHaltedAuto transition.\n",
      "\n",
      "\n",
      "                        0            1                      2      3  \\\n",
      "0              BrowseName   References      Target BrowseName  Value   \n",
      "1                            HasEffect  StateChangedEventType          \n",
      "2  OperationalToErrorAuto  HasProperty       TransitionNumber    430   \n",
      "3                            FromState            Operational          \n",
      "4                              ToState                  Error          \n",
      "5                            HasEffect  StateChangedEventType          \n",
      "\n",
      "                       4      5  \n",
      "0  Target TypeDefinition  Notes  \n",
      "1                            --  \n",
      "2           PropertyType     --  \n",
      "3              StateType     --  \n",
      "4              StateType     --  \n",
      "5                            --   \n",
      "-----------------------------------------------------------------------------\n",
      "\n",
      "\n",
      "\n",
      "\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "                            0            1                        2      3  \\\n",
      "0                  BrowseName   References        Target BrowseName  Value   \n",
      "1    InitializedToReadyRecipe  HasProperty         TransitionNumber    561   \n",
      "2                                FromState              Initialized          \n",
      "3                                  ToState                    Ready          \n",
      "4                                 HasCause            PrepareRecipe          \n",
      "5                                HasEffect    StateChangedEventType          \n",
      "6                                HasEffect  RecipePreparedEventType          \n",
      "7   InitializedToReadyProduct  HasProperty         TransitionNumber    562   \n",
      "8                                FromState              Initialized          \n",
      "9                                  ToState                    Ready          \n",
      "10                                HasCause           PrepareProduct          \n",
      "11                               HasEffect    StateChangedEventType          \n",
      "12                               HasEffect  RecipePreparedEventType          \n",
      "13     InitializedToReadyAuto  HasProperty         TransitionNumber    560   \n",
      "14                               FromState              Initialized          \n",
      "15                                 ToState                    Ready          \n",
      "16                               HasEffect    StateChangedEventType          \n",
      "17   ReadyToInitializedRecipe  HasProperty         TransitionNumber    651   \n",
      "18                               FromState                    Ready          \n",
      "19                                 ToState              Initialized          \n",
      "20                                HasCause          UnprepareRecipe          \n",
      "21                               HasEffect    StateChangedEventType          \n",
      "22  ReadyToInitializedProduct  HasProperty         TransitionNumber    652   \n",
      "23                               FromState                    Ready          \n",
      "24                                 ToState              Initialized          \n",
      "25                                HasCause         UnprepareProduct          \n",
      "26                               HasEffect    StateChangedEventType          \n",
      "27     ReadyToInitializedAuto  HasProperty         TransitionNumber    650   \n",
      "28                               FromState                    Ready          \n",
      "29                                 ToState              Initialized          \n",
      "30                               HasEffect    StateChangedEventType          \n",
      "31     ReadyToSingleExecution  HasProperty         TransitionNumber    671   \n",
      "32                               FromState                    Ready          \n",
      "33                                 ToState          SingleExecution          \n",
      "34                                HasCause           StartSingleJob          \n",
      "35                               HasEffect    StateChangedEventType          \n",
      "36                               HasEffect      JobStartedEventType          \n",
      "\n",
      "                        4      5  \n",
      "0   Target TypeDefinition  Notes  \n",
      "1            PropertyType     --  \n",
      "2               StateType     --  \n",
      "3               StateType     --  \n",
      "4                  Method     --  \n",
      "5                             --  \n",
      "6                             --  \n",
      "7            PropertyType     --  \n",
      "8               StateType     --  \n",
      "9               StateType     --  \n",
      "10                 Method     --  \n",
      "11                            --  \n",
      "12                            --  \n",
      "13           PropertyType     --  \n",
      "14              StateType     --  \n",
      "15              StateType     --  \n",
      "16                            --  \n",
      "17           PropertyType     --  \n",
      "18              StateType     --  \n",
      "19              StateType     --  \n",
      "20                 Method     --  \n",
      "21                            --  \n",
      "22           PropertyType     --  \n",
      "23              StateType     --  \n",
      "24              StateType     --  \n",
      "25                 Method     --  \n",
      "26                            --  \n",
      "27           PropertyType     --  \n",
      "28              StateType     --  \n",
      "29              StateType     --  \n",
      "30                            --  \n",
      "31           PropertyType     --  \n",
      "32              StateType     --  \n",
      "33              StateType     --  \n",
      "34                 Method     --  \n",
      "35                            --  \n",
      "36                            --   \n",
      "-----------------------------------------------------------------------------\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "For InitializedToReadyProduct transition only Initialized,ReadyProduct states are allowed.\n",
      "The ReadyProduct method should trigger a change of state to ReadyProduct from Initialized state, for InitializedToReadyProduct transition.\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "For InitializedToReadyAuto transition only Initialized,ReadyAuto states are allowed.\n",
      "The ReadyAuto method should trigger a change of state to ReadyAuto from Initialized state, for InitializedToReadyAuto transition.\n",
      "\n",
      "\n",
      "\n",
      "For ReadyToInitializedRecipe transition only Ready,InitializedRecipe states are allowed.\n",
      "The InitializedRecipe method should trigger a change of state to InitializedRecipe from Ready state, for ReadyToInitializedRecipe transition.\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "For ReadyToInitializedProduct transition only Ready,InitializedProduct states are allowed.\n",
      "The InitializedProduct method should trigger a change of state to InitializedProduct from Ready state, for ReadyToInitializedProduct transition.\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "For ReadyToInitializedAuto transition only Ready,InitializedAuto states are allowed.\n",
      "The InitializedAuto method should trigger a change of state to InitializedAuto from Ready state, for ReadyToInitializedAuto transition.\n",
      "\n",
      "\n",
      "\n",
      "For ReadyToSingleExecution transition only Ready,SingleExecution states are allowed.\n",
      "The SingleExecution method should trigger a change of state to SingleExecution from Ready state, for ReadyToSingleExecution transition.\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "            0           1                      2      3  \\\n",
      "0  BrowseName  References      Target BrowseName  Value   \n",
      "1               HasEffect  StateChangedEventType          \n",
      "2               HasEffect         ReadyEventType          \n",
      "\n",
      "                       4      5  \n",
      "0  Target TypeDefinition  Notes  \n",
      "1                            --  \n",
      "2                            --   \n",
      "-----------------------------------------------------------------------------\n",
      "\n",
      "                  0            1                           2      3  \\\n",
      "0        BrowseName   References           Target BrowseName  Value   \n",
      "1   EntryToExitAuto  HasProperty            TransitionNumber  11120   \n",
      "2                      FromState                       Entry          \n",
      "3                        ToState                        Exit          \n",
      "4                      HasEffect       StateChangedEventType          \n",
      "5   EntryToWaitAuto  HasProperty            TransitionNumber  11130   \n",
      "6                      FromState                       Entry          \n",
      "7                        ToState                        Wait          \n",
      "8                      HasEffect  EnterStepSequenceEventType          \n",
      "9                      HasEffect       StateChangedEventType          \n",
      "10       WaitToStep  HasProperty            TransitionNumber  13141   \n",
      "11                     FromState                        Wait          \n",
      "12                       ToState                        Step          \n",
      "13                      HasCause                        Sync          \n",
      "14                     HasEffect       StateChangedEventType          \n",
      "15   WaitToStepAuto  HasProperty            TransitionNumber  13140   \n",
      "16                     FromState                        Wait          \n",
      "17                       ToState                        Step          \n",
      "18                     HasEffect       StateChangedEventType          \n",
      "19   StepToExitAuto  HasProperty            TransitionNumber  14120   \n",
      "20                     FromState                        Step          \n",
      "\n",
      "                        4      5  \n",
      "0   Target TypeDefinition  Notes  \n",
      "1            PropertyType     --  \n",
      "2               StateType     --  \n",
      "3               StateType     --  \n",
      "4                             --  \n",
      "5            PropertyType     --  \n",
      "6               StateType     --  \n",
      "7               StateType     --  \n",
      "8                             --  \n",
      "9                             --  \n",
      "10           PropertyType     --  \n",
      "11              StateType     --  \n",
      "12              StateType     --  \n",
      "13                 Method     --  \n",
      "14                            --  \n",
      "15           PropertyType     --  \n",
      "16              StateType     --  \n",
      "17              StateType     --  \n",
      "18                            --  \n",
      "19           PropertyType     --  \n",
      "20              StateType     --   \n",
      "-----------------------------------------------------------------------------\n",
      "\n",
      "\n",
      "\n",
      "For EntryToWaitAuto transition only Entry,WaitAuto states are allowed.\n",
      "The WaitAuto method should trigger a change of state to WaitAuto from Entry state, for EntryToWaitAuto transition.\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "For WaitToStep transition only Wait,Step states are allowed.\n",
      "The Step method should trigger a change of state to Step from Wait state, for WaitToStep transition.\n",
      "\n",
      "\n",
      "\n",
      "\n",
      "For WaitToStepAuto transition only Wait,StepAuto states are allowed.\n",
      "The StepAuto method should trigger a change of state to StepAuto from Wait state, for WaitToStepAuto transition.\n",
      "\n",
      "\n",
      "\n",
      "For StepToExitAuto transition only Step,ExitAuto states are allowed.\n",
      "The ExitAuto method should trigger a change of state to ExitAuto from Step state, for StepToExitAuto transition.\n",
      "\n",
      "                0            1                           2      3  \\\n",
      "0      BrowseName   References           Target BrowseName  Value   \n",
      "1                      ToState                        Exit          \n",
      "2                    HasEffect  LeaveStepSequenceEventType          \n",
      "3                    HasEffect       StateChangedEventType          \n",
      "4  StepToWaitAuto  HasProperty            TransitionNumber  14130   \n",
      "5                    FromState                        Step          \n",
      "6                      ToState                        Wait          \n",
      "7                    HasEffect           NextStepEventType          \n",
      "8                    HasEffect       StateChangedEventType          \n",
      "\n",
      "                       4      5  \n",
      "0  Target TypeDefinition  Notes  \n",
      "1              StateType     --  \n",
      "2                            --  \n",
      "3                            --  \n",
      "4           PropertyType     --  \n",
      "5              StateType     --  \n",
      "6              StateType     --  \n",
      "7                            --  \n",
      "8                            --   \n",
      "-----------------------------------------------------------------------------\n",
      "\n",
      "\n",
      "For StepToWaitAuto transition only Step,WaitAuto states are allowed.\n",
      "The WaitAuto method should trigger a change of state to WaitAuto from Step state, for StepToWaitAuto transition.\n",
      "\n",
      "\n",
      "\n",
      "\n"
     ]
    }
   ],
   "source": [
    "count_trans = 0\n",
    "ncount_trans = 0\n",
    "for table_trans in tables:\n",
    "    \n",
    "    if any(n in table_trans.df.to_string() for n in transition):\n",
    "        #if not any(n in table_trans.df.to_string() for n in not_keywords_trans):\n",
    "            \n",
    "            t = table_trans.df\n",
    "            \n",
    "            try:\n",
    "                \n",
    "                if t.iat[0,1] == \"References\" or t.iat[0,1] == \"ReferenceType\" or t.iat[0,1] == \"Reference Type\":\n",
    "                    \n",
    "                    print(table_trans.df, \"\\n-----------------------------------------------------------------------------\\n\")\n",
    "                    count_trans = count_trans + 1\n",
    "                    \n",
    "                    for a in range(3,len(t)):\n",
    "                        \n",
    "                        Transition = t.iat[a,0] #BrowseName\n",
    "                        Reference = t.iat[a,1]\n",
    "                        BrowseName = t.iat[a,2]\n",
    "                        Type = t.iat[a,3]\n",
    "                        t_l = Transition.split('To')\n",
    "                        \n",
    "                        b = [lemma(word) for word in t_l]\n",
    "                        \n",
    "                        \n",
    "                        \n",
    "                        if Transition :\n",
    "                            print(\"For \" + Transition + \" transition only \" + (','.join(str(x) for x in t_l)) + \" states are allowed.\")\n",
    "                            Tt['TransitionType'].append(\"For \" + Transition + \" transition only \" + (','.join(str(x) for x in t_l)) + \" states are allowed.\")\n",
    "                            #if Type != 'StateType': \n",
    "                            print(\"The \" + b[1] + \" method should trigger a change of state to \" + str(t_l[1]) + \" from \" + str(t_l[0]) + \" state, for \" + str(t_l[0]) + \"To\" + str(t_l[1]) + \" transition.\")\n",
    "                            Tt['TransitionType'].append(\"The \" + b[1] + \" method should trigger a change of state to \" + str(t_l[1]) + \" from \" + str(t_l[0]) + \" state, for \" + str(t_l[0]) + \"To\" + str(t_l[1]) + \" transition.\")\n",
    "                        else:\n",
    "                            print('')\n",
    "                            \n",
    "                        \n",
    "                            \n",
    "                            \n",
    "                            \n",
    "                        \n",
    "                        \n",
    "            except:\n",
    "                ncount_trans = ncount_trans + 1\n",
    "                \n",
    "                print(\"\")\n",
    "                pass\n",
    "                \n",
    "            \n",
    "            \n",
    "            "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 144,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:31:45.333133Z",
     "start_time": "2021-08-04T07:31:45.327141Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "TP Value of Transition Type tables extracted with constraints 7\n",
      "FP Value of Transition Type tables without Constraints 0\n",
      "1.0\n"
     ]
    }
   ],
   "source": [
    "print(\"TP Value of Transition Type tables extracted with constraints\",count_trans)\n",
    "print(\"FP Value of Transition Type tables without Constraints\",ncount_trans)\n",
    "if (count_trans + ncount_trans) == 0:\n",
    "    Precision_trans = 'doesnotexist'\n",
    "else:\n",
    "    Precision_trans = count_trans /(count_trans + ncount_trans)\n",
    "print(Precision_trans)\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 145,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:31:45.345651Z",
     "start_time": "2021-08-04T07:31:45.334654Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Parameter</th>\n",
       "      <th>Value</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>TP Value of Transition Type tables extracted w...</td>\n",
       "      <td>7.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>FP Value of Transition Type tables without Con...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Precision Value of Transition type Tables extr...</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                           Parameter  Value\n",
       "0  TP Value of Transition Type tables extracted w...    7.0\n",
       "1  FP Value of Transition Type tables without Con...    0.0\n",
       "2  Precision Value of Transition type Tables extr...    1.0"
      ]
     },
     "execution_count": 145,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Transeval = pd.DataFrame({'Parameter':['TP Value of Transition Type tables extracted with constraints',\n",
    "                                      'FP Value of Transition Type tables without Constraints','Precision Value of Transition type Tables extracted'],\n",
    "                         'Value':[count_trans,ncount_trans,Precision_trans]})\n",
    "Transeval"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 146,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:31:45.350652Z",
     "start_time": "2021-08-04T07:31:45.346652Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "                                      TransitionType\n",
      "0  For PreoperationalToHaltedAuto transition only...\n",
      "1  The HaltedAuto method should trigger a change ...\n",
      "2  For PreoperationalToErrorAuto transition only ...\n",
      "3  The ErrorAuto method should trigger a change o...\n",
      "4  For PreoperationalToOperational transition onl...\n"
     ]
    }
   ],
   "source": [
    "df_8 = pd.DataFrame(Tt)\n",
    "print(df_8.head())"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### Namespace metadata"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 147,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:31:45.755989Z",
     "start_time": "2021-08-04T07:31:45.752237Z"
    }
   },
   "outputs": [],
   "source": [
    "ns=[\"Namespace\", \"Use\"]\n",
    "notns = [\"User\",\"Used\",\"Power train\",\"Namespace Index\", \"Example\",\"Definition of Term\",\"TypeDefinition\",\"Attributes\",\n",
    "         \"ComponentType\",\"Is Abstract\", \"NodeClass\", \"ModellingRule\", \"Enumeration\", \"EnumString\",\"ConformanceUnit\", \n",
    "         \"Conformance Unit\",\"Notation\", \"ValueRank\"]\n",
    "                                               "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 148,
   "metadata": {},
   "outputs": [],
   "source": [
    "Ns = {'Namespace': []}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 149,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:31:47.367909Z",
     "start_time": "2021-08-04T07:31:46.740487Z"
    }
   },
   "outputs": [],
   "source": [
    "count_ns1 = 0\n",
    "ncount_ns1 = 0\n",
    "for table_ns1 in tables:\n",
    "                                                     # select only tables which contain at least one of the key word\n",
    "    if any(s in (table_ns1.df).to_string() for s in ns):\n",
    "        if not any(s in (table_ns1.df).to_string() for s in notns):\n",
    "            sn1 = table_ns1.df\n",
    "            \n",
    "            try:\n",
    "                if len(sn1.columns) == 4 and sn1.iat[0,0] == \"Attribute\":\n",
    "                    print(table_ns1.df, \"\\n----------------------------------------------------------------------\\n\")\n",
    "                    count_ns1 = count_ns1 + 1\n",
    "                    for ns in range(2,len(sn1)):\n",
    "                        refs = sn1.iat[ns,0]\n",
    "                        browsename = sn1.iat[1,1] \n",
    "                        namespace = sn1.iat[ns,1] \n",
    "                        datatype = sn1.iat[ns,2]\n",
    "                        valu = sn1.iat[ns,3] \n",
    "                        print(\"Namespacemetadata Constraint :'\" + browsename + \"' Browsename is used to define a standard '\" + refs +\n",
    "                             \"' of \" + datatype + \" Datatype, which is '\" + valu)\n",
    "                \n",
    "            except:\n",
    "                if len(sn1.columns) != 4:\n",
    "                    print(\"------------------wrong extraction-------------------\")\n",
    "                    ncount_ns1 = ncount_ns1 + 1\n",
    "                    pass\n",
    "                    \n",
    "                    \n",
    "            \n",
    "          "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 150,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:31:47.916403Z",
     "start_time": "2021-08-04T07:31:47.369916Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "             0                          1  \\\n",
      "0    Attribute                              \n",
      "1   BrowseName                              \n",
      "2   References                 BrowseName   \n",
      "3  HasProperty               NamespaceUri   \n",
      "4  HasProperty           NamespaceVersion   \n",
      "5  HasProperty                              \n",
      "6  HasProperty          IsNamespaceSubset   \n",
      "7  HasProperty          StaticNodeIdTypes   \n",
      "8  HasProperty                              \n",
      "9  HasProperty  StaticStringNodeIdPattern   \n",
      "\n",
      "                                           2               3  \\\n",
      "0                                      Value                   \n",
      "1  http://opcfoundation.org/UA/MachineVision                   \n",
      "2                                                   DataType   \n",
      "3                                                     String   \n",
      "4                                                     String   \n",
      "5                   NamespacePublicationDate        DateTime   \n",
      "6                                                    Boolean   \n",
      "7                                                   IdType[]   \n",
      "8                   StaticNumericNodeIdRange  NumericRange[]   \n",
      "9                                                     String   \n",
      "\n",
      "                                           4  \n",
      "0                                             \n",
      "1                                             \n",
      "2                                      Value  \n",
      "3  http://opcfoundation.org/UA/MachineVision  \n",
      "4                                        1.0  \n",
      "5                                 2018-06-18  \n",
      "6                                      False  \n",
      "7                                             \n",
      "8                                             \n",
      "9                                              \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "Namespacemetadata:'http://opcfoundation.org/UA/MachineVision' Browsename is used to define a standard 'Local Server URI' of DataType Datatype, which is 'Value for the corresponding namespace '''.\n",
      "Namespacemetadata:'http://opcfoundation.org/UA/MachineVision' Browsename is used to define a standard 'http://opcfoundation.org/UA/MachineVision/' of String Datatype, which is 'http://opcfoundation.org/UA/MachineVision for the corresponding namespace '''.\n",
      "Namespacemetadata:'http://opcfoundation.org/UA/MachineVision' Browsename is used to define a standard 'Vendor specific types and instances' of String Datatype, which is '1.0 for the corresponding namespace '''.\n"
     ]
    }
   ],
   "source": [
    "# this type generally is the distorted format of the normal form of standard Namespace metadata table structure\n",
    "# due to incorrect cell spacing the values of 2nd and 3rd column (col.index 1, 2) have got jumbled leading to failure in \n",
    "# the extraction of constraints. It generally gives constraints if the values in 2nd and 3rd column (col.index 1, 2) are not jumbled\n",
    "\n",
    "count_ns2 = 0 \n",
    "ncount_ns2 = 0\n",
    "for table_ns2 in tables:\n",
    "                                                     # select only tables which contain at least one of the key word\n",
    "    if any(n in table_ns2.df.to_string() for n in ns):\n",
    "        if not any(n in table_ns2.df.to_string() for n in notns):\n",
    "            sn2 = table_ns2.df\n",
    "            \n",
    "            try:\n",
    "                if len(sn2.columns) == 5 and sn2.iat[0,0] == \"Attribute\":\n",
    "                    print(table_ns2.df, \"\\n----------------------------------------------------------------------\\n\")\n",
    "                    count_ns2 = count_ns2 + 1\n",
    "                    for ns2 in range(2,len(sn2)):\n",
    "                        refs = sn1.iat[ns2,0]\n",
    "                        browsename = sn2.iat[1,2]\n",
    "                        namespace = sn2.iat[ns2,2]\n",
    "                        datatype = sn2.iat[ns2,3]\n",
    "                        valu = sn2.iat[ns2,4]\n",
    "                        print(\"Namespacemetadata:'\" + browsename + \"' Browsename is used to define a standard '\" + refs +\n",
    "                             \"' of \" + datatype + \" Datatype, which is '\" + valu + \" for the corresponding namespace ''\" + namespace +\"'.\")\n",
    "                        Ns['Namespace'].append(\"Namespacemetadata:'\" + browsename + \"' Browsename is used to define a standard '\" + refs +\n",
    "                             \"' of \" + datatype + \" Datatype, which is '\" + valu + \" for the corresponding namespace ''\" + namespace +\"'.\")\n",
    "            except:\n",
    "                if len(sn2.columns) != 5:\n",
    "                    print(\"------------------wrong extraction-------------------\")\n",
    "                    ncount_ns2 = ncount_ns2 + 1\n",
    "                    pass\n",
    "                    \n",
    "                    \n",
    "            \n",
    "          "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 151,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:33:26.320491Z",
     "start_time": "2021-08-04T07:33:25.706075Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "                                            0  \\\n",
      "0                                NamespaceURI   \n",
      "1                http://opcfoundation.org/UA/   \n",
      "2                            Local Server URI   \n",
      "3  http://opcfoundation.org/UA/MachineVision/   \n",
      "4         Vendor specific types and instances   \n",
      "\n",
      "                                                   1          2  \n",
      "0                                        Description        Use  \n",
      "1  Namespace  for  NodeIds  and  BrowseNames  def...  Mandatory  \n",
      "2  Namespace  for  nodes  defined  in  the  local...  Mandatory  \n",
      "3  Namespace for NodeIds and BrowseNames defined ...  Mandatory  \n",
      "4  A  server  may  provide  vendor-specific \\ntyp...   Optional   \n",
      "----------------------------------------------------------------------\n",
      "\n",
      "NamespaceURI Constraint : The 'http://opcfoundation.org/UA/' used as in 'title' OPC UA Server is 'Mandatory'.\n",
      "NamespaceURI Constraint : The 'Local Server URI' used as in 'title' OPC UA Server is 'Mandatory'.\n",
      "NamespaceURI Constraint : The 'http://opcfoundation.org/UA/MachineVision/' used as in 'title' OPC UA Server is 'Mandatory'.\n",
      "NamespaceURI Constraint : The 'Vendor specific types and instances' used as in 'title' OPC UA Server is 'Optional'.\n"
     ]
    }
   ],
   "source": [
    "count_nuri = 0\n",
    "ncount_nuri = 0\n",
    "for table_nuri1 in tables:\n",
    "                                                     # select only tables which contain at least one of the key word\n",
    "    if any(n in table_nuri1.df.to_string() for n in ns):\n",
    "        if not any(n in table_nuri1.df.to_string() for n in notns):\n",
    "            uri1 = table_nuri1.df\n",
    "            try:\n",
    "                if len(uri1.columns) == 3 and uri1.iat[0,0] == \"NamespaceURI\" or uri1.iat[0,0] == \"Namespace\" and uri1.iat[0,2] == \"Use\":\n",
    "                    print(table_nuri1.df, \"\\n----------------------------------------------------------------------\\n\")\n",
    "                    count_nuri = count_nuri + 1\n",
    "                    for nuri in range(1,len(uri1)):\n",
    "                        nsuri = uri1.iat[nuri,0]\n",
    "                        use_ = uri1.iat[nuri,2]\n",
    "                        print(\"NamespaceURI Constraint : The '\" + nsuri +\"' used as in 'title' OPC UA Server is '\" + use_ +\"'.\")\n",
    "                        Ns['Namespace'].append(\"NamespaceURI Constraint : The '\" + nsuri +\"' used as in 'title' OPC UA Server is '\" + use_ +\"'.\")\n",
    "            except:\n",
    "                if len(uri1.columns) != 3:\n",
    "                    print(\"------------------wrong extraction-------------------\")\n",
    "                    ncount_nuri = ncount_nuri + 1\n",
    "                    pass\n",
    "                "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 152,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:33:35.659465Z",
     "start_time": "2021-08-04T07:33:35.632530Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Number of TP namespace metadata and namespace uri table extractions : 2\n"
     ]
    }
   ],
   "source": [
    "print(\"Number of TP namespace metadata and namespace uri table extractions :\",(count_ns1 + count_ns2 + count_nuri))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 153,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:33:36.330674Z",
     "start_time": "2021-08-04T07:33:36.315150Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Number of FP namespace metadata and namespace uri table extractions : 0\n"
     ]
    }
   ],
   "source": [
    "print(\"Number of FP namespace metadata and namespace uri table extractions :\",(ncount_ns1 + ncount_ns2 + ncount_nuri))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 154,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:33:36.866616Z",
     "start_time": "2021-08-04T07:33:36.862615Z"
    }
   },
   "outputs": [],
   "source": [
    "TP_ns = count_ns1 + count_ns2 + count_nuri\n",
    "FP_ns = ncount_ns1 + ncount_ns2 + ncount_nuri"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 156,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:33:37.496261Z",
     "start_time": "2021-08-04T07:33:37.488262Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1.0\n"
     ]
    }
   ],
   "source": [
    "if (TP_ns+FP_ns) == 0:\n",
    "    Precision_ns = 'doesnotexist'\n",
    "\n",
    "else:\n",
    "    Precision_ns = TP_ns /(TP_ns + FP_ns)\n",
    "print(Precision_ns)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 157,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:33:38.256360Z",
     "start_time": "2021-08-04T07:33:38.247362Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Parameter</th>\n",
       "      <th>Value</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Number of TP namespace metadata and namespace ...</td>\n",
       "      <td>2.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Number of FP namespace metadata and namespace ...</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Precision value of namespace tables</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                           Parameter  Value\n",
       "0  Number of TP namespace metadata and namespace ...    2.0\n",
       "1  Number of FP namespace metadata and namespace ...    0.0\n",
       "2                Precision value of namespace tables    1.0"
      ]
     },
     "execution_count": 157,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "nseval = pd.DataFrame({'Parameter':[\"Number of TP namespace metadata and namespace uri table extractions\",\n",
    "                                   \"Number of FP namespace metadata and namespace uri table extractions \",\"Precision value of namespace tables\"],\n",
    "                       'Value':[TP_ns,FP_ns,Precision_ns]})\n",
    "nseval"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 158,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:33:41.006766Z",
     "start_time": "2021-08-04T07:33:41.002178Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "                                           Namespace\n",
      "0  Namespacemetadata:'http://opcfoundation.org/UA...\n",
      "1  Namespacemetadata:'http://opcfoundation.org/UA...\n",
      "2  Namespacemetadata:'http://opcfoundation.org/UA...\n",
      "3  NamespaceURI Constraint : The 'http://opcfound...\n",
      "4  NamespaceURI Constraint : The 'Local Server UR...\n",
      "5  NamespaceURI Constraint : The 'http://opcfound...\n",
      "6  NamespaceURI Constraint : The 'Vendor specific...\n"
     ]
    }
   ],
   "source": [
    "df_9 = pd.DataFrame(Ns)\n",
    "print(df_9.head(10))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "##### Profile URI tables"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "- 'prof','notprof' - list type - variables with a list of strings that help to filter and extract profile URI type tables from all the 'tables'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 182,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:33:43.524873Z",
     "start_time": "2021-08-04T07:33:43.521321Z"
    }
   },
   "outputs": [],
   "source": [
    "prof = [\"Profile\",\"Related Category\",\"Profile URI\", \"URI\"]\n",
    "notprof = [\"NamespaceURI\",\"Namespace Index\",\"Conformance Unit / Profile Title\",\"Group\",\"Optional\",\"Profile/Facets\"]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 183,
   "metadata": {},
   "outputs": [],
   "source": [
    "Put = {'ProfileURITables': []}"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 185,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:34:00.656870Z",
     "start_time": "2021-08-04T07:34:00.641375Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Profile-URI Constraint : For the Profile named 'Basic Vision System Server Facet' has the following URI 'http://opcfoundation.org/UA-Profile/External/Server/ \n",
      "MachineVision/BasicVisionSystemServerFacet'.\n",
      "Profile-URI Constraint : For the Profile named 'Inline Vision System Server Facet' has the following URI 'http://opcfoundation.org/UA-Profile/External/Server/ \n",
      "MachineVision/InlineVisionSystemServerFacet'.\n",
      "Profile-URI Constraint : For the Profile named 'Automatic Mode Server Facet' has the following URI 'http://opcfoundation.org/UA-Profile/External/Server/ \n",
      "MachineVision/AutomaticModeServerFacet'.\n",
      "Profile-URI Constraint : For the Profile named 'Processing Times Server Facet' has the following URI 'http://opcfoundation.org/UA-Profile/External/Server/ \n",
      "MachineVision/ProcessingTimesMetaDataHandlingServerFacet'.\n",
      "Profile-URI Constraint : For the Profile named 'File Transfer Server Facet' has the following URI 'http://opcfoundation.org/UA-Profile/External/Server/ \n",
      "MachineVision/FileTransferServerFacet'.\n",
      "Profile-URI Constraint : For the Profile named 'Basic Result Handling Server Facet' has the following URI 'http://opcfoundation.org/UA-Profile/External/Server/ \n",
      "MachineVision/BasicResultHandlingServerFacet'.\n",
      "Profile-URI Constraint : For the Profile named 'Inline Result Handling Server Facet' has the following URI 'http://opcfoundation.org/UA-Profile/External/Server/ \n",
      "MachineVision/InlineResultHandlingServerFacet'.\n",
      "Profile-URI Constraint : For the Profile named 'Full Result Handling Server Facet' has the following URI 'http://opcfoundation.org/UA-Profile/External/Server/ \n",
      "MachineVision/FullResultHandlingServerFacet'.\n",
      "Profile-URI Constraint : For the Profile named 'Standard Configuration Handling \n",
      "Server Facet' has the following URI 'http://opcfoundation.org/UA-Profile/External/Server/ \n",
      "MachineVision/StandardConfigurationHandlingServerFacet'.\n",
      "Profile-URI Constraint : For the Profile named 'Full Configuration Handling Server \n",
      "Facet' has the following URI 'http://opcfoundation.org/UA-Profile/External/Server/ \n",
      "MachineVision/FullConfigurationHandlingServerFacet'.\n",
      "Profile-URI Constraint : For the Profile named 'Standard Recipe Handling Server Facet' has the following URI 'http://opcfoundation.org/UA-Profile/External/Server/ \n",
      "MachineVision/StandardRecipeHandlingServerFacet'.\n"
     ]
    }
   ],
   "source": [
    "count_prof1 = 0\n",
    "ncount_prof1 = 0\n",
    "for table_prof1 in tables:                                                 # select only tables which contain at least one of the key word\n",
    "    if any(n in table_prof1.df for n in prof):\n",
    "        if not any(n in table_prof1.df for n in notprof):\n",
    "            prof1 = table_prof1.df\n",
    "            try:\n",
    "                if len(prof1.columns) == 2 and prof1.iat[0,0] == \"Profile\" and prof1.iat[0,1] == \"Profile URI\" or prof1.iat[0,1] == \"URI\":\n",
    "                    \n",
    "                    #print(table_prof1.df, \"\\n----------------------------------------------------------------------\\n\")\n",
    "                    count_prof1 = count_prof1 + 1\n",
    "                    \n",
    "                    for p1 in range(1,len(prof1)):\n",
    "                        \n",
    "                        Profile = prof1.iat[p1,0]\n",
    "                        #rel_cat = prof.iat[a,1]\n",
    "                        Uri = prof1.iat[p1,1]\n",
    "                        \n",
    "                        if Profile:\n",
    "                            \n",
    "                            print(\"Profile-URI Constraint : For the Profile named '\"+ Profile + \"' has the following URI '\"+ Uri + \"'.\")\n",
    "                            Put['ProfileURITables'].append(\"For the Profile named '\"+ Profile + \"' has the following URI '\"+ Uri + \"'.\")\n",
    "                        else:\n",
    "                            print(\"No more Profile names are mentioned further.\")\n",
    "                            Put['ProfileURITables'].append(\" \")\n",
    "                            \n",
    "            except:\n",
    "                if len(prof1.columns) != 2:\n",
    "                    ncount_prof1 = ncount_prof1 + 1\n",
    "                    print(\"-----------------------wrong extraction-------------------------\")\n",
    "                    pass"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 186,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:34:01.356009Z",
     "start_time": "2021-08-04T07:34:01.298010Z"
    }
   },
   "outputs": [],
   "source": [
    "count_prof2 = 0\n",
    "ncount_prof2 = 0\n",
    "for table_prof2 in tables:\n",
    "                                                     # select only tables which contain at least one of the key word\n",
    "    if any(s in (table_prof2.df).astype(str) for s in prof):\n",
    "        if not any(s in (table_prof2.df).astype(str) for s in notprof):\n",
    "            prof2 = table_prof2.df\n",
    "            try:\n",
    "                if len(prof2.columns) == 3 and prof2.iat[0,2] == \"URI\":\n",
    "                    #print(table_prof2.df, \"\\n----------------------------------------------------------------------\\n\")\n",
    "                    count_prof2 = count_prof2 + 1\n",
    "            \n",
    "                    for p2 in range(1,len(prof2)):\n",
    "                    \n",
    "                        Profile = prof2.iat[p2,0]\n",
    "                        rel_cat = prof.iat[p2,1]\n",
    "                        Uri = prof.iat[p2,2]\n",
    "                \n",
    "                        if Profile:\n",
    "                            print(\"For the Profile named '\"+ Profile + \"' belonging to the related category '\" + rel_cat +\n",
    "                                  \"' has the following URI '\"+ Uri + \"'.\")\n",
    "                            Put['ProfileURITables'].append(\"For the Profile named '\"+ Profile + \"' belonging to the related category '\" + rel_cat +\n",
    "                                  \"' has the following URI '\"+ Uri + \"'.\")\n",
    "                        else:\n",
    "                            print(\"No more Profile names are mentioned further.\")\n",
    "                            Put['ProfileURITables'].append(\" \")\n",
    "            except:\n",
    "                if len(prof2.columns) != 3:\n",
    "                    ncount_prof2 = ncount_prof2 + 1\n",
    "                    print(\"---------------------wrong extraction-----------------------\")\n",
    "                    pass"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 187,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:34:05.719155Z",
     "start_time": "2021-08-04T07:34:05.713155Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "TP Values of ProfileURI tables extracted 3\n",
      "FP Values of ProfileURI tables extracted 0\n"
     ]
    }
   ],
   "source": [
    "print(\"TP Values of ProfileURI tables extracted\",(count_prof1 + count_prof2))\n",
    "TP_prof = (count_prof1 + count_prof2)\n",
    "print(\"FP Values of ProfileURI tables extracted\",(ncount_prof1 + ncount_prof2))\n",
    "FP_prof = (ncount_prof1 + ncount_prof2)\n",
    "\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 188,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:34:06.510660Z",
     "start_time": "2021-08-04T07:34:06.506659Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1.0\n"
     ]
    }
   ],
   "source": [
    "if (TP_prof+FP_prof) == 0:\n",
    "    Precision_prof = 'doesnotexist'\n",
    "\n",
    "else:\n",
    "    Precision_prof = TP_prof /(TP_prof+FP_prof)\n",
    "print(Precision_prof)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 189,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:49:51.623255Z",
     "start_time": "2021-08-04T07:49:51.611289Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Parameter</th>\n",
       "      <th>Value</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>TP Values of ProfileURI tables extracted</td>\n",
       "      <td>3.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>FP Values of ProfileURI tables extracted</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Precision value for Profile URI tables extracted</td>\n",
       "      <td>1.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "                                          Parameter  Value\n",
       "0          TP Values of ProfileURI tables extracted    3.0\n",
       "1          FP Values of ProfileURI tables extracted    0.0\n",
       "2  Precision value for Profile URI tables extracted    1.0"
      ]
     },
     "execution_count": 189,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "Prof_eval = pd.DataFrame({'Parameter':['TP Values of ProfileURI tables extracted',\n",
    "                                        'FP Values of ProfileURI tables extracted','Precision value for Profile URI tables extracted',\n",
    "                                        ],\n",
    "                           'Value':[TP_prof,FP_prof,Precision_prof]})\n",
    "Prof_eval"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 190,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:50:09.098188Z",
     "start_time": "2021-08-04T07:50:09.091188Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "                                    ProfileURITables\n",
      "0  For the Profile named 'Basic Vision System Ser...\n",
      "1  For the Profile named 'Inline Vision System Se...\n",
      "2  For the Profile named 'Automatic Mode Server F...\n",
      "3  For the Profile named 'Processing Times Server...\n",
      "4  For the Profile named 'File Transfer Server Fa...\n"
     ]
    }
   ],
   "source": [
    "df_10 = pd.DataFrame(Put)\n",
    "print(df_10.head())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 226,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-08-04T07:49:33.630395Z",
     "start_time": "2021-08-04T07:49:33.624391Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Total number of target tables of required table types correctly extracted: 144\n"
     ]
    }
   ],
   "source": [
    "Total  = (TP_OVTypedef + TP_ref + TP_mad + TP_dstr + Count_enum + TP_mrc + count_mp + count_trans + TP_ns + TP_prof)\n",
    "print('Total number of target tables of required table types correctly extracted:',Total)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 191,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2021-07-20T19:51:09.696923Z",
     "start_time": "2021-07-20T19:51:09.693920Z"
    }
   },
   "outputs": [],
   "source": [
    "# Pulling data to excel file\n",
    "\n",
    "with ExcelWriter(\"Example_extracted_ConstraintOutput.xlsx\") as wb:\n",
    "  df_1.to_excel(wb, sheet_name = 'Object Type Definition', index = False)\n",
    "  df_2.to_excel(wb, sheet_name = 'Reference Type Table',header = ['Symmetric = False or Symmetric = True'],index=False)\n",
    "  df_3.to_excel(wb, sheet_name = 'Method Address Space Definition', header= ['HasProperty'], index=False)\n",
    "  df_4.to_excel(wb, sheet_name ='Data Type',index =False)\n",
    "  df_5.to_excel(wb, sheet_name ='Enumeration type',index =False)\n",
    "  df_6.to_excel(wb, sheet_name ='Method Results',index =False)\n",
    "  df_7.to_excel(wb, sheet_name ='Method Parameter Type',index =False)\n",
    "  df_8.to_excel(wb, sheet_name ='TransitionType',index =False)\n",
    "  df_9.to_excel(wb, sheet_name ='NameSpace',index =False)\n",
    "  df_10.to_excel(wb, sheet_name ='Profile URI Tables',index =False)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 193,
   "metadata": {},
   "outputs": [],
   "source": [
    "wb.close()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "hide_input": false,
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.7"
  },
  "latex_envs": {
   "LaTeX_envs_menu_present": true,
   "autoclose": false,
   "autocomplete": true,
   "bibliofile": "biblio.bib",
   "cite_by": "apalike",
   "current_citInitial": 1,
   "eqLabelWithNumbers": true,
   "eqNumInitial": 1,
   "hotkeys": {
    "equation": "Ctrl-E",
    "itemize": "Ctrl-I"
   },
   "labels_anchors": false,
   "latex_user_defs": false,
   "report_style_numbering": false,
   "user_envs_cfg": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}