Skip to main content

Add custom relationships between resources

As you add resources in the system, it is important to establish how they are related to each other to make the data more usable. The system allows out-of-the-box relationships between certain resources and also allows you to extend and build these relationships using the MDP.

Why would I do this?

The system comes with the following out-of the-box relationships between resources.

The first column in the table represents the resource you are viewing and the subsequent columns indicate whether or not it has a default relationship configured for that target resource type. For example, from the business term page, you can relate to Analysis, Columns, Tables, and datasets.

Table 1.

Resource View

Analysis

Business term

Column

Dataset

Table

Data type

Analysis

No

Yes

No

Yes

Yes

No

Business Term

Yes

No

Yes

Yes

Yes

No

Column

No

Yes

No

No

No

No

Dataset

Yes

Yes

No

No

Yes

No

Data type

No

Yes

Yes (contact data.world support team for additional details)

No

No

No

Table

Yes

Yes

Yes

Yes

No

No

Custom resources

No

No

No

No

No

No



Use the MDP to add custom relationships between resources that are not related out-of-the-box. Use the following guidelines to plan custom relationships between the resources.

  • Identify the resources you want to relate.

  • Identify if the relationship is bi-directional.

  • Identify the title of the section for displaying the relationship.

  • Identify if you need custom relationship type.

After completing Steps 1-6 in this section, you will see following options on the UI:

add_relationship.png
relationship01.png

Establish a custom relationship type for the two resources.

custom_relationship_type.png

Note

The tasks in this section assume that you have already added the following custom business glossary subtypes in your organization - Metrics, Acronym, Reference codes, and Data attributes.

STEP 1: Add the relationship section

  • Use the following syntax to specify the relationship section on the resource page.

    :RelationshipSection
      rdf:type                dwec:RelationshipSection ;
      rdfs:label              "Relationship Section" ;
      dwec:inMetadataProfile  :MetadataProfileDefault ;
    .

STEP 2: Define the relationship presentation to display in the section

  • Use the following syntax to define which two resource are you defining the relationship for. In this case we are defining a relationship between the two glossary sub types - Acronym and Metric and we are saying that Acronym is related to Metrics.

    :AcronymToMetric
      rdf:type                    dwec:RelationshipPresentation ;
      dwec:inRelationshipSection  :RelationshipSection ;
    .
    
    :AcronymToMetric
      dwec:forType                :Acronym ;
    .
    
    :AcronymToMetric
      dwec:forTargetType          :Metric ;
    .
    
    
    :AcronymToMetric
      dwec:forRelationshipType    dwec:related ;
    .

STEP 3: Customize the header for the relationship section

  • Customize the title of the relationship section. In this particular example, we are defining Acronym is referenced by Metric.

    :AcronymToMetric
      dwec:relationshipTerm       [
        rdf:type      dwec:RelationshipTerm ;
        rdfs:label    "is referenced by" ;
        label:plural  "are referenced by" ;
      ] ;
      dwec:resourceTerm [
        rdf:type      dwec:ResourceTerm ;
        rdfs:label    "Metric" ;
        label:plural  "Metrics" ;
      ] ;
    .
    
    # ---

STEP 5: Make the relationship bi-directional

Use the following syntax to make it a bi-directional relationship. Here we are defining that the Acronym can be referenced by the Metric.

:MetricToAcronym
  rdf:type                    dwec:RelationshipPresentation ;
  dwec:inRelationshipSection  :RelationshipSection ;
  dwec:forType                :Metric ;
  dwec:forTargetType          :Acronym ;
  

dwec:forRelationshipType    [ dwec:inversePath dwec:related ] ;
  dwec:relationshipTerm       [
    rdf:type      dwec:RelationshipTerm ;
    rdfs:label    "references" ;
    label:plural  "reference" ;
  ] ;
  dwec:resourceTerm [
      rdf:type      dwec:ResourceTerm ;
      rdfs:label    "Acronym" ;
      label:plural  "Acronyms" ;
  ] ;
.

STEP 6: Use the following syntax to add a custom relationship type

This is how it shows in the UI.

custom_relationship_type.png
:MetricToAcronymCustom
  rdf:type                    dwec:RelationshipPresentation ;
  dwec:inRelationshipSection  :RelationshipSection ;
  dwec:forType                :Metric ;
  dwec:forTargetType          :Acronym ;

 
  dwec:forRelationshipType    :custom ;
  dwec:relationshipTerm       [
    rdf:type      dwec:RelationshipTerm ;
    rdfs:label    "custom relates" ;
    label:plural  "custom relate" ;
  ] ;
  dwec:resourceTerm [
      rdf:type      dwec:ResourceTerm ;
      rdfs:label    "Acronym" ;
      label:plural  "Acronyms" ;
  ] ;
.

:custom a owl:ObjectProperty .

Sample syntax for adding second relationship

Use the following syntax to build a relationship between two more glossary sub types - Reference codes and Data attributes

We will make this a single direction relation only. ie. from Data attribute page you will be able to relate to Reference codes, but from Reference code page you will not be able to relate to Data attributes.

:DataAttributeToReferenceCode
  rdf:type                    dwec:RelationshipPresentation ;
  dwec:inRelationshipSection  :RelationshipSection ;
.


:DataAttributeToReferenceCode
  dwec:forType                :DataAttribute ;
.


:DataAttributeToReferenceCode
  dwec:forTargetType          :ReferenceCode ;
.



:DataAttributeToReferenceCode
  dwec:forRelationshipType    dwec:related ;
.


