Skip to main content

Make fields and resources read-only (MDP)

Why would I do this?

Sometimes, the information in your catalog may have an outside source, and you should not change it on data.world. If you want to stop changes to specific property or entire categories of resources on the data.world website, you can set up a source of record and define what specific fields (both custom and out-of-the-box) or resources cannot be edited within data.world.

What can I make read-only?

Using this feature you can make the following objects read-only:

  • Custom resource pages

  • Glossary pages

  • Custom fields

  • Following out-of-the box fields

    Table 1.

    Field Title

    Field Property in TTL

    Title

    dct:title

    Description

    dct:description

    Summary

    dct:abstract

    Status

    dwec:hasAssetStatus

    Tags

    dwec:textTag



What is not supported:

  • You cannot use this feature to make Relationships and Collections fields read-only.

Example for read-only out-of-the-box fields:

read-only-oob.png

Example for read-only custom fields:

read_only_custom_fields.png

Example for read-only resource page:

read-only-custom-resources.png

Step 1: Make custom fields read-only

  • Use the following code to make a custom field read-only.

    This example demonstrates how to create a new type of glossary terms, Credit cards and a custom field Official definition for this type. Lastly, the example establishes a source of truth for the field Official definition and sets it as read-only to prevent future modifications via web applications or public APIs. We do this by adding the custom field property (in this example, orgprofile:dictionaryDefinition) to dwec:selectByProperty.

    @prefix orgprofile:  <https://trainstudentg.linked.data.world/d/ddw-catalogs/>.
    @prefix rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
    @prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
    @prefix owl:  <http://www.w3.org/2002/07/owl#> .
    @prefix label: <http://purl.org/net/vocab/2004/03/label#> .
    @prefix dwec:  <https://dwec.data.world/v0/> .
    @prefix dct:  <http://purl.org/dc/terms/> .
    
    # Create new type of business term, "Credit cards"
    orgprofile:Card a owl:Class ;
      rdfs:subClassOf dwec:BusinessTerm ;
      rdfs:label "Credit card" ;
      label:plural "Credit cards" ;
    .
    
    # Create a custom field for the business terms - credit cards
    orgprofile:MetadataPresentation-BusinessTerm-dictionaryDefinition
      rdf:type                dwec:MetadataPresentation ;
      rdfs:label              "Official definition" ;
      dwec:inMetadataSection  orgprofile:MetadataSectionSidebar ;
      dwec:viaProperty        orgprofile:dictionaryDefinition ;
      dwec:forType            orgprofile:Card ;
    .
    
    # Allow it to be visible via the public API
    orgprofile:ApiBinding-BusinessTerm-dictionaryDefinition
      rdf:type          dwec:ApiBinding ;
      dwec:forProperty  orgprofile:dictionaryDefinition ;
      dct:identifier    "dictionaryDefinition" ;
    
      dwec:forType      orgprofile:Card ;
    .
    
    ############### MAKE THE CUSTOM FIELDS READ-ONLY ###############
    
    # Create a source of truth:
    orgprofile:Dictionary a dwec:Source ;
      dct:title "Official 8Bank terms" ;
    .
    
    # Register that the Official defintion for business terms has 
    # an official source of record and should not be editable via the
    # web application or public API
    orgprofile:DictionaryRegistration a dwec:SourceRegistration ;
        dwec:registersSource orgprofile:Dictionary ;
    
        dwec:hasSourceOfRecordSelector [ a dwec:Selector ;
           dwec:selectByClass orgprofile:Card ;
          #dwec:selectByClass dwec:BusinessTerm ;
    
          dwec:selectByProperty orgprofile:dictionaryDefinition;
        ] ;
    .
    
    orgprofile: dwec:hasSourceRegistration orgprofile:DictionaryRegistration .

View the results

The read-only custom field appears in the UI.

read_only_custom_fields.png

STEP 2: Make out-of-the-box fields read-only

Use the following code to make an out-of-the-box field read-only. You can make the following out-of-the-box fields read-only.

Table 2.

Field Title

Field Property in TTL

Title

dct:title

Description

dct:description

Summary

dct:abstract

Status

dwec:hasAssetStatus

Tags

dwec:textTag



This example expands on the one from STEP 1. Here, we set the default fields (Title, Description, and Status) to read-only. We do this by adding dct:title, dwec:hasAssetStatus, dct:description to dwec:selectByProperty.

@prefix orgprofile:  <https://trainstudentg.linked.data.world/d/ddw-catalogs/>.
@prefix rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl:  <http://www.w3.org/2002/07/owl#> .
@prefix label: <http://purl.org/net/vocab/2004/03/label#> .
@prefix dwec:  <https://dwec.data.world/v0/> .
@prefix dct:  <http://purl.org/dc/terms/> .

