Round-tripping text via RDF with an LLM

I’ve been curious if LLMs like ChatGPT can create usual symbolic representations of plain text. So, I embarked on an experiment to turn some random text (the Palantir CEO’s letter to investors) into RDF. I wanted to find out how well we could preserve the text’s essence in RDF, making it easy to recreate the original text without losing its core meaning.

Here’s a prompt I came up with. For the record it took me 5 mins to create it, and I’m sure it could have been guided better with a little more care. But still, I’m fascinated to see the potential of this kind of transformation and representation of ideas.

You are an Ontology Engineer. I will give you some text, and I want you to convert it to RDF. The RDF should avoid literals, preferring instead to define resources that signify types where it makes sense. Where new properties are used, please also provide their OWL definitions. Do not write any explanations. My first piece of text is “In Q4 2022, we earned a profit of $31 million.
Our commitment to and relentless focus on the long term at times has required patience. At other times, as our profitability demonstrates, we will deliver results at a rate that surpasses even the expectations of those who believed that we would prevail.
A threshold has been crossed, and this is the start of our next chapter.
We expect to generate a profit for the current fiscal year, our first profitable year in the history of our company.
This moment is significant and demonstrates to a broader audience the magnitude of the potential of our business, which is only now being revealed.“.

The sample text is from the annual results of Palantir. Here’s what chatgpt produced. Doubtless it could have been done more cleanly and abstractly, but I’m still fairly impressed by it.

@prefix ex: <http://example.org/> .
@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#> .
# Individuals
ex:Company a ex:Business ;
    ex:hasProfit ex:Profit_2022, ex:Profit_2023 ;
    ex:hasCommitment ex:LongTermFocus ;
    ex:hasChapter ex:NextChapter ;
    ex:hasSignificantMoment ex:ProfitableYear .
ex:Profit_2022 a ex:Profit ;
    ex:amount 31000000 ;
    ex:year "2022"^^xsd:gYear .
ex:Profit_2023 a ex:Profit ;
    ex:amount 0 ;  # Placeholder for Q4 2023 profit
    ex:year "2023"^^xsd:gYear .
ex:LongTermFocus a ex:Commitment .
ex:NextChapter a ex:Chapter .
ex:ProfitableYear a ex:ProfitYear ;
    ex:year "2023"^^xsd:gYear .
# Object Properties
ex:hasProfit a owl:ObjectProperty ;
    rdfs:domain ex:Business ;
    rdfs:range ex:Profit .
ex:hasCommitment a owl:ObjectProperty ;
    rdfs:domain ex:Business ;
    rdfs:range ex:Commitment .
ex:hasChapter a owl:ObjectProperty ;
    rdfs:domain ex:Business ;
    rdfs:range ex:Chapter .
ex:hasSignificantMoment a owl:ObjectProperty ;
    rdfs:domain ex:Business ;
    rdfs:range ex:ProfitYear .
# Data Properties
ex:amount a owl:DatatypeProperty ;
    rdfs:range xsd:decimal .
ex:year a owl:DatatypeProperty ;
    rdfs:range xsd:gYear .

I then asked it to convert the RDF back into text in the voice of a marketing expert, to see how much of the meaning had been preserved in the RDF.

Now convert that RDF back into text in the style of a marketing expert.

And here’s the result, which I’m sure you’ll agree does a passable job of reproducing not only the meaning but the tone of the original text.

Certainly! Here’s the RDF information from the previous representation rephrased in a marketing style:

“At the heart of our operations is a thriving business, embarking on a journey towards success. In the last quarter of 2022, we achieved an impressive profit milestone, amounting to a substantial $31 million. This feat underscores our unwavering commitment to the long-term vision we hold dear.

Our dedication to the future has been a testament to patience and resilience. It’s not just about meeting expectations; it’s about exceeding them. As reflected in our profitability, we’ve not only prevailed but have done so at a pace that astonishes even our staunchest supporters.

This marks a pivotal moment – the beginning of an exciting new chapter in our story. We’re excited to share that we anticipate achieving profitability for the current fiscal year. This would mark a historic milestone – our first-ever profitable year in the annals of our company’s history.

This moment is not just significant; it’s a revelation of the incredible potential that our business holds. The magnitude of our success is becoming increasingly evident, and we’re just getting started.”

This text captures the essence of the RDF information provided earlier, emphasizing the business’s achievements and its promising future.

I think you’ll agree that this marketing material is just as good as the original, if not better. And that makes me wonder what this might mean for authorship in future. Not only does this mean we can usefully store the essence of our content, in a form that might be reused, remixed and restyled. We can also regenerate that material on demand in the style required.

A future form of content negotiation might allow us to view the web in a way that is comfortable to our sensibilities. Today I might prefer a high energy motivational style, while other days I might prefer calmer or less persuasive content when I read.

Where else could this lead?