Coder Social home page Coder Social logo

wikidata-game-flower-color's Introduction

wikidata-game-flower-color

Build Status Coverage Status License DOI

A mini-game for the distributed wikidata game. It helps to assign the flower color property P2827 to plants in wikidata. Attention! The Wikidata API action is disabled, so no values are altered there (see Limitations section for details).

Update 2018-12-04: The game server is now deactivated

As I was moving servers and this one never made it into production (for details see discussion below) I decided to shut it down instead of migrating it. If you want to have it back, just let me know. Your feedback will give me the motivation required to setup a fresh instance on my new server.

Idea

Many Wikidata items contain images with clearly visible flowers. Also a lot of Wikipedia articles contain textual descriptions of plant morphology including flower color. This information can be easily extracted by a human but not automatically by a computer. Therefore this game aims to make it easy for people to add this information to the structured database of Wikidata.

Limitations

Guessing flower color from images can be problematic for a number of reasons. Perception of colors by humans is different and the game only provides a limited list of predefined color categories (e.g. blue). Fine distinctions like light-blue vs dark-blue are not possible. Using the game it is only possible to add a single color and not to cover cases where one flower has multiple colors, different parts of the flower (e.g. sepals and petals) have different colors or one species appears in different forms. Further concerns about the reliability of entries generated with this game without citing concrete sources exist. Therefore the API action is disabled for now. Here is the relevant part of the conversation on Wikidata:

Iimog, without good sources these additions are worthless. I reverted two of your addition allready. --Succu (talk) 09:45, 27 January 2017 (UTC) Looks like your source is TraitBank (flower color) which in turn is heavily based on USDAs PLANTS Characteristics. There flower color is defined as the „predominant color of the flowers“. --Succu (talk) 17:14, 28 January 2017 (UTC)

Succu, thanks for the feedback. However, I don't agree that those additions are worthless without good sources. My assumption was that the flower color of many plants can be easily derived by anyone from existing images in wikidata and wikipedia articles. Many articles contain sections describing the plant including the color of the flower for example Monarda didyma contains "It has ragged, bright red tubular flowers 3–4 cm long, [...]". I think it would be very beneficial to have this information available in a structured, machine readable way. Therefore I built the wikidata game to make it easy for everybody to add those values. In fact I used the colors used in TraitBank as a preliminary list of possible colors in the game. As said this game has still some limitations. Nevertheless I consider the additions made by playing the game as valuable. As those additions do not have a source associated it is still easily possible to filter those entries out in a SPARQL query. Please let me know if you do not agree. --Iimog 09:55, 01 February 2017 (UTC)

Iimog, major Wikipedias criticize Wikidata for the lack of reliable sources and I agree. Guessing flower color (P2827) from pictures of uncertain quality (and origin) is banned by Wikipedia:No original research (Q4656524). --Succu (talk) 20:07, 3 February 2017 (UTC)

Succu, thanks for the further explanation. While I still think that more data of mixed quality can be beneficial I understand that in many cases less data of high quality is preferable. Therefore I deactivated the API action in the flower color game so that no more entries are added. Thanks again for your valuable feedback. Iimog (talk) 09:35, 6 February 2017 (UTC)

Database

Colors

The game database contains colors already used for flower colors in TraitBank. The list of colors can be found in colors.tsv.

Plants

The plant database consists of wikidata items that are child taxa of flowering plants (angiosperms) at the species level that have a scientific name, a ncbi taxid and at least one image. The SPARQL to get the list is:

SELECT ?item ?sciname ?ncbi WHERE {
  ?item (wdt:P171*) wd:Q25314 .
  ?item wdt:P685 ?ncbi .
  ?item wdt:P225 ?sciname .
  FILTER EXISTS { ?item wdt:P18 ?picture }
  FILTER EXISTS { ?item wdt:P105 wd:Q7432 }
}

If you have wd and jq installed you can re-generate the plants.tsv with the following command:

wd sparql get_plants.rq | jq -r '.[] | .item + "\t" + .sciname + "\t" + .ncbi' >plants.tsv

Generate SQL files

This step is only required if you updated the plants or colors tsv files. In order to convert the tsv files into sql files ready for import into the database you can use this perl commands:

# Colors
perl -F"\t" -ane '
BEGIN{
    print "INSERT INTO color (wikidata_id, color) VALUES\n";
    $needComma=0;
}
next if(/^#/);
print ",\n" if($needComma);
chomp $F[1];
$needComma=1;
print " ('\''$F[0]'\'', '\''$F[1]'\'')";
END{
    print ";\n";
}' data/colors.tsv >data/colors.sql
# Plants
perl -F"\t" -ane '
BEGIN{
    print "INSERT INTO plant (wikidata_id, scientific_name, finished) VALUES\n";
    $needComma=0;
}
print ",\n" if($needComma);
$needComma=1;
print " ('\''$F[0]'\'', '\''$F[1]'\'', FALSE)";
END{
    print ";\n";
}' data/plants.tsv >data/plants.sql

Hosting

Docker

To host an instance of this wikidata game you can use docker. To get a working setup execute the following commands:

docker pull greatfireball/generic_postgresql_db
docker pull iimog/wikidata-game-flower-color
docker run -d -e "DB_USER=wikidata" -e "DB_PW=wikidata" -e "DB_NAME=wikidata" --name wikidata-db greatfireball/generic_postgresql_db
docker run -d -p 8083:80 --link wikidata-db:db --name wikidata-web iimog/wikidata-game-flower-color
# now fill the database
docker exec -it wikidata-web /bin/bash
# the following commands are executed inside the docker container
cd /wikidata-game-flower-color
php bin/console doctrine:schema:update --force
# Enter password 'wikidata' when prompted
php bin/console doctrine:database:import data/colors.sql
php bin/console doctrine:database:import data/plants.sql
exit

Now the api is reachable at localhost port 8083. You can check with http://localhost:8083/api?action=desc.

Logo

The logo is a free image (CC-0) from pixaby.com uploaded by user Dieter_G.

Changes

v0.1.2 (2017-02-06)

  • Deactivate Wikidata API action (decisions are only stored locally but not sent to Wikidata)

v0.1.1 (2017-01-27)

  • Add unit tests
  • Add functional tests
  • Add CI via Travis
  • Add coverage reporting via coveralls

v0.1.0 (2017-01-26)

  • Initial Release

wikidata-game-flower-color's People

Contributors

iimog avatar

Stargazers

layla michan avatar  avatar Camelia Boban avatar

Watchers

Camelia Boban avatar  avatar  avatar  avatar

Forkers

aissatech

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.