usc-isi-i2 / kgtk-notebooks

Tutorial and hands-on notebook on using the Knowledge Graph Toolkit (KGTK)
MIT License
78 stars 25 forks source link

how to retrieve specific property constraints of a property #11

Open valecarriero opened 1 year ago

valecarriero commented 1 year ago

Hi, I followed the import-wikidata.ipynb for importing wikidata, and these are the final files I have in the end

aliases.en.sorted.tsv.gz
aliases.sorted.tsv.gz
claims.badvalue.sorted.tsv.gz
claims.novalue.sorted.tsv.gz
claims.somevalue.sorted.tsv.gz
claims.sorted.tsv.gz
descriptions.en.sorted.tsv.gz
descriptions.sorted.tsv.gz
labels.en.sorted.tsv.gz
labels.sorted.tsv.gz
metadata.node.sorted.tsv.gz
metadata.property.datatypes.sorted.tsv.gz
metadata.types.sorted.tsv.gz
qualifiers.badvalue.sorted.tsv.gz
qualifiers.badvalueClaims.sorted.tsv.gz
qualifiers.novalue.sorted.tsv.gz
qualifiers.novalueClaims.sorted.tsv.gz
qualifiers.somevalue.sorted.tsv.gz
qualifiers.somevalueClaims.sorted.tsv.gz
qualifiers.sorted.tsv.gz
sitelinks.en.qualifiers.sorted.tsv.gz
sitelinks.en.sorted.tsv.gz
sitelinks.qualifiers.sorted.tsv.gz
sitelinks.sorted.tsv.gz

How can I retrieve the property constraints of a property? e.g. in claims.sorted.tsv.gz for the property P1303 I have triples like

P1303-P2302-Q52558054-16872d63-0    P1303   P2302   Q52558054   normal  wikibase-item

and then in qualifiers.sorted.tsv.gz I have triples like

P10-P2302-Q21510852-dde2f0ce-0-P2316-Q21502408-0    P10-P2302-Q21510852-dde2f0ce-0  P2316   Q21502408   wikibase-item

How can I put the two things together, for getting the constraints (and all their qualifiers) of e.g. P1303? Ofc there is a way but I'm missing it :)

Thanks a lot, Valentina