ChatGPT Exercises — Generating a Course Description Knowledge Graph using RDF
I stumbled upon a post by Harald Sack about his upcoming Knowledge Graph course. Naturally, this presented an opportunity to test the RDF generating capabilities of ChatGPT.
What follows is a ChatGPT session dump, best viewed using the OpenLink Structured Data Sniffer (OSDS) Browser Extension[1][2][3], that produces Knowledge Graphs generated using both RDF-Turtle and JSON-LD notations from course description text yanked out of a webpage.
Prompt
Generate an RDF rendition of the following using Turtle Notation, terms from Schema.org, and hash-based relative hyperlinks for subject and object denotation. Use a single code-block for response output.
Knowledge Graphs — Foundations and Applications
Prof. Dr. Harald Sack
Introduction
Even though it affects our lives every single day, most of us have no idea what a knowledge graph is. Asking Alexa about the weather tomorrow or searching for the latest news on climate change via Google, knowledge graphs constitute the backbone of today’s state-of-the-art information systems. From improving search results over question answering and recommender systems up to explainable AI systems, the applications of knowledge graphs are manyfold. Overall, the goal of this course is to provide a broad overview of knowledge graphs and their underlying technologies as well as their significance in today’s digital world.
October 11, 2023 — November 21, 2023
Language: English
Big Data and AI, ExpertCourse information
A knowledge graph is a structured representation of knowledge that is used to provide a comprehensive and interconnected view of a specific domain. In this course we will discuss the key features and characteristics of knowledge graphs. You will learn all what is necessary to design, implement, and apply knowledge graphs. The focus of this course will be on basic semantic technologies including the underlying principles of knowledge representation and symbolic AI. This includes information encoding via RDF triples, knowledge representation via ontologies with OWL, efficiently querying knowledge graphs via SPARQL, latent representation of knowledge in vector spaces, as well as knowledge graph applications in innovative information systems, as e.g., semantic and exploratory search. Furthermore the role of knowledge graphs in artificial intelligence and machine learning will be discussed, as well as their potential to improve explainability and trustworthiness of “black box” deep learning models.
What you’ll learn
Basic understanding of knowledge graphs
Basic understanding of ontologies
Basic understanding of Semantic Web Technologies
Who this course is for
students
practitioners of computer science, digital humanities, and information sciences
enthusiasts with an AI related background and an interest in symbolic knowledge representation
Response
## Turtle Start ##
@prefix schema: <https://schema.org/> .
@prefix kg: <#> .kg:KnowledgeGraph a schema:Course ;
schema:name "Knowledge Graphs - Foundations and Applications" ;
schema:about "A knowledge graph is a structured representation of knowledge that is used to provide a comprehensive and interconnected view of a specific domain. In this course we will discuss the key features and characteristics of knowledge graphs. You will learn all what is necessary to design, implement, and apply knowledge graphs. The focus of this course will be on basic semantic technologies including the underlying principles of knowledge representation and symbolic AI. This includes information encoding via RDF triples, knowledge representation via ontologies with OWL, efficiently querying knowledge graphs via SPARQL, latent representation of knowledge in vector spaces, as well as knowledge graph applications in innovative information systems, as e.g., semantic and exploratory search. Furthermore the role of knowledge graphs in artificial intelligence and machine learning will be discussed, as well as their potential to improve explainability and trustworthiness of black box deep learning models." ;
schema:inLanguage "English" ;
schema:startDate "2023-10-11" ;
schema:endDate "2023-11-21" ;
schema:educationalLevel "Expert" ;
schema:knowsAbout [
schema:name "Ontologies"
], [
schema:name "Semantic Web Technologies"
], [
schema:name "Knowledge Representation"
] ;
schema:teaches [
schema:name "Basic understanding of knowledge graphs"
], [
schema:name "Basic understanding of ontologies"
], [
schema:name "Basic understanding of Semantic Web Technologies"
] ;
schema:audience [
schema:name "students"
], [
schema:name "practitioners of computer science, digital humanities, and information sciences"
], [
schema:name "enthusiasts with an AI related background and an interest in symbolic knowledge representation"
] .## Turtle End ##
## JSON-LD Start ##
{
"@context": "https://schema.org/",
"@type": "Course",
"name": "Knowledge Graphs - Foundations and Applications",
"about": "A knowledge graph is a structured representation of knowledge that is used to provide a comprehensive and interconnected view of a specific domain. In this course we will discuss the key features and characteristics of knowledge graphs. You will learn all what is necessary to design, implement, and apply knowledge graphs. The focus of this course will be on basic semantic technologies including the underlying principles of knowledge representation and symbolic AI. This includes information encoding via RDF triples, knowledge representation via ontologies with OWL, efficiently querying knowledge graphs via SPARQL, latent representation of knowledge in vector spaces, as well as knowledge graph applications in innovative information systems, as e.g., semantic and exploratory search. Furthermore the role of knowledge graphs in artificial intelligence and machine learning will be discussed, as well as their potential to improve explainability and trustworthiness of black box deep learning models.",
"inLanguage": "English",
"startDate": "2023-10-11",
"endDate": "2023-11-21",
"educationalLevel": "Expert",
"knowsAbout": [
{
"@type": "Text",
"name": "Ontologies"
},
{
"@type": "Text",
"name": "Semantic Web Technologies"
},
{
"@type": "Text",
"name": "Knowledge Representation"
}
],
"teaches": [
{
"@type": "Text",
"name": "Basic understanding of knowledge graphs"
},
{
"@type": "Text",
"name": "Basic understanding of ontologies"
},
{
"@type": "Text",
"name": "Basic understanding of Semantic Web Technologies"
}
],
"audience": [
{
"@type": "Text",
"name": "students"
},
{
"@type": "Text",
"name": "practitioners of computer science, digital humanities, and information sciences"
},
{
"@type": "Text",
"name": "enthusiasts with an AI related background and an interest in symbolic knowledge representation"
}
]
}
## JSON-LD End ##
Task Screenshots
ChatGPT RDF-Turtle Generation Response
ChatGPT RDF-Turtle Generation Response viewed using OSDS
ChatGPT JSON-LD Generation Response
ChatGPT JSON-LD Generation Response viewed using OSDS
Uploading Generated Knowledge Graph to a DBMS that supports SPARQL
In addition to discovering and visualizing RDF-based Knowledge Graphs embedded in webpages, OSDS also offers upload functionality to any SPARQL endpoint that supports SPARQL INSERTs.
Here’s how the ChatGPT generated knowledge graph is uploaded to the Virtuoso Instance behind our public URIBurner Service.
[1] Select RDF-Notation matching what’s generated in the ChatGPT Response Code Block e.g., RDF-Turtle and/or JSON-LD as per the example used in this post
[2] Initialize OSDS by clicking on its “doggie” icon
[3] Goto the “Download from Cloud” icon and click on it
[4] From the drop-down presented, select “Upload to SPARQL Endpoint”
[5] If you so desire, replace the default SPARQL Endpoint URL presented by replacing it with your preferred alternative
[6] If you so desire, replace the default destination Named Graph Identifier presented by replacing it with your preferred alternative
[7] Click OK to commence upload to your selected SPARQL endpoint
[8] Explore the newly created Knowledge Graph via the SPARQL Query Solution Page automatically generated by OSDS
Conclusion
As this post demonstrates, taking the tedium out of RDF generation is a productivity boosting benefit of ChatGPT that’s immediately usable as part of any Knowledge Graph familiarization and/or utilization effort.
Related Exercises
- ChatGPT Prompt Collection — from my Personal Data Space
- Other ChatGPT Prompt & Nanotations related demo exercises — from my Personal Data Space (an ODS-Briefcase Instance)
- General ChatGPT demo exercises collection — from Personal Data Space
- ChatGPT generating a Job Postings Knowledge Graph — Screencast Demo
- ChatGPT generating a HowTo Knowledge Graph — Screencast Demo
OpenLink Data Sniffer (OSDS) Browser Extension Links
- Google Chrome Store for Chromium-based Browsers
- Mozilla Store for Firefox 1
- Mac App Store for Safari 1
- Github Open Source Repository