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

Add option to keep qualifiers in simplifyClaims() #12

Closed
larsgw opened this issue Dec 31, 2016 · 3 comments · Fixed by #13
Closed

Add option to keep qualifiers in simplifyClaims() #12

larsgw opened this issue Dec 31, 2016 · 3 comments · Fixed by #13

Comments

@larsgw
Copy link
Contributor

larsgw commented Dec 31, 2016

After simplifyClaims(), all qualifiers are discarded. This makes it impossible for e.g. merging P50 (author) and P2093 (author string) after fetching labels, as the P1545 (series ordinal) qualifier is gone. It would be nice to to have an option for simplifyClaims() or a similar method to keep these.

@larsgw larsgw changed the title Add option to show qualifiers Add option to keep qualifiers in simplifyClaims() Dec 31, 2016
@maxlath
Copy link
Owner

maxlath commented Dec 31, 2016

simplifyClaims was first created as an attempt to get straight to the very basic facts, as that was my need at the time, but I do growingly see the need for keeping qualifiers... The issue then is that simplifyClaims output doesn't let much room for more complete data, you get the raw values likes

{
  "claims": {
    "P279": [ "Q340169", "Q2342494", "Q386724" ]
  }
}

This would require having a richer output format like

{
  "claims": {
    "P279": [
      { "value": "Q340169", "qualifiers": {} },
      { "value": "Q2342494", "qualifiers": {} },
      { "value": "Q386724", "qualifiers": {} }
    ]
  }
}

That could make sense. PR welcome!

@egonw
Copy link

egonw commented Dec 31, 2016

Or:

{
  "claims": {
    "P279": {
      "Q340169": { "qualifiers": {} },
      "Q2342494": { "qualifiers": {} },
      "Q386724": { "qualifiers": {} }
    }
  }
}

which is programmatically closer to the original... instead of getting the values of the list, you can now get the keys of the map, and no need to look up the .value...

@larsgw
Copy link
Contributor Author

larsgw commented Dec 31, 2016

Well, I'm not fluent in CoffeeScript, but I'll have a go. I prefer the {"value":...,"qualifiers":...} idea.

larsgw added a commit to larsgw/wikidata-sdk that referenced this issue Dec 31, 2016
Compiling with coffee 1.12.2 instead of 1.11.1
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

Successfully merging a pull request may close this issue.

3 participants