Skip to content

Commit

Permalink
Add technology type hierarchy
Browse files Browse the repository at this point in the history
Signed-off-by: Mandy Chessell <[email protected]>
  • Loading branch information
mandy-chessell committed Dec 15, 2024
1 parent 03ea25a commit 796b6ec
Show file tree
Hide file tree
Showing 48 changed files with 1,283 additions and 335 deletions.
2 changes: 1 addition & 1 deletion EgeriaContentPacksGUIDMap.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content-packs/APIsContentPack.omarchive

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content-packs/ApacheAtlasContentPack.omarchive

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content-packs/ApacheKafkaContentPack.omarchive

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content-packs/CocoBusinessSystemsArchive.omarchive

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content-packs/CocoClinicalTrialsTemplatesArchive.omarchive

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content-packs/CocoComboArchive.omarchive

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content-packs/CocoGovernanceProgramArchive.omarchive

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content-packs/CocoOrganizationArchive.omarchive

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content-packs/CocoSustainabilityArchive.omarchive

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content-packs/CocoTypesArchive.omarchive

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content-packs/CoreContentPack.omarchive

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content-packs/ObservabilityContentPack.omarchive

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content-packs/PostgresContentPack.omarchive

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion content-packs/UnityCatalogContentPack.omarchive

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -629,54 +629,57 @@ AssetLineageGraphNode getAssetLineageGraphNode(String

for (Relationship relationship : relationships)
{
if ((relationship != null) && (lineageRelationshipTypeNames.contains(relationship.getType().getTypeDefName())))
if (relationship != null)
{

String end1AnchorGUID = this.getAnchorGUID(relationship.getEntityOneProxy(), assetHandler);
String end2AnchorGUID = this.getAnchorGUID(relationship.getEntityTwoProxy(), assetHandler);

if (assetGUID.equals(end1AnchorGUID))
String relationshipName = this.getRelationshipName(relationship, assetHandler.getRepositoryHelper());
if (lineageRelationshipTypeNames.contains(relationshipName))
{
if (assetGUID.equals(end2AnchorGUID))
{
internalRelationship.add(relationship);
}
else
{
List<String> currentRelationshipNames = downstreamAssets.get(relationship.getEntityTwoProxy().getGUID());
String end1AnchorGUID = this.getAnchorGUID(relationship.getEntityOneProxy(), assetHandler);
String end2AnchorGUID = this.getAnchorGUID(relationship.getEntityTwoProxy(), assetHandler);

if (currentRelationshipNames == null)
if (assetGUID.equals(end1AnchorGUID))
{
if (assetGUID.equals(end2AnchorGUID))
{
currentRelationshipNames = new ArrayList<>();
internalRelationship.add(relationship);
}

if (! currentRelationshipNames.contains(relationship.getType().getTypeDefName()))
else
{
currentRelationshipNames.add(relationship.getType().getTypeDefName());
}
List<String> currentRelationshipNames = downstreamAssets.get(relationship.getEntityTwoProxy().getGUID());

downstreamAssets.put(end2AnchorGUID, currentRelationshipNames);
downstreamRelationships.add(relationship);
if (currentRelationshipNames == null)
{
currentRelationshipNames = new ArrayList<>();
}

if (! currentRelationshipNames.contains(relationshipName))
{
currentRelationshipNames.add(relationshipName);
}

downstreamAssets.put(end2AnchorGUID, currentRelationshipNames);
downstreamRelationships.add(relationship);
}
}
}
else
{
if (assetGUID.equals(end2AnchorGUID))
else
{
List<String> currentRelationshipNames = upstreamAssets.get(relationship.getEntityTwoProxy().getGUID());

if (currentRelationshipNames == null)
if (assetGUID.equals(end2AnchorGUID))
{
currentRelationshipNames = new ArrayList<>();
}
List<String> currentRelationshipNames = upstreamAssets.get(relationship.getEntityTwoProxy().getGUID());

if (! currentRelationshipNames.contains(relationship.getType().getTypeDefName()))
{
currentRelationshipNames.add(relationship.getType().getTypeDefName());
}
if (currentRelationshipNames == null)
{
currentRelationshipNames = new ArrayList<>();
}

if (! currentRelationshipNames.contains(relationshipName))
{
currentRelationshipNames.add(relationshipName);
}

upstreamAssets.put(end1AnchorGUID, currentRelationshipNames);
upstreamRelationships.add(relationship);
upstreamAssets.put(end1AnchorGUID, currentRelationshipNames);
upstreamRelationships.add(relationship);
}
}
}
}
Expand All @@ -693,6 +696,40 @@ AssetLineageGraphNode getAssetLineageGraphNode(String
}


/**
* Extract the name of the relationship from a relationship.
*
* @param relationship relationship to query
* @param repositoryHelper repository helper to extract properties
* @return relationship name
*/
private String getRelationshipName(Relationship relationship,
OMRSRepositoryHelper repositoryHelper)
{
final String methodName = "getRelationshipName";

/*
* The default name is the type name
*/
String relationshipName = relationship.getType().getTypeDefName();

/*
* If the relationship has a label then this is used to embellish the relationship name.
*/
String label = repositoryHelper.getStringProperty(instanceHandler.getServiceName(),
OpenMetadataProperty.LABEL.name,
relationship.getProperties(),
methodName);

if (label != null)
{
relationshipName = label + " [" + relationshipName + "]";
}

return relationshipName;
}


/**
* Retrieve the asset anchorGUID from an entity proxy. It is possible that the anchor guid of the proxy is not an
* asset. (for example, it may be the asset's schema type) Therefore it is necessary to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ private void awardKarmaPoints(InstanceHeader contribution)
ActorProfileElement personalProfile = instance.getActorProfileHandler().getActorProfileForUser(serverUserId,
contributingUserId,
userParameterName,
OpenMetadataType.PERSON.typeName,
OpenMetadataType.ACTOR_PROFILE.typeName,
false,
false,
new Date(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public enum UnityCatalogDeployedImplementationType implements DeployedImplementa
* A function found in Unity Catalog (UC) that is working with data.
*/
OSS_UC_FUNCTION("Unity Catalog Function",
null,
DeployedImplementationType.SOFTWARE_COMPONENT,
OpenMetadataType.DEPLOYED_API.typeName,
null,
"A function found in Unity Catalog (UC) that is working with data.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public enum EngineServiceDescription
"Executes requested governance action services to monitor, assess and maintain metadata and its " +
"real-world counterparts.",
"https://egeria-project.org/services/omes/governance-action/overview/",
AccessServiceDescription.GOVERNANCE_ENGINE_OMAS.getAccessServiceFullName(),
AccessServiceDescription.GOVERNANCE_SERVER_OMAS.getAccessServiceFullName(),
DeployedImplementationType.GOVERNANCE_ACTION_ENGINE.getAssociatedTypeName(),
DeployedImplementationType.GOVERNANCE_ACTION_SERVICE_CONNECTOR.getAssociatedTypeName(),
DeployedImplementationType.GOVERNANCE_ACTION_ENGINE.getDeployedImplementationType(),
Expand Down Expand Up @@ -75,7 +75,7 @@ public enum EngineServiceDescription
"context-event",
"Executes requested context event services to monitor, assess and maintain context events.",
"https://egeria-project.org/services/omes/context-event/overview/",
AccessServiceDescription.GOVERNANCE_ENGINE_OMAS.getAccessServiceFullName(),
AccessServiceDescription.STEWARDSHIP_ACTION_OMAS.getAccessServiceFullName(),
DeployedImplementationType.CONTEXT_EVENT_ENGINE.getAssociatedTypeName(),
DeployedImplementationType.CONTEXT_EVENT_SERVICE_CONNECTOR.getAssociatedTypeName(),
DeployedImplementationType.CONTEXT_EVENT_ENGINE.getDeployedImplementationType(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2613,13 +2613,13 @@ protected String removeDistinguishedName(InstanceProperties instanceProperties)
* @param instanceProperties properties from entity
* @return ordinal or 0 for not specified
*/
protected int removeKarmaPoints(InstanceProperties instanceProperties)
protected long removeKarmaPoints(InstanceProperties instanceProperties)
{
final String methodName = "removeKarmaPoints";

if (instanceProperties != null)
{
return repositoryHelper.removeIntProperty(serviceName,
return repositoryHelper.removeLongProperty(serviceName,
OpenMetadataProperty.KARMA_POINTS.name,
instanceProperties,
methodName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ public AssetGraphMermaidGraphBuilder(AssetGraph assetGraph)
String currentNodeName = assetGraph.getElementHeader().getGUID();
String currentDisplayName = assetGraph.getProperties().getDisplayName();

appendMermaidNode(mermaidGraph,
currentNodeName,
appendMermaidNode(currentNodeName,
currentDisplayName,
assetGraph.getElementHeader().getType().getTypeName());

Expand Down Expand Up @@ -62,8 +61,7 @@ public AssetGraphMermaidGraphBuilder(AssetGraph assetGraph)

if (!usedNodeNames.contains(currentNodeName))
{
appendMermaidNode(mermaidGraph,
currentNodeName,
appendMermaidNode(currentNodeName,
currentDisplayName,
node.getElementHeader().getType().getTypeName());

Expand All @@ -76,12 +74,9 @@ public AssetGraphMermaidGraphBuilder(AssetGraph assetGraph)
{
if (line != null)
{
mermaidGraph.append(this.removeSpaces(line.getEnd1().getGUID()));
mermaidGraph.append("-->|");
mermaidGraph.append(line.getType().getTypeName());
mermaidGraph.append("|");
mermaidGraph.append(this.removeSpaces(line.getEnd2().getGUID()));
mermaidGraph.append("\n");
super.appendMermaidLine(this.removeSpaces(line.getEnd1().getGUID()),
line.getType().getTypeName(),
this.removeSpaces(line.getEnd2().getGUID()));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ public AssetLineageGraphMermaidGraphBuilder(AssetLineageGraph assetLineageGraph)
String currentNodeName = assetLineageGraph.getElementHeader().getGUID();
String currentDisplayName = assetLineageGraph.getProperties().getDisplayName();

appendMermaidNode(mermaidGraph,
currentNodeName,
appendMermaidNode(currentNodeName,
currentDisplayName,
assetLineageGraph.getElementHeader().getType().getTypeName());

Expand Down Expand Up @@ -64,8 +63,7 @@ public AssetLineageGraphMermaidGraphBuilder(AssetLineageGraph assetLineageGraph)

if (!usedNodeNames.contains(currentNodeName))
{
appendMermaidNode(mermaidGraph,
currentNodeName,
appendMermaidNode(currentNodeName,
currentDisplayName,
node.getElementHeader().getType().getTypeName());

Expand All @@ -78,12 +76,9 @@ public AssetLineageGraphMermaidGraphBuilder(AssetLineageGraph assetLineageGraph)
{
if (line != null)
{
mermaidGraph.append(line.getEnd1AssetGUID());
mermaidGraph.append("-->|");
mermaidGraph.append(this.getListLabel(line.getRelationshipTypes()));
mermaidGraph.append("|");
mermaidGraph.append(line.getEnd2AssetGUID());
mermaidGraph.append("\n");
super.appendMermaidLine(line.getEnd1AssetGUID(),
this.getListLabel(line.getRelationshipTypes()),
line.getEnd2AssetGUID());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/* SPDX-License-Identifier: Apache-2.0 */
/* Copyright Contributors to the ODPi Egeria project. */

package org.odpi.openmetadata.commonservices.mermaid;


/**
* Creates a mermaid graph rendering of a hierarchy. It relies on the caller to add the nodes and lines
*/
public class HierarchyMermaidGraphBuilder extends MermaidGraphBuilderBase
{
/**
* Construct a mermaid markdown graph.
*
* @param title title of graph
* @param displayName displayName of the starting element
* @param startingGUID guid of the starting element
*/
public HierarchyMermaidGraphBuilder(String title,
String startingGUID,
String displayName)
{
mermaidGraph.append("---\n");
mermaidGraph.append("title: ");
mermaidGraph.append(title);
mermaidGraph.append(" - ");
mermaidGraph.append(displayName);
mermaidGraph.append(" [");
mermaidGraph.append(startingGUID);
mermaidGraph.append("]\n---\nflowchart TD\n%%{init: {\"flowchart\": {\"htmlLabels\": false}} }%%\n\n");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class MermaidGraphBuilderBase
* @param labelValues array of labels
* @return string value without square brackets (Mermaid does not allow them)
*/
String getListLabel(List<String> labelValues)
public String getListLabel(List<String> labelValues)
{
if (labelValues != null)
{
Expand Down Expand Up @@ -46,15 +46,13 @@ String getListLabel(List<String> labelValues)
/**
* Create a node in the mermaid graph.
*
* @param mermaidGraph current state of the graph
* @param currentNodeName unique name/identifier
* @param currentDisplayName display name
* @param currentType type of element
*/
void appendMermaidNode(StringBuilder mermaidGraph,
String currentNodeName,
String currentDisplayName,
String currentType)
public void appendMermaidNode(String currentNodeName,
String currentDisplayName,
String currentType)
{
mermaidGraph.append(this.removeSpaces(currentNodeName));
mermaidGraph.append("(\"`*");
Expand All @@ -65,6 +63,35 @@ void appendMermaidNode(StringBuilder mermaidGraph,
}


/**
* Append a line to the graph.
*
* @param end1Id identifier of the starting end
* @param label label for the line
* @param end2Id identifier of the ending end
*/
public void appendMermaidLine(String end1Id,
String label,
String end2Id)
{
mermaidGraph.append(this.removeSpaces(end1Id));

if (label != null)
{
mermaidGraph.append("-->|");
mermaidGraph.append(label);
mermaidGraph.append("|");
}
else
{
mermaidGraph.append("-->");
}

mermaidGraph.append(this.removeSpaces(end2Id));
mermaidGraph.append("\n");
}


/**
* Remove all the spaces from the qualifiedName along with the curly braces - found in the templates.
*
Expand Down
Loading

0 comments on commit 796b6ec

Please sign in to comment.