Skip to content

How to extract ontology from a given RDF graph?

Junjun Cao edited this page Apr 3, 2025 · 5 revisions

Refer to https://github.com/DDMAL/linkedmusic-queries/issues/30 and https://github.com/DDMAL/linkedmusic-queries/issues/31 (important)

  • Why do we need ontology?

Because it's useful as a context for prompting LLMs to convert a natural language question to SPARQL (NLQ2SPARQL)

  • What is the essence of needing an ontology?

It's needing a schema or framework to profile the structure of the RDF graph

  • In what occasions can we extract ontology from a given RDF graph?

As long as there are rdf:type values for instance data in RDF graph, which means some instances belong to some classes, we can extract ontology information such as:

@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
<property> rdfs:domain <class1> ;
           rdfs:range <class2> .

Clone this wiki locally