# Create new type of business term, "Credit cards"
orgprofile:Card a owl:Class ;
  rdfs:subClassOf dwec:BusinessTerm ;
  rdfs:label "Credit card" ;
  label:plural "Credit cards" ;
.

# Create a custom field for the business terms - credit cards
orgprofile:MetadataPresentation-BusinessTerm-dictionaryDefinition
  rdf:type                dwec:MetadataPresentation ;
  rdfs:label              "Official definition" ;
  dwec:inMetadataSection  orgprofile:MetadataSectionSidebar ;
  dwec:viaProperty        orgprofile:dictionaryDefinition ;
  dwec:forType            orgprofile:Card ;
.

# Allow it to be visible via the public API
orgprofile:ApiBinding-BusinessTerm-dictionaryDefinition
  rdf:type          dwec:ApiBinding ;
  dwec:forProperty  orgprofile:dictionaryDefinition ;
  dct:identifier    "dictionaryDefinition" ;

  dwec:forType      orgprofile:Card ;
.
############### MAKE THE OUT-OF-THE-BOX FIELDS READ-ONLY ###############

# Create a source of truth:
orgprofile:Dictionary a dwec:Source ;
  dct:title "Official 8Bank terms" ;
.

# Register that the Official defintion for business terms has 
# an official source of record and should not be editable via the
# web application or public API
orgprofile:DictionaryRegistration a dwec:SourceRegistration ;
    dwec:registersSource orgprofile:Dictionary ;

    dwec:hasSourceOfRecordSelector [ a dwec:Selector ;
      dwec:selectByClass orgprofile:Card ;
      # dwec:selectByClass dwec:BusinessTerm ;
      dwec:selectByProperty orgprofile:dictionaryDefinition, dct:title, dwec:hasAssetStatus, dct:description ;
    ] ;
.

orgprofile: dwec:hasSourceRegistration orgprofile:DictionaryRegistration .

View the results

The read-only out-of-the-box fields appear in the UI.

read-only-oob.png

STEP 3: Make entire resources read-only

Use the following code to make all resources of a given type read-only.

This example demonstrates how to create a new resource type, Bank accounts, and also how to establish a resource named Savings Accounts, Checking Account, and Savings Accounts in UK for this type. Lastly, the example establishes a source of truth for these resource types and sets them as read-only to prevent future modifications via the data.world web applications or public API.

@prefix orgprofile:  <https://trainstudentg.linked.data.world/d/ddw-catalogs/> .
@prefix :  <https://trainstudentg.linked.data.world/d/ddw-catalogs/> .
@prefix rdf:  <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl:  <http://www.w3.org/2002/07/owl#> .
@prefix xsd:  <http://www.w3.org/2001/XMLSchema#> .
@prefix label: <http://purl.org/net/vocab/2004/03/label#> .
@prefix foaf:  <http://xmlns.com/foaf/0.1/> .
@prefix dwec-database: <https://dwec.data.world/v0/database-types/> .
@prefix dwec-jdbc: <https://dwec.data.world/v0/jdbc-types/> .
@prefix dwec:  <https://dwec.data.world/v0/> .
@prefix dct:  <http://purl.org/dc/terms/> .
@prefix prov: <http://www.w3.org/ns/prov#> .
@prefix database-types:  <https://dwec.data.world/v0/database-types/> .
@prefix jdbc-types:  <https://dwec.data.world/v0/jdbc-types/> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix csvw:   <http://www.w3.org/ns/csvw#>.
@prefix dcat:   <http://www.w3.org/ns/dcat#>.
@prefix dwe:  <https://entities.data.world/> .

# #### Add collection
:banking-system
  a               dwec:Catalog ;
  dct:identifier  "banking system" ;
  dct:title       "banking system" ;
  dct:description "All about our banking system" ;
  dct:issued      "2020-02-17T21:41:17.675Z"^^xsd:dateTime ;
  dct:modified    "2020-02-17T21:41:17.675Z"^^xsd:dateTime ;
dcat:record
    :CatalogRecord-SavingsAccount ,
    :CatalogRecord-CheckingAccount ,
    :CatalogRecord-MileageCreditCard ;
    
    .

# Add Bank accounts with saving accounts and checking account in it.

:BankAccount a owl:Class ;
    rdfs:label "Bank account" ;
    label:plural "Bank accounts" ;
.

:BankEmojiIcon
  rdf:type dwec:EmojiIcon ;
  dwec:iconGlyph "🏦"
