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

CTM: when you prompt GPT to generate SPARQL, if the natural language question is expressed in Chinese, it usually defaults to add @zh sign and related code, then the desired result cannot be retrieved #48

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

Comments

@candlecao
Copy link
Contributor

candlecao commented Jan 25, 2025

e.g.,
NLQ: 《越南闲愁》涉及到什么音乐类型(乐种)、乐器、民族?

PREFIX ctm: <https://lib.ccmusic.edu.cn/ontologies/chinese_traditional_music#>
PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT ?musicTypeLabel ?instrumentLabel ?ethnicGroupLabel
WHERE {
  # Link the resource "越南闲愁" with SpecialIndependentResource
  ?resource rdfs:label "越南闲愁"@zh ;
            ctm:relatesMusicType ?musicType ;
            ctm:relatesInstrument ?instrument ;
            ctm:relatesEthnicGroup ?ethnicGroup .

  # Get labels for music type, instrument, and ethnic group
  ?musicType rdfs:label ?musicTypeLabel .
  ?instrument rdfs:label ?instrumentLabel .
  ?ethnicGroup rdfs:label ?ethnicGroupLabel .
  
  # Language filter for Chinese labels
  FILTER (lang(?musicTypeLabel) = "zh")
  FILTER (lang(?instrumentLabel) = "zh")
  FILTER (lang(?ethnicGroupLabel) = "zh")
}

while the expected SPARQL is:

define input:inference 'urn:owl.ccmusicrules'
PREFIX ctm: <https://lib.ccmusic.edu.cn/ontologies/chinese_traditional_music#>
PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>

SELECT ?musicTypeLabel ?instrumentLabel ?ethnicGroupLabel
WHERE {
  # Link the resource "越南闲愁" with SpecialIndependentResource
  ?resource rdfs:label "越南闲愁" ;
            ctm:relatesMusicType ?musicType ;
            ctm:relatesInstrument ?instrument ;
            ctm:relatesEthnicGroup ?ethnicGroup .

  # Get labels for music type, instrument, and ethnic group
  ?musicType rdfs:label ?musicTypeLabel .
  ?instrument rdfs:label ?instrumentLabel .
  ?ethnicGroup rdfs:label ?ethnicGroupLabel .
}
@candlecao candlecao self-assigned this Jan 25, 2025
@candlecao candlecao changed the title CTM: if the natural language question is expressed in Chinese, and you prompt GPT to generate SPARQL, it usually defaults to add @zh sign and related code, then the desired result cannot be retrieved CTM: when you prompt GPT to generate SPARQL, if the natural language question is expressed in Chinese, it usually defaults to add @zh sign and related code, then the desired result cannot be retrieved Jan 25, 2025
@candlecao
Copy link
Contributor Author

We can add labels with @zh in the future

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

No branches or pull requests

1 participant