I've been trying to add a new Enumeration, let's call it Heatmap_Status, so I add it manually, from Class Browser I click on the Create Class button and update the name of it, and start adding Instances for this class.
But when I try to add Instances with a function:
createTechnology.py
An error pops up:import java
from java.lang import Boolean
from java.lang import Float
from java.text import SimpleDateFormat
defineExternalRepository("External Essential Repository", "External Essential Repository Source")
def createTechnology(productName, productDescription, productVersion, productSupplier, productRole, productStatus, heatmapStatus, heatmapTechnology):
dateFormat = SimpleDateFormat ( "ddMMyyyhhmmssSSS" )
date = dateFormat.format(Date())
theSupplier = getEssentialInstanceContains("Supplier",productSupplier + "_" + date,"External Essential Repository",productSupplier)
theProduct = getEssentialInstanceContains("Technology_Product",productName + "_" + productVersion + "_" + date,"External Essential Repository",productName + " " + productVersion)
setSlot(theProduct, "supplier_technology_product", theSupplier)
aSlotName = "description"
theProduct.setOwnSlotValue(kb.getSlot(aSlotName), productDescription)
aSlotName = "version"
theProduct.setOwnSlotValue(kb.getSlot(aSlotName), productVersion)
theProductRole = getEssentialInstanceContains("Technology_Product_Role",productSupplier + "_" + productName + "_" + productRole + "_" + date,"External Essential Repository", productSupplier + "::" + productName + "::as::" + productRole)
theRole = getEssentialInstanceContains("Technology_Component",productRole + "_" + date,"External Essential Repository",productRole)
theStatus = getEssentialInstanceContains("Lifecycle_Status",productStatus + "_" + date,"External Essential Repository",productStatus)
setSlot(theProductRole, "strategic_lifecycle_status", theStatus)
setSlot(theProductRole, "implementing_technology_component", theRole)
setSlot(theProductRole, "role_for_technology_provider", theProduct)
theHeatmap = getEssentialInstanceContains("Heatmap_status",heatmapStatus + "_" + date, "External Essential Repository", heatmapStatus)
setSlot(theProductRole,"strategic_heatmap_status",theHeatmap)
theFunction = getEssentialInstanceContains("Technology_Function",heatmapTechnology + "_" + date, "External Essential Repository", heatmapTechnology)
setSlot(theProduct, "technology_product_functions_offered", theFunction)
setSlot(theRole, "technology_component_functions_offered", theFunction)
What does "AttributeError: 'NoneType' object has no attribute 'getDirectInstances'" means??Welcome to the Protégé shell
>>> execfile("C:/EssentialAM/RepositoryIntegration/standardFunctions.txt")
>>> execfile("C:/EssentialAM/Python/createTechnology.py")
>>> createTechnology("Windows","Microsoft Windows is a Desktop Operating System","XP","Microsoft","Desktop Operating System","Production","Preferred","Platforms")
Updated instance: Microsoft_160211123115151, Essential name: Microsoft
Updated instance: Windows_XP_160211123115151, Essential name: Windows XP
Created new instance: Microsoft_Windows_Desktop Operating System_160211123115151, Essential name: Microsoft::Windows::as::Desktop Operating System
Updated instance: Desktop Operating System_160211123115151, Essential name: Desktop Operating System
Updated instance: Production_160211123115151, Essential name: Production
Traceback (innermost last):
File "<string>", line 1, in ?
File "C:/EssentialAM/Python/createTechnology.py", line 25, in createTechnology
File "C:/EssentialAM/RepositoryIntegration/standardFunctions.txt", line 159, in getEssentialInstanceContains
AttributeError: 'NoneType' object has no attribute 'getDirectInstances'
exception from Jython: Traceback (innermost last):
File "<string>", line 1, in ?
File "C:/EssentialAM/Python/createTechnology.py", line 25, in createTechnology
File "C:/EssentialAM/RepositoryIntegration/standardFunctions.txt", line 159, in getEssentialInstanceContains
AttributeError: 'NoneType' object has no attribute 'getDirectInstances'
: Traceback (innermost last):
File "<string>", line 1, in ?
File "C:/EssentialAM/Python/createTechnology.py", line 25, in createTechnology
File "C:/EssentialAM/RepositoryIntegration/standardFunctions.txt", line 159, in getEssentialInstanceContains
AttributeError: 'NoneType' object has no attribute 'getDirectInstances'
>>>
Kind regards,
Ana B.