.
:BankResourceTypeIconMapping a dwec:ResourceTypeIconMapping ;
  dwec:hasIconKey :BankEmojiIcon ;
  dwec:hasIconResourceType :BankAccount ;
.

# Adding savings account

:BankAccount-SavingsAccount  rdf:type    :BankAccount ;
        dct:identifier   "SavingsAccount" ;
        rdfs:label       "Savings Accounts" ;
        dct:title        "Savings Accounts" ;
        dct:description  "A description of my Savings Accounts." ;
.

:CatalogRecord-SavingsAccount
        rdf:type           dcat:CatalogRecord ;
        dct:issued         "2019-11-11T04:01:25.865Z"^^xsd:dateTime ;
        dct:modified       "2020-11-11T04:18:18.871Z"^^xsd:dateTime ;
        foaf:primaryTopic  :BankAccount-SavingsAccount .

 # Adding savings account for UK

 :UKEmojiIcon
  rdf:type dwec:EmojiIcon ;
  dwec:iconGlyph "🇬🇧" .
   

:BankAccount-SavingsAccountUK  rdf:type    :BankAccount ;
        dct:identifier   "SavingsAccountUK" ;
        rdfs:label       "Savings Accounts in UK" ;
        dct:title        "Savings Accounts in UK" ;
        dct:description  "A description of my Savings Accounts in UK." ;
        dwec:hasIconKey	 :UKEmojiIcon 
.

:CatalogRecord-SavingsAccount
        rdf:type           dcat:CatalogRecord ;
        dct:issued         "2019-11-11T04:01:25.865Z"^^xsd:dateTime ;
        dct:modified       "2020-11-11T04:18:18.871Z"^^xsd:dateTime ;
        foaf:primaryTopic  :BankAccount-SavingsAccountUK .

# Adding checking account

:BankAccount-CheckingAccount  rdf:type    :BankAccount ;
        dct:identifier   "CheckingAccount" ;
        rdfs:label       "Checking Accounts" ;
        dct:title        "Checking Accounts" ;
        dct:description  "A description of my Checking Accounts." ;
.


:CatalogRecord-CheckingAccount
        rdf:type           dcat:CatalogRecord ;
        dct:issued         "2019-11-11T04:01:25.865Z"^^xsd:dateTime ;
        dct:modified       "2020-11-11T04:18:18.871Z"^^xsd:dateTime ;
        foaf:primaryTopic  :BankAccount-CheckingAccount .


# Adding credit cards with Mileage Credit Card in it.

# Add credit card

:CreditCard a owl:Class ;

    rdfs:label "Credit card" ;
    label:plural "Credit cards" ;
.

:CreditEmojiIcon
  rdf:type dwec:EmojiIcon ;
  dwec:iconGlyph "💰"
.
:CreditResourceTypeIconMapping a dwec:ResourceTypeIconMapping ;
  dwec:hasIconKey :CreditEmojiIcon ;
  dwec:hasIconResourceType :CreditCard ;
.

 

# Add Mileage credit card to credit card

:CreditCard-MileageCreditCard  rdf:type    :CreditCard ;
        dct:identifier   "MileageCreditCard" ;
        rdfs:label       "Mileage Credit Card" ;
        dct:title        "Mileage Credit Card" ;
        dct:description  "A description of Mileage Credit Card." ;
.


:CatalogRecord-MileageCreditCard
        rdf:type           dcat:CatalogRecord ;
        dct:issued         "2019-11-11T04:01:25.865Z"^^xsd:dateTime ;
        dct:modified       "2021-11-11T04:18:18.871Z"^^xsd:dateTime ;
        foaf:primaryTopic  :CreditCard-MileageCreditCard .


############### MAKE THE RESOURCE TYPE READ-ONLY ###############
# Create a source of truth for :BankAccount resources
orgprofile:BankingSystem a dwec:Source ;
  dct:title "Banking System" ;
.

# Register that all :BankAccount resources terms have an external
# source of record and should not be editable via the
# web application or public API.
orgprofile:BankAccountRegistration a dwec:SourceRegistration ;

  # Anything selected by this registration is defined by this source
  dwec:registersSource orgprofile:BankingSystem ;

  # This is how we identify what resources and properties should match
  # the source
  dwec:hasSourceOfRecordSelector [ a dwec:Selector ;
    dwec:selectByClass orgprofile:BankAccount ;
  ] ;
.

orgprofile: dwec:hasSourceRegistration orgprofile:BankAccountRegistration .

View the results

The read-only resource will appear in the UI.

read-only-custom-resources.png