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

Refine the relationship between tune_set and tune (TheSession) #158

Open
candlecao opened this issue Aug 20, 2024 · 6 comments
Open

Refine the relationship between tune_set and tune (TheSession) #158

candlecao opened this issue Aug 20, 2024 · 6 comments
Assignees
Labels
Priority: high high priority

Comments

@candlecao
Copy link
Contributor

candlecao commented Aug 20, 2024

  1. Embody rdf:list in programing.

Check if the sequence of tunes are right in accordance with that in the CSV files.

  1. Check the redundancy of the set.csv file.
  2. Check how to query a list in SPARQL.

Follow/Refer to #142

@candlecao
Copy link
Contributor Author

  1. Check how to query a list in SPARQL.

--If I have a graph with data:

<https://thesession.org/members/1/sets/1> <https://thesession.org/tunes> (
      <https://thesession.org/tunes/560>
      <https://thesession.org/tunes/563>
      <https://thesession.org/tunes/570>
) .

then if I want to check the third value of the list of values for the property <https://thesession.org/tunes>,
the code can be:

SELECT ?thirdValue
WHERE {
  <https://thesession.org/members/1/sets/1> <https://thesession.org/tunes> ?list .
  ?list rdf:rest/rdf:rest/rdf:first ?thirdValue .
}

@fujinaga
Copy link
Member

Are you not supposed to define the predicate that precede the rdf:List of objects that the predicate is expecting a list? Did you do that?

@fujinaga
Copy link
Member

A simpler solution is to use “rdf:type rdf:List” as the predicate, instead.

@candlecao
Copy link
Contributor Author

candlecao commented Aug 21, 2024

Hi, Ich. I don't quite understand your meaning.
I know rdf:list is a class.
May I put it this way:

  1. Bunch 1
<https://thesession.org/members/1/sets/1> <https://thesession.org/tunes> (
      <https://thesession.org/tunes/560>
      <https://thesession.org/tunes/563>
      <https://thesession.org/tunes/570>
) .

--This above is equivalent with:

  1. Bunch 2
@prefix ex: <http://example.org/> .
ex:playlist rdf:type rdf:List ;# Hi Ich, This might be what you mentioned--the simpler solution.
  rdf:first <https://thesession.org/tunes/560> ;
  rdf:rest [
    rdf:first <https://thesession.org/tunes/563> ;
    rdf:rest [
      rdf:first <https://thesession.org/tunes/570> ;
      rdf:rest rdf:nil
    ]
  ] .
<https://thesession.org/members/1/sets/1> <https://thesession.org/tunes> ex:playlist.

To conclude
A concise way to define lists is using parentheses (...) as shown in Bunch 1.
Let's trial this way:

If you import Bunch 1 to Virtuoso, then execute query like
2.1

select * where {?s <https://thesession.org/tunes> ?o}

the result is:
image

2.2

select * where {?s ?p ?o}

the result is:
image

@fujinaga
Copy link
Member

I commented because you said you were having problems finding the "third value of the list." You also posted on Slack a similar question, which I can't find now. Is this issue resolved now?

@candlecao
Copy link
Contributor Author

Finding the "third value of the list." is already solved. See:

SELECT ?thirdValue
WHERE {
  <https://thesession.org/members/1/sets/1> <https://thesession.org/tunes> ?list .
  ?list rdf:rest/rdf:rest/rdf:first ?thirdValue .# If it's the third value, we use "rdf:rest/rdf:rest/rdf:first"; if fourth, use "rdf:rest/rdf:rest//rdf:rest/rdf:first"
}

(quoted from above)
Sorry, but I didn't post on Slack any similar question.

This issue is not solved yet. Yueqiao is trying programing to generate list from CSV.

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

No branches or pull requests

3 participants