Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For NLQ "四川扬琴是否有代表性的曲目,这些曲目可能用到了哪些乐器?"(translated as "Does 'Sichuan Yangqin' have representative pieces, and what instruments might be used in these pieces?")--chatGPT cannot generate a perfect SPARQL #41

Open
candlecao opened this issue Jan 18, 2025 · 1 comment
Assignees
Labels

Comments

@candlecao
Copy link
Contributor

candlecao commented Jan 18, 2025

As for this question, the expected entities of OWL are:
{ctm:MusicType ctm:PieceWithPerformance mo:Instrument}
{bf:instrument ctm:representativePiece ctm:samplePieceWithPerformance}

Based on the extracted subgraph of ontology:

@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 ns3: <https://lib.ccmusic.edu.cn/ontologies/chinese_traditional_music#> .
@prefix mo: <http://purl.org/ontology/mo/> .
@prefix ns5: <http://id.loc.gov/ontologies/bibframe/> .

### Classes ###
rdfs:Literal
    rdf:type owl:Class .

mo:Instrument
    rdf:type owl:Class ;
    rdfs:label "乐器" .

ns3:MusicType
    rdf:type owl:Class ;
    rdfs:label "音乐类型(乐种)", "乐种" .

ns3:PieceWithPerformance
    rdf:type owl:Class ;
    rdfs:label "曲目", "演出的曲目", "曲目的演出" ;
    rdfs:comment "对应二次创作,如以具体的表演行为表达的作品" .

### Object Properties ###
ns3:samplePieceWithPerformance
    rdf:type owl:ObjectProperty ;
    rdfs:label "示例曲目的演出" ;
    rdfs:domain mo:Instrument , ns3:MusicType ;
    rdfs:range ns3:PieceWithPerformance ;
    rdfs:comment "关联一个乐器和它的代表曲目,或关联一个乐种和它的代表曲目", "关联一个乐器和它的代表曲目,或关联一个音乐类型(乐种)和它的代表曲目" .

ns3:piecePrincipalInstrument
    rdf:type owl:ObjectProperty ;
    rdfs:label "曲目的主奏乐器有" ;
    rdfs:domain ns3:PieceWithPerformance ;
    rdfs:range mo:Instrument ;
    rdfs:comment "关联一个演出的曲目和它的主奏乐器。'曲目的主奏乐器有'这个属性有时候意义较为宽泛,如同'曲目的主要乐器有'" .

ns5:instrument
    rdf:type owl:ObjectProperty ;
    rdfs:label "曲目的演出使用…乐器" ;
    rdfs:domain ns3:PieceWithPerformance ;
    rdfs:range mo:Instrument ;
    rdfs:comment "关联一部演出的曲目和其演出中使用的乐器" .

### Datatype Properties ###
ns3:representativePiece
    rdf:type owl:DatatypeProperty ;
    rdfs:label "有代表曲目或剧目" ;
    rdfs:domain ns3:MusicType ;
    rdfs:range rdfs:Literal ;
    rdfs:comment "专指乐种或乐器的代表曲目(或剧目),一般用书名号表示(对于曲牌,则用半角中括号表示)" .

ns3:representativeQupai
    rdf:type owl:DatatypeProperty ;
    rdfs:label "有代表曲牌" ;
    rdfs:domain ns3:MusicType ;
    rdfs:range rdfs:Literal ;
    rdfs:comment "指一个乐种或音乐类型的代表性曲牌" .

ns3:nameOfMusicTypeOrInstrument
    rdf:type owl:DatatypeProperty ;
    rdfs:label "音乐类型(乐种)或乐器的名称" ;
    rdfs:domain mo:Instrument , ns3:MusicType ;
    rdfs:range rdfs:Literal ;
    rdfs:comment "指一个'音乐类型(乐种)'的名称,或指一个'乐器'的名称。而对这二者,其名称则不用rdfs:label来表示" .

ChatGPT generated a version of SPARQL:

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 ns3: <https://lib.ccmusic.edu.cn/ontologies/chinese_traditional_music#>
PREFIX mo: <http://purl.org/ontology/mo/>
PREFIX ns5: <http://id.loc.gov/ontologies/bibframe/>

SELECT ?representativePiece ?instrument
WHERE {
  # Find the music type "四川扬琴"(translated as "Sichuan Yangqin")
  ?musicType rdfs:label "四川扬琴" .

  # Check if it has representative pieces
  ?musicType ns3:representativePiece ?representativePiece .

  # Find instruments associated with the representative pieces
  OPTIONAL {
    ?piece rdf:type ns3:PieceWithPerformance ;
           rdfs:label ?representativePiece ;
           ns5:instrument ?instrument .
  }
}
@candlecao candlecao self-assigned this Jan 18, 2025
@candlecao
Copy link
Contributor Author

candlecao commented Jan 18, 2025

Actually the generated SPARQL is not incorrect. We ought not to owe the incompleteness to a malfunction of ChatGPT. Instead, it was due to that "have representative pieces" corresponds to both an objectProperty and a dataProperty:

objectProperty:
:samplePieceWithPerformance
dataProperty:
:representativePiece

however, GPT likely failed to incorporate :samplePieceWithPerformance in SPARQL because the literal meaning of that URI is less closely aligned with "have representative pieces" compared to :representativePiece

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant