v3 - core_al_app_provider_summary.xsl

Post Reply
scotto
Posts: 2
Joined: 28 Jul 2011, 22:18

In the Application Provider Summary report, I believe that there is an incorrect slot reference at line 1603 wherein the logical process is identified through a physical process. The slot "apppro_to_physbus_to_busproc" does not exist in the class Physical_Process. I believe the correct slot to reference is "implements_business_process".

Code: Select all

		<!-- <xsl:variable name="logicalProc" select="$allLogicalBusProcs[name = $physProcess/own_slot_value[slot_reference='apppro_to_physbus_to_busproc']/value]" /> -->
		<xsl:variable name="logicalProc" select="$allLogicalBusProcs[name = $physProcess/own_slot_value[slot_reference='implements_business_process']/value]" />
User avatar
jonathan.carter
Posts: 1087
Joined: 04 Feb 2009, 15:44

Thanks very much for your post.

That does indeed look like a bug and you have indeed identified the correct slot. However, we have noticed that there are some other incorrect slot references in this section.
We will update this and make it part of the next minor release of Essential Architecture Manager.

Thanks again

Jonathan
Essential Project Team
scotto
Posts: 2
Joined: 28 Jul 2011, 22:18

After finding the slot inconsistency, I looked at slots described as deprecated in the model vs. their usage in the reports and found 36 references to deprecated slots in 17 reports. I am starting the process of building out my model in v3 and would prefer to avoid using items marked as deprecated. Do you have any suggestions or guidelines on the use of deprecated slots?

Here is the script I used to identify the references.

Code: Select all

import edu.stanford.smi.protege.model
import re
from java.util import HashSet

#
# Report on the deprecated classes and slots in the Essential model
# -- depends upon the Documentation to contain the word "DEPRECATED"
#
# reportDeprecations() - prints the name of reports that contain a reference to a deprecated slot 
# reportDeprecation(reportFileName) - prints offending slots and lines from the report xsl, returns number of offending lines
# getAllDeprected() - populates the deprecatedClasses and deprecatedSlots global variables for all classes and slots
# getDeprecated(className) - populates the deprecatedClasses with this class name if it has been documented as deprecated 
#                            and the deprecatedSlots with referenced slot names that have been documented as deprecated
# 

viewerUrl = "http://localhost:8080/essential_viewer/"
deprecatedClasses = []
deprecatedSlots = []
deprecatedSlotMap = HashSet()

def reportDeprecations() :
	global deprecatedSlots
	global deprecatedClasses
	print "+++++++++++++++++++++++++++++++++++++++++++++++++++++"
	print "Reports that reference deprecated slots"
	print "+++++++++++++++++++++++++++++++++++++++++++++++++++++"
	getAllDeprecated()
	if deprecatedSlots == None and deprecatedClasses == None and len(deprecatedSlot) + len(deprecatedClasses) <= 0 :
		print "no deprecated classes or slots!"
		return
	cls = kb.getCls("Report")
	instances = cls.getInstances()	
	fileSlot = kb.getSlot("report_xsl_filename")
	n = 0
	o = 0
	for instance in instances :
		fileName = instance.getOwnSlotValue(fileSlot)
		if fileName != None :
			m = reportDeprecation(fileName)
			n += m
			if m > 0 : o += 1
	print "+++++++++++++++++++++++++++++++++++++++++++++++++++++"
	print str(n)+" references to deprecated slots found in "+str(o)+" reports."
	print "+++++++++++++++++++++++++++++++++++++++++++++++++++++"

def reportDeprecation(reportFileName) :
	global viewerUrl
	global deprecatedSlots
	global deprecatedClasses
	f = urllib.urlopen(viewerUrl+reportFileName)
	xslLines = re.split("\n",f.read())
	foundSlots = []
	offendingLine = []
	c = 0
	for slot in deprecatedSlots :
		slotString = "'"+slot+"'"
		i = 0
		for line in xslLines :
			i += 1
			t = re.search(slotString,line)
			if t != None :
				c += 1
				foundSlots.append(slot)
				offendingIndex = xslLines.index(line)
				offendingLine.append("["+str(i)+"]"+line)
	if c > 0 :
		print "=============================="
		print reportFileName+" has "+str(c)+" references to deprecated slots:"
		print "=============================="
		i = 0
		for slot in foundSlots :
			print "Slot: "+slot
			print " line"+offendingLine[i]
			i += 1
	return c

def getAllDeprecated():
	global deprecatedSlots
	global deprecatedSlotMap
	allClses = kb.getClses()
	for cls in allClses:
		getDeprecated(cls)
	deprecatedSlots = deprecatedSlotMap.toArray()

def getDeprecated(aClass) :
	global deprecatedSlots
	global deprecatedSlotMap
	global deprecatedClasses
	slts = aClass.getTemplateSlots()
	className = aClass.getBrowserText()
	if className[0] == ":" :
		return
	clsDocs = aClass.getDocumentation()
	for clsDoc in clsDocs :
		if re.search("DEPRECATED",clsDoc) :
			deprecatedClasses.append(className)
		for slt in slts:
			docs = aClass.getTemplateSlotDocumentation(slt)
			for doc in docs :
				if re.search("DEPRECATED",doc) :
					slotName = slt.getBrowserText()
					deprecatedSlotMap.add(slotName)
User avatar
jonathan.carter
Posts: 1087
Joined: 04 Feb 2009, 15:44

Thanks very much for posting this great little script!

Some of the older Views in the out-of-the-box set have been around since before Essential Viewer 3 and were migrated. These may still contain some references to slots that have now been deprecated but it's likely that queries that use these references do not affect the rendering of the View.

We'll use your script and tidy up the out-of-the-box Views.

In terms of building your model, you are correct to avoid the use of slots that have been marked as deprecated. If doing this shows up bugs in any of the Views, we'll take care of that.

Thanks again for your help with identifying these references.

Jonathan
Essential Project Team
User avatar
jonathan.carter
Posts: 1087
Joined: 04 Feb 2009, 15:44

Just spotted something with the script.
I don't know about you (could be my platform) but I needed to add:

Code: Select all

import urllib
at the top of the script. ;)

Thanks again!

Jonathan
Essential Project Team
Post Reply