PLnode

API for Wikidata services.

Constraint check

GET //plnode.toolforge.org/cc
Checks if the submitted statement violates a property constraint on Wikidata. Intended use: to check if a statement violates a constraint before it is added to Wikidata.
Parameters:
  • entity – Wikidata entity id
  • statement – JSON represention of a statement
  • constraints – constraints to be checked.
    Values (separate with |): all, Q21502410, Q21510852, Q52004125, Q21510851, Q21514353, Q54554025, Q21502838, Q21502404, Q52848401, Q21510855, Q21503247, Q21510856, Q51723761, Q52558054, Q21510859, Q53869507, Q21510860, Q19474404, Q52060874, Q21510862, Q21503250, Q21510864, Q21510865
Response Headers:
Status codes:

Example request 1

GET //plnode.toolforge.org/cc?entity=Q165713&statement={"mainsnak": {"snaktype": "value","property": "P852","datavalue": {"value": {"entity-type": "item","id": "Q1180639"},"type": "wikibase-entityid"},"datatype": "wikibase-item"}}&constraints=Q21510864|Q21510865

Example response 1

{
"violations":2,
"problems":[{"constraint":"Q21510864","text":"value requires statement violation"},{"constraint":"Q21510865","text":"value type violation"}]
}

Example request 2

GET //plnode.toolforge.org/cc?entity=Q23481&statement={"mainsnak": {"snaktype": "value","property": "P1138","datavalue": {"value": "8154207","type": "string"},"datatype": "external-id"}}&constraints=all

Example response 2

{
"violations":0,
"problems":[]
}

Known limitations

Exists

GET //plnode.toolforge.org/exists
Checks if the submitted property or property simple value pair already exists on the given entity.
Parameters:
  • entity – Wikidata entity id
  • property – Wikidata property
  • value – optional; only provide simple value, e.g. entity id, string, quantity without unit, monolingual texts without language. For geocoordinates write the value in the form lat|lon with lat and lon in decimal degrees. Geocoordinates count as identical if they differ less than 0.001° on both latitude and longitude.
Response Headers:
Status codes:

Example request 1

GET //plnode.toolforge.org/exists?entity=Q2013&property=P277

Example response 1

{
"exists":true
}

Example request 2

GET plnode.toolforge.org/exists?entity=Q2013&property=P277&value=Q2378

Example response 2

{
"exists":false
}

Triple count

GET //plnode.toolforge.org/triplecount
Counts the number of RDF triples.
Parameters:
  • query – SPARQL query
Response Headers:
Status codes:

Example request

GET //plnode.toolforge.org/triplecount?query=SELECT ?a WHERE {wd:Q42 p:P735 ?o}

Example response

{
"count":2
}

Category scan

GET //plnode.toolforge.org/categroyscan
Returns all pages in a category, including its subcategories.
Parameters:
  • category – category to scan
  • servername – server name of the wiki site
  • depth – depth of subcategories
  • namespace – namespace of returned pages
Response Headers:
Status codes:

Example request

GET //plnode.toolforge.org/categoryscan?category=Airports_in_Berlin&servername=en.wikipedia.org&depth=0&namespace=0

Example response

[
"Berlin_Tegel_Airport",
"Berlin_Brandenburg_Airport",
"Berlin_Tempelhof_Airport",
"Johannisthal_Air_Field",
"Airports_of_Berlin",
"RAF_Gatow"
]

Edit

unstable, not documented