:DataAttributeToReferenceCode
  dwec:relationshipTerm       [
    rdf:type      dwec:RelationshipTerm ;
    rdfs:label    "is referenced by" ;
    label:plural  "are referenced by" ;
  ] ;
  dwec:resourceTerm [
    rdf:type      dwec:ResourceTerm ;
    rdfs:label    "Reference Code" ;
    label:plural  "Reference Codes" ;
  ] ;
.

Sample syntax for relating Metrics and Reference codes.

# And now specify a new `dwec:RelationshipPresentation` in that section.

:MetricToReferenceCode
rdf:type                    dwec:RelationshipPresentation ;
dwec:inRelationshipSection  :RelationshipSection ;
.


:MetricToReferenceCode
dwec:forType                :Metric ;
.


:MetricToReferenceCode
dwec:forTargetType          :ReferenceCode ;
.


:MetricToReferenceCode
dwec:forRelationshipType    dwec:related ;
.


:MetricToReferenceCode
dwec:relationshipTerm       [
rdf:type      dwec:RelationshipTerm ;
rdfs:label    "is so referenced by" ;
label:plural  "are so referenced by" ;
] ;
dwec:resourceTerm [
rdf:type      dwec:ResourceTerm ;
rdfs:label    "Reference Code" ;
label:plural  "Reference Codes" ;
] ;
.

Complete syntax for both relationships

The following is the complete syntax for adding both custom relationship sections.

# Sample sytax for first relationship

:RelationshipSection
  rdf:type                dwec:RelationshipSection ;
  rdfs:label              "Relationship Section" ;
  dwec:inMetadataProfile  :MetadataProfileDefault ;
.

:AcronymToMetric
  rdf:type                    dwec:RelationshipPresentation ;
  dwec:inRelationshipSection  :RelationshipSection ;
.

:AcronymToMetric
  dwec:forType                :Acronym ;
.


:AcronymToMetric
  dwec:forTargetType          :Metric ;
.


:AcronymToMetric
  dwec:forRelationshipType    dwec:related ;
.

:AcronymToMetric
  dwec:relationshipTerm       [
    rdf:type      dwec:RelationshipTerm ;
    rdfs:label    "is referenced by" ;
    label:plural  "are referenced by" ;
  ] ;
  dwec:resourceTerm [
    rdf:type      dwec:ResourceTerm ;
    rdfs:label    "Metric" ;
    label:plural  "Metrics" ;
  ] ;
.



:MetricToAcronym
  rdf:type                    dwec:RelationshipPresentation ;
  dwec:inRelationshipSection  :RelationshipSection ;
  dwec:forType                :Metric ;
  dwec:forTargetType          :Acronym ;
  
  
  dwec:forRelationshipType    [ dwec:inversePath dwec:related ] ;
  dwec:relationshipTerm       [
    rdf:type      dwec:RelationshipTerm ;
    rdfs:label    "references" ;
    label:plural  "reference" ;
  ] ;
  dwec:resourceTerm [
      rdf:type      dwec:ResourceTerm ;
      rdfs:label    "Acronym" ;
      label:plural  "Acronyms" ;
  ] ;
.

:custom a owl:ObjectProperty .

:MetricToAcronymCustom
  rdf:type                    dwec:RelationshipPresentation ;
  dwec:inRelationshipSection  :RelationshipSection ;
  dwec:forType                :Metric ;
  dwec:forTargetType          :Acronym ;

 
  dwec:forRelationshipType    :custom ;
  dwec:relationshipTerm       [
    rdf:type      dwec:RelationshipTerm ;
    rdfs:label    "custom relates" ;
    label:plural  "custom relate" ;
  ] ;
  dwec:resourceTerm [
      rdf:type      dwec:ResourceTerm ;
      rdfs:label    "Acronym" ;
      label:plural  "Acronyms" ;
  ] ;
.
# Sample syntax for second relationship.

:DataAttributeToReferenceCode
  rdf:type                    dwec:RelationshipPresentation ;
  dwec:inRelationshipSection  :RelationshipSection ;
.


:DataAttributeToReferenceCode
  dwec:forType                :DataAttribute ;
.


:DataAttributeToReferenceCode
  dwec:forTargetType          :ReferenceCode ;
.


:DataAttributeToReferenceCode
  dwec:forRelationshipType    dwec:related ;
.



:DataAttributeToReferenceCode
  dwec:relationshipTerm       [
    rdf:type      dwec:RelationshipTerm ;
    rdfs:label    "is referenced by" ;
    label:plural  "are referenced by" ;
  ] ;
  dwec:resourceTerm [
    rdf:type      dwec:ResourceTerm ;
    rdfs:label    "Reference Code" ;
    label:plural  "Reference Codes" ;
  ] ;
.

Sample syntax for relating custom resources with a glossary subtype

Use the following syntax to establish a relationship between the custom resource - Bank accounts you added earlier with the glossary subtype - Reference codes.

:BankAccountsToReferenceCode
  rdf:type                    dwec:RelationshipPresentation ;
  dwec:inRelationshipSection  :RelationshipSection ;
.


:BankAccountsToReferenceCode
  dwec:forType                :BankAccounts ;
.


:BankAccountsToReferenceCode
  dwec:forTargetType          :ReferenceCode ;
.


:BankAccountsToReferenceCode
  dwec:forRelationshipType    dwec:related ;
.



:BankAccountsToReferenceCode
  dwec:relationshipTerm       [
    rdf:type      dwec:RelationshipTerm ;
    rdfs:label    "is referenced by" ;
    label:plural  "are referenced by" ;
  ] ;
  dwec:resourceTerm [
    rdf:type      dwec:ResourceTerm ;
    rdfs:label    "Reference Code" ;
    label:plural  "Reference Codes" ;
  ] ;
.