Like many of you, I’ve been experimenting with ChatGTP from Open AI. Much of my day job consists of working on, and with, Accord Project Concerto — a data modelling language. It was therefore natural to see whether I could get ChatGPT to assist in defining a data model.

The results were very impressive; ChatGPT is Swiss Army Knife you can apply to many text generation tasks; teaching it by providing example inputs and desired responses.

To get the ball-rolling I instruct OpenAI that we are going to be teaching it the rules of a game, by way of examples (thank you to Crista Lopes for the inspiration):

Dan: I’m going to teach you how to play a game. In this game, I will prompt you a message and you need to reply something based on that message. I will teach you the rules of the reply by example. Are you ready?

OpenAI: Yes, I am ready to learn how to play the game. Please provide me with an example message and the corresponding rule for my reply.

I then rather pedantically provide some example inputs and expected outputs. ChatGPT does an amazing job at generalising from the examples and generating syntactically valid output text, including spotting errors, or requesting clarifications.

Dan: When I say "create a model xyz" you should reply with "namespace xyz"

OpenAI: I understand. If you say "create a model xyz," my reply should be "namespace xyz." Is there anything else you would like to add?

Dan: yes, "xyz" could be any word.

OpenAI: I understand. If you say "create a model" followed by any word, my reply should be "namespace" followed by that same word. Is there anything else you would like to add or clarify?

Dan: let's test it. create namespace org.acme

OpenAI: namespace org.acme

Dan: well done!

OpenAI: Thank you! I'm glad I was able to understand and follow the instructions correctly. Is there anything else you would like me to do?

Dan: when I say "create concept Person" you should reply with "concept Person {" when "Person" could be any word.

OpenAI: I understand. If you say "create concept" followed by any word, my reply should be "concept" followed by that same word, and then " {" .Is there anything else you would like to add or clarify?

Dan: When I say "end concept" you should reply with "}"

OpenAI: I understand. If you say "end concept," my reply should be "}". Is there anything else you would like to add or clarify?

Dan: When I say "define property" followed by a type name and the name of the property you should rely with "o " followed by the type name and the name of the property. For example, if I say, "define property Integer age" you should reply with "o Integer age"

OpenAI: I understand. If you say "define property" followed by a type name and the name of the property, my reply should be "o" followed by the type name and the name of the property, as in "o Integer age" if the type name is "Integer" and the property name is "age". Is there anything else you would like to add or clarify?

Dan: Let's test!

OpenAI: Sure! Please provide me with a statement to test.

Dan: create model loans

OpenAI: namespace loans

Dan: create concept Loan

OpenAI: concept Loan {

Dan: define property Long amount

OpenAI: o Long amount

Dan: define property Person borrower

OpenAI: o Person borrower

Dan: end concept

OpenAI: }

Dan: create a model contact with a concept Human with a property firstName of type String

OpenAI: namespace contact
concept Human {
o String firstName
}

Dan: Well done!

OpenAI: Thank you! I'm glad I was able to understand and follow the instructions correctly. Is there anything else you would like me to do?


Dan: create a model healthcare with the following properties: firstName of type String, lastName of type String, age of type Integer, address of type Address.

OpenAI: I'm sorry, I didn't understand your instruction correctly, In the last statement you've mentioned "address of type Address" but you haven't defined any concept or property called "Address" yet. Do you want me to create a concept or property called Address?

Dan: yes please

OpenAI: namespace healthcare
concept Patient {
o String firstName
o String lastName
o Integer age
concept Address {
}
}
Please let me know if I am mistaken or if there's anything else I can help with.


Dan: create a model healthcare with two concepts: Address and Patient. The Address concept has the following properties: line1, line2, city, state, zip (all of the properties are of type String). The Patient concept has the following properties: firstName of type String, lastName of type String, age of type Integer, address of type Address.

OpenAI: namespace healthcare
concept Address {
o String line1
o String line2
o String city
o String state
o String zip
}
concept Patient {
o String firstName
o String lastName
o Integer age
o Address address
}
Please let me know if there's anything else I can help with or if I have misunderstood your instructions.


Dan: excellent!

OpenAI: Thank you! I'm glad I was able to understand and follow the instructions correctly. Is there anything else you would like me to do?


Dan: when I say "create a concept Person identified by a property xyz" you should reply with "concept Person identified by xyz" where "Person" and "xyz" could be any word but "xyz" must be a property of the concept.

OpenAI: I understand. If you say "create a concept" followed by any word "Person" and "identified by a property" followed by any word "xyz" you want me to reply with "concept" followed by the same word "Person" and "identified by" followed by the same word "xyz" where "xyz" must be a property of the concept. Is there anything else you would like to add or clarify?


Dan: let's test!

OpenAI: Sure, please provide me with a statement to test.

Dan: create a concept Vehicle identified by vin

OpenAI: concept Vehicle identified by vin

Dan: create a model dvla with a concept Vehicle identified by vin with properties: vin, color, make, model, purchaseDate, where all properties are of type String, except for purchaseDate which is of type DateTime.

OpenAI: namespace dvla
concept Vehicle identified by vin {
o String vin
o String color
o String make
o String model
o DateTime purchaseDate
}
Please let me know if there's anything else I can help with or if I have misunderstood your instructions.

What’s clear is that the way we think about some types of “programming” (essentially data transformation) will be transformed by generative AI.

Onwards!