Examples to configure specific Wikidata annotators

Annotators can refer to any of the properties of Wikidata entries. Please check out more information in this article.

The name of a property (like “instance of”) or its identifier are obtained by placing the mouse over “instance of” in the browser.

Note in the definition of “diseases”, we make use of the fact that Wikidata concepts are linked to domain specific database such as MeSH that allows to make a statement about the concept using a regular expression.

Person

One option to define a “person” concept is to say that any Wikidata concept that has “human” (Q5) as value of “property ID” (P31) is a person.

{
  "statements": {
    "$elemMatch": {
      "propertyId": "P31",
      "value": "Q5"
    }
  }
}

Location

One option to define a “location” concept is to say that any Wikidata concept that has a “Geonames ID” will be a location.

 {
   "statements": {
     "$elemMatch": {
       "propertyName": "GeoNames ID"
     }
   }
 }

Actor

In order to define an “actor” concept we can rely on the fact that for persons a lot of properties such as birthplace and birthdate but in many cases also the occupation are listed.

 {
   "statements": {
     "$elemMatch": {
       "propertyName": "occupation",
       "value": {
         "$in": [
           "Q33999"
         ]
       }
     }
   }
 }

Disease

In order to define a “disease” concept we restrict the matches to all concepts that have a MeSH identifier (Property P672) that starts with a “C” (the disease subtree in MeSH).

{
   "statements": {
     "$elemMatch": {
               "propertyId": "P672",
               "value": {
                 "$regex": "C.+"
               }
             }
   }
 }

Abundance

Note the “$or” statement that allows to specify a list of constraints, here requiring that a concept must be an “instance of” (P31) a “medication” (Q12140) or a “subclass of” (P279) a “medication” (Q12140) or a “treatment” (Q179661) or it must have an entry in the ChEBI database (P683).

 {
   "statements": {
     "$elemMatch": {
       "$or": [
         {
           "propertyId": "P31",
           "value": "Q12140"
         },
         {
           "propertyId": "P279",
           "value": {
             "$in": [
               "Q12140",
               "Q179661"
             ]
           }
         },
         {
           "propertyId": "P683"
         }
       ]
     }
   }
 }

Drug

{
  "statements": {
    "$elemMatch": {
      "$or": [
        {
          "propertyId": "P31",
          "value": "Q12140"
        },
        {
          "propertyId": "P279",
          "value": {
            "$in": [
              "Q12140",
              "Q179661"
            ]
          }
        }
      ]
    }
  }
}

Organization

{
  "statements": {
    "$elemMatch": {
      "propertyName": "instance of",
      "value": {
        "$in": [
          "Q6881511",
          "Q4830453",
          "Q783794",
          "Q192283",
          "Q484652",
          "Q484652",
          "Q43229",
          "Q7278",
          "Q79913",
          "Q7210356",
          "Q31855",
          "Q45103187",
          "Q4671277",
          "Q3918",
          "Q693737",
          "Q161726",
          "Q891723",
          "Q1262438",
          "Q46970",
          "Q47913",
          "Q3238445",
          "Q936518",
          "Q1413677",
          "Q14037025",
          "Q20901295",
          "Q4120211",
          "Q3623811",
          "Q1335818",
          "Q2300373",
          "Q178790",
          "Q37178026",
          "Q627272",
          "Q327333",
          "Q748720",
          "Q3591583",
          "Q249556",
          "Q22687",
          "Q19758733",
          "Q480242",
          "Q1345691",
          "Q21104425",
          "Q1896989",
          "Q245065",
          "Q21104425"
        ]
      }
    }
  }
}