☰

✍️🤖 Agent/Guido

A mapping file

A mapping is a YAML file in ez_wikidata/resources/<name>_props.yaml. It names the mapping and lists one entry per column of the record:

name: paper_props
mappings:
  instanceof:
    column: instanceof
    propertyName: instance of
    propertyId: P31
    propertyType: itemid
    value: Q13442814
  title:
    column: title
    propertyName: title
    propertyId: P1476
    propertyType: text
  author:
    column: author
    propertyName: author
    propertyId: P50
    propertyType: itemid
  series_ordinal:
    column: null
    propertyName: series ordinal
    propertyId: P1545
    propertyType: string
    qualifierOf: author
    listIndexBase: 1
description: Paper property mappings (Wikidata scholarly article)
url: https://cr.bitplan.com/index.php/Concept:Paper

The attributes

attribute meaning
column the key of the record whose value becomes the statement; null for a value that does not come from the record
propertyName the English label of the Wikidata property; a test checks that it matches propertyId on Wikidata
propertyId the Wikidata property, e.g. P1476
propertyType the datatype as ezwd converts it: itemid, extid, string, text, url, date, time, quantity, entity_schema and the others of WdDatatype
value a fixed value used when the record has none, e.g. the class of the item for instance of
qualifierOf the column of the statement this entry qualifies
listIndexBase for a qualifier: its value is the index of the qualified value in its list, counted from this base; see Author order
valueLookupType the class of an item value given by name instead of Q id; ezwd looks the Q id up on Wikidata

Reading a mapping

ezwd -m paper --list-mappings
paper_props: Paper property mappings (Wikidata scholarly article); columns match issue py_ez_wikidata#14
  instanceof	P31	itemid	instance of
  title	P1476	text	title
  author	P50	itemid	author
  series_ordinal	P1545	string	series ordinal
  language	P407	itemid	language of work or name
  publication_date	P577	date	publication date
  published_in	P1433	itemid	published in
  pages	P304	string	page(s)
  doi	P356	extid	DOI
  dblp	P8978	extid	DBLP publication ID
  full_text_url	P953	url	work available at URL

Consistency

tests/test_property_mapping.py loads every bundled mapping and checks against the property list of Wikidata that each propertyId carries the given propertyName. A mapping with a wrong property, as the ResearchGate mapping had up to 0.4.2 (#12), fails the build. A second test checks that no bundled resource links to an intranet wiki.

The header

Every mapping file starts with a comment header: author and date, what the mapping creates with the Q ids as links, where it is used, its issues, the link to its section of the Examples page, and the record of the item that was created with it as 🌐🕸 annotation, see there.