Discussion
Loading...

Post

Log in
  • About
  • Code of conduct
  • Privacy
  • Users
  • Instances
  • About Bonfire
Alexander Winkler
Alexander Winkler
@awinkler@openbiblio.social  ·  activity timestamp 3 months ago

It took me some time to make sense of the paragraph on how to remove statements using #quickstatements here: https://www.wikidata.org/wiki/Help:QuickStatements#Removing_statements

Turns out it's actually not too difficult to generate qs-compatible output directly in the #wdqs Here's a template.

#wikidata

SPARQL Code Snippet from Wikidata Query Service

SELECT ?prefix ?qsStatementID
WHERE {
  ?item p:PXXX ?s .
  # add more constraints here to get statements you want to remove
  BIND ( ("-STATEMENT") AS ?prefix )
  BIND ( REPLACE(STR(?s), "http://www.wikidata.org/entity/statement/", "")  AS ?statementID )
  BIND ( REPLACE(STR(?item), "http://www.wikidata.org/entity/", "") AS ?qid)
  BIND ( REPLACE(?statementID, CONCAT(?qid, "-"), "") AS ?strippedStatementID )
  BIND ( CONCAT(?qid, "$", ?strippedStatementID ) AS ?qsStatementID )
  }
SPARQL Code Snippet from Wikidata Query Service SELECT ?prefix ?qsStatementID WHERE { ?item p:PXXX ?s . # add more constraints here to get statements you want to remove BIND ( ("-STATEMENT") AS ?prefix ) BIND ( REPLACE(STR(?s), "http://www.wikidata.org/entity/statement/", "") AS ?statementID ) BIND ( REPLACE(STR(?item), "http://www.wikidata.org/entity/", "") AS ?qid) BIND ( REPLACE(?statementID, CONCAT(?qid, "-"), "") AS ?strippedStatementID ) BIND ( CONCAT(?qid, "$", ?strippedStatementID ) AS ?qsStatementID ) }
SPARQL Code Snippet from Wikidata Query Service SELECT ?prefix ?qsStatementID WHERE { ?item p:PXXX ?s . # add more constraints here to get statements you want to remove BIND ( ("-STATEMENT") AS ?prefix ) BIND ( REPLACE(STR(?s), "http://www.wikidata.org/entity/statement/", "") AS ?statementID ) BIND ( REPLACE(STR(?item), "http://www.wikidata.org/entity/", "") AS ?qid) BIND ( REPLACE(?statementID, CONCAT(?qid, "-"), "") AS ?strippedStatementID ) BIND ( CONCAT(?qid, "$", ?strippedStatementID ) AS ?qsStatementID ) }
  • Copy link
  • Flag this post
  • Block

bonfire.cafe

A space for Bonfire maintainers and contributors to communicate

bonfire.cafe: About · Code of conduct · Privacy · Users · Instances
Bonfire social · 1.0.1-alpha.41 no JS en
Automatic federation enabled
Log in
  • Explore
  • About
  • Members
  • Code of Conduct