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

Sarql query - How to deal with available languages #22

Open
ghost opened this issue Sep 9, 2016 · 1 comment
Open

Sarql query - How to deal with available languages #22

ghost opened this issue Sep 9, 2016 · 1 comment

Comments

@ghost
Copy link

ghost commented Sep 9, 2016

The available languages for a property vary from object to object. For instance, the following query will work if we ask for "FR" but won't work if we ask for "EN" (the item labels are available in french and english, but the classification label exists only in english):

 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
 PREFIX xkos:<http://rdf-vocabulary.ddialliance.org/xkos#>
 SELECT ?label ?clLabel ?parentLabel {
    <http://stamina-project.org/codes/cpfr21/categorie/47.00.1> skos:prefLabel ?label ;
                                                                skos:inScheme ?cl .
    ?cl skos:prefLabel ?clLabel .

    <http://stamina-project.org/codes/cpfr21/categorie/47.00.1> skos:broader ?parent .
      ?parent skos:prefLabel ?parentLabel .

    FILTER (langMatches(lang(?label), "FR") && langMatches(lang(?parentLabel), "FR") && langMatches(lang(?clLabel), "FR"))
  }

Note: this is a simplified version of itemDetails query.

ghost pushed a commit that referenced this issue Sep 9, 2016
See #23 and #22 for related issues
classification code is opotional, but if not present we will still get the label.
@ghost
Copy link
Author

ghost commented Sep 9, 2016

The issue is more global. The problem exposed above occurs when the same language is not present for all the properties. But more generally, if we suppose we have a default language, do we provide a fallback when the properties are not available in this language ? For instance, the query above won't work in french but will work in english:

 PREFIX skos:<http://www.w3.org/2004/02/skos/core#>
  PREFIX xkos:<http://rdf-vocabulary.ddialliance.org/xkos#>
  SELECT ?label ?code ?label ?text ?cl ?clCode ?clLabel ?parent ?parentCode
      ?parentLabel {
    <http://stamina-project.org/codes/nacer2/section/I> skos:prefLabel ?label ;
              skos:notation ?code ;
              skos:inScheme ?cl .
    ?cl skos:prefLabel ?clLabel .

    OPTIONAL { 
      ?cl skos:notation ?clCode .
    }


    OPTIONAL {
      <http://stamina-project.org/codes/nacer2/section/I> skos:broader ?parent ;
                skos:prefLabel ?parentLabel .
      OPTIONAL { ?parent skos:notation ?parentCode . } 
    }      

    OPTIONAL {
     <http://stamina-project.org/codes/nacer2/section/I> xkos:coreContentNote ?content .
     ?content xkos:plainText ?text .
    }
    FILTER (
      langMatches(lang(?label), "EN") &&
      langMatches(lang(?clLabel), "EN"))
  }

One option could be to deal with the language in the ui, where we could implement some specific rules to have a safe fallback. But it's not trivial. If we do so, we need to remove the FILTER statement in queries and build a process utility. Another option could be to make dedicated queries to retrieve all text properties: these queries should return one or multiple results depending on the languages available. But it adds a lot of complexity too.

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

No branches or pull requests

0 participants