Template:Id url/doc

Partial query to help getting uris from identifier properties and their formatting uris.

Usage edit

  • {{Id url|?edition|P1025|?editionurl}} or {{Id url|?edition|SUDOC editions|?editionurl}} Every editions from sudoc known to wikidata with their uris
  ?edition wdt:P1025 ?ideditionP1025 .
 ?directeditionP1025 wikibase:directClaim wdt:P1025 .
 ?directeditionP1025 wikibase:propertyType wikibase:ExternalId . 
 ?directeditionP1025 wdt:P1630 ?baseurleditionP1025 .
 BIND(IRI(REPLACE(?ideditionP1025, '^(.+)$', ?baseurleditionP1025 )) AS ?editionurl).

Used in a full query (wikitext):

{{Sparql|query=select ?edition ?editionurl where {
{{Id url|?edition|P1025|?editionurl}}
} }}

gives

select ?edition ?editionurl where {
  ?edition wdt:P1025 ?ideditionP1025 .
  ?directeditionP1025 wikibase:directClaim wdt:P1025 .
  ?directeditionP1025 wikibase:propertyType wikibase:ExternalId . 
  ?directeditionP1025 wdt:P1630 ?baseurleditionP1025 .
  BIND(IRI(REPLACE(?ideditionP1025, '^(.+)$', ?baseurleditionP1025 )) AS ?editionurl).
}
Try it!

Also using the property english label :

  ?edition wdt:P1025 ?ideditionSUDOC_editions .
 ?directeditionSUDOC_editions wikibase:directClaim wdt:P1025 .
 ?directeditionSUDOC_editions wikibase:propertyType wikibase:ExternalId . 
 ?directeditionSUDOC_editions wdt:P1630 ?baseurleditionSUDOC_editions .
 BIND(IRI(REPLACE(?ideditionSUDOC_editions, '^(.+)$', ?baseurleditionSUDOC_editions )) AS ?editionurl).
  wd:Q19184969 wdt:P1025 ?id .
 ?directQ19184969P1025 wikibase:directClaim wdt:P1025 .
 ?directQ19184969P1025 wikibase:propertyType wikibase:ExternalId . 
 ?directQ19184969P1025 wdt:P1630 ?baseurlQ19184969P1025 .
 BIND(IRI(REPLACE(?id, '^(.+)$', ?baseurlQ19184969P1025 )) AS ?editionurl).
select ?id ?editionurl where {
  wd:Q19184969 wdt:P1025 ?id .
  ?directQ19184969P1025 wikibase:directClaim wdt:P1025 .
  ?directQ19184969P1025 wikibase:propertyType wikibase:ExternalId . 
  ?directQ19184969P1025 wdt:P1630 ?baseurlQ19184969P1025 .
  BIND(IRI(REPLACE(?id, '^(.+)$', ?baseurlQ19184969P1025 )) AS ?editionurl).
}
Try it!


  wd:Q5 ?prop ?idQ5prop .
 ?directQ5prop wikibase:directClaim ?prop .
 ?directQ5prop wikibase:propertyType wikibase:ExternalId . 
 ?directQ5prop wdt:P1630 ?baseurlQ5prop .
 BIND(IRI(REPLACE(?idQ5prop, '^(.+)$', ?baseurlQ5prop )) AS ?humanurl).
select ?humanurl where {
  wd:Q5 ?prop ?idQ5prop .
  ?directQ5prop wikibase:directClaim ?prop .
  ?directQ5prop wikibase:propertyType wikibase:ExternalId . 
  ?directQ5prop wdt:P1630 ?baseurlQ5prop .
  BIND(IRI(REPLACE(?idQ5prop, '^(.+)$', ?baseurlQ5prop )) AS ?humanurl).
}
Try it!

See also edit

No description.

Template parameters

ParameterDescriptionTypeStatus
item1 variable

variable or wikidata value for the item(s) we are interested into getting uris

Default
?work
Example
?work or Q5
Stringsuggested
identifierproperty2 i

a variable or a property id or a property english label for which we want uris

Default
?identifierproperty
Example
SUDOC editions or ?idprop or P1025
Stringsuggested
url3 externalurl

variable for the url of the external sites for our items (may work for sparql strings uris we want to find the item)

Example
?url
Stringoptional
identifier4 id

variable name to get ids (may also work with a sparql string value for the id)

Example
?id or "156576252"
Unknownoptional