User:Daniel/Queries/Prefixes: Difference between revisions
From MaRDI portal
< User:Daniel | Queries
started |
|||
Line 10: | Line 10: | ||
== Prefixes for other endpoints == | == Prefixes for other endpoints == | ||
{| class="wikitable" | {| class="wikitable" | ||
|+ | |+ A brief selection of external SPARQL endpoints that are candidates for federation with the MaRDI portal endpoint. | ||
|- | |- | ||
! Database name !! endpoint URL !! Sample query | ! Database name !! endpoint URL !! Sample query | ||
Line 16: | Line 16: | ||
| FactGrid || Example || Example | | FactGrid || Example || Example | ||
|- | |- | ||
| OpenStreetMap || | | OpenStreetMap || [https://sophox.org/sparql https://sophox.org/sparql] || [https://query.portal.mardi4nfdi.de/#PREFIX%20osmnode%3A%20%3Chttps%3A%2F%2Fwww.openstreetmap.org%2Fnode%2F%3E%0APREFIX%20osmway%3A%20%3Chttps%3A%2F%2Fwww.openstreetmap.org%2Fway%2F%3E%0APREFIX%20osmrel%3A%20%3Chttps%3A%2F%2Fwww.openstreetmap.org%2Frelation%2F%3E%0APREFIX%20osmt%3A%20%3Chttps%3A%2F%2Fwiki.openstreetmap.org%2Fwiki%2FKey%3A%3E%0APREFIX%20osmm%3A%20%3Chttps%3A%2F%2Fwww.openstreetmap.org%2Fmeta%2F%3E%0APREFIX%20pageviews%3A%20%3Chttps%3A%2F%2Fdumps.wikimedia.org%2Fother%2Fpageviews%2F%3E%0APREFIX%20osmd%3A%20%3Chttp%3A%2F%2Fwiki.openstreetmap.org%2Fentity%2F%3E%0APREFIX%20osmdt%3A%20%3Chttp%3A%2F%2Fwiki.openstreetmap.org%2Fprop%2Fdirect%2F%3E%0APREFIX%20osmp%3A%20%3Chttp%3A%2F%2Fwiki.openstreetmap.org%2Fprop%2F%3E%0APREFIX%20osmps%3A%20%3Chttp%3A%2F%2Fwiki.openstreetmap.org%2Fprop%2Fstatement%2F%3E%0APREFIX%20osmpq%3A%20%3Chttp%3A%2F%2Fwiki.openstreetmap.org%2Fprop%2Fqualifier%2F%3E%0A%0ASELECT%20%2a%20WHERE%20%7B%0A%23%20%20%20wd%3AQ72365%20wdt%3AP12%20%3Fwd%20.%0A%23%20%20%20BIND%28wd%3AQ72365%20as%20%3Fwd%29%0A%20%20SERVICE%20%3Chttps%3A%2F%2Fsophox.org%2Fsparql%3E%20%7B%0A%23%20A%20sample%20query%20to%20list%20all%20OSM%20objects%20with%20a%20place%20tag.%0A%23%20The%20%2a%20will%20show%20all%20variables%20that%20are%20used%20in%20the%20WHERE%20clause%0Aselect%20%2a%20where%20%7B%0A%20%20%23%20The%20first%20expression%20matches%20the%20three%20columns%20of%20the%20Triple%20Store%20with%3A%0A%20%20%23%20%20%20%22find%20any%20subject%20that%20has%20an%20OSM%20%27place%27%20tag%2C%20and%20any%20value%20of%20that%20tag%22%0A%20%20%23%0A%20%20%23%20Question%20mark%20represents%20a%20variable.%20%3Fosm%20becomes%20a%20URI%20for%20an%20OSM%20object%2C%20e.g.%0A%20%20%23%20%20%20%20%3Chttps%3A%2F%2Fwww.openstreetmap.org%2Fnode%2F2681940767%3E%20%20%28Everest%29%0A%20%20%23%20The%20same%20URI%20may%20also%20be%20written%20with%20a%20prefix%20-%20osmnode%3A2681940767%0A%20%20%23%20All%20OSM%20tags%20use%20osmt%3A%20prefix.%20Using%20osmt%3Aplace%20constant%20only%0A%20%20%23%20matches%20OSM%20object%20with%20a%20place%20tag.%20The%20%3Fplace%20variable%20will%0A%20%20%23%20become%20the%20value%20of%20the%20place%20tag.%20You%20can%20use%20a%20constant%20instead%20of%20a%20variable%2C%0A%20%20%23%20e.g.%20substitute%20%3Fplace%20with%20a%20constant%20string%20%27city%27.%0A%0A%20%20%3Fosm%20osmt%3Aplace%20%3Fplace.%0A%0A%20%20%23%20osmm%3A%20prefix%20means%20%22meta%20values%22%2C%20e.g.%20OSM%20object%20type%2C%20location%20%28loc%29%2C%20version%2C%20...%0A%20%20%23%20Uncomment%20to%20limit%20to%20a%20specific%20type%20of%20an%20OSM%20object%20%28%27n%27%2C%20%27r%27%2C%20%27w%27%29.%0A%20%20%23%20%20%20%3Fosm%20osmm%3Atype%20%27r%27.%0A%0A%20%20%23%20osmm%3Aloc%20is%20a%20centroid%20point%20for%20most%20OSM%20objects.%20If%20included%2C%20the%20results%0A%20%20%23%20can%20be%20shown%20on%20a%20map%20by%20switching%20to%20the%20map%20view%20%28right%20under%20the%20query%29%0A%20%20%23%20%20%20%3Fosm%20osmm%3Aloc%20%3Fcoordinates.%0A%0A%20%20%23%20The%20FILTER%20expressions%20allow%20complex%20filtering%20beyond%20a%20simple%20%22must%20match%22.%0A%20%20%23%20%20%20filter%28%3Fplace%20%3D%20%27town%27%20%7C%7C%20regex%28%3Fplace%2C%20%27%5Ba-z%5D%5B0-9%5D%27%2C%20%27i%27%29%29%0A%0A%20%20%23%20This%20will%20limit%20results%20to%20places%20which%20do%20not%20have%20a%20%60name%3Aen%60%20tag.%0A%20%20%23%20%20%20filter%20not%20exists%20%7B%20%3Fosm%20osmt%3Aname%3Aen%20%3Fnameen.%20%7D%0A%0A%20%20%23%20For%20OSM%20objects%20with%20the%20wikidata%20tag%2C%20find%20the%20English%20name%20of%20that%20object%20in%20Wikidata%0A%20%20%23%20if%20it%20exists.%0A%20%20%20%20%20%3Fosm%20osmt%3Awikidata%20%3Fwd.%0A%20%20%23%20With%20that%20get%20from%20the%20Wikidata%20SPARQL%20endpoint%20service%20what%20type%20of%20the%20object%20it%0A%20%20%23%20is%20%28P31%20is%20the%20property%20instance%20of%20in%20Wikidata%29%2C%20and%20the%20label%20for%20that%20type%2C%0A%20%20%23%20also%20if%20exists%20in%20English.%20For%20labels%20and%20descriptions%2C%20you%20may%20instead%20use%20a%0A%20%20%23%20service%20that%20picks%20first%20available%20language%20based%20on%20a%20list.%0A%20%20%23%20%20%20service%20%3Chttps%3A%2F%2Fquery.wikidata.org%2Fsparql%3E%20%7B%0A%20%20%23%20%20%20%20%20%3Fwd%20wdt%3AP31%20%3Ftype.%0A%20%20%23%20%20%20%20%20optional%20%7B%20%3Fwd%20rdfs%3Alabel%20%3Flabel.%20filter%28lang%28%3Flabel%29%20%3D%20%22en%22%29%20%7D%0A%20%20%23%20%20%20%20%20optional%20%7B%20%3Ftype%20rdfs%3Alabel%20%3Ftypelabel.%20filter%28lang%28%3Ftypelabel%29%20%3D%20%22en%22%29%20%7D%0A%20%20%23%20%20%7D%0A%7D%0A%23%20Similar%20to%20SQL%2C%20queries%20can%20use%20aggregations%2C%20subqueries%2C%20and%20limit%20the%20results%0Alimit%2010%20%20%7D%0A%7D%0A OpenStreetMap place types and their Wikidata IDs] | ||
|- | |- | ||
| WikiPathways || [http://sparql.wikipathways.org/sparql http://sparql.wikipathways.org/sparql] || [https://query.wikidata.org/#PREFIX%20wp%3A%20%20%20%20%3Chttp%3A%2F%2Fvocabularies.wikipathways.org%2Fwp%23%3E%0APREFIX%20dcterms%3A%20%3Chttp%3A%2F%2Fpurl.org%2Fdc%2Fterms%2F%3E%0ASELECT%20%2a%20WHERE%20%7B%0ASERVICE%20%3Chttp%3A%2F%2Fsparql.wikipathways.org%2Fsparql%3E%20%7B%0A%20%20%20%20%20%20%3Fwp_mb1%20wp%3AbdbWikidata%20%3Fmetabolite%20.%0A%20%20%20%20%20%20%3Fwp_mb1%20dcterms%3AisPartOf%20%3Finteraction%20.%0A%20%20%20%20%20%20%3Finteraction%20rdf%3Atype%20wp%3AInteraction%20.%0A%20%20%20%20%20%20%3Fwp_mb2%20dcterms%3AisPartOf%20%3Finteraction%20.%0A%20%20%20%20%20%20%3Fwp_mb2%20wp%3AbdbWikidata%20%3Fmetabolite2%20.%0A%20%20%20%20%20%20FILTER%20%28%3Fwp_mb1%20%21%3D%20%3Fwp_mb2%29%0A%20%20%20%20%7D%0A%20%20%7D%20LIMIT%2020 Wikidata identifiers of WikiPathways metabolites] | | WikiPathways || [http://sparql.wikipathways.org/sparql http://sparql.wikipathways.org/sparql] || [https://query.wikidata.org/#PREFIX%20wp%3A%20%20%20%20%3Chttp%3A%2F%2Fvocabularies.wikipathways.org%2Fwp%23%3E%0APREFIX%20dcterms%3A%20%3Chttp%3A%2F%2Fpurl.org%2Fdc%2Fterms%2F%3E%0ASELECT%20%2a%20WHERE%20%7B%0ASERVICE%20%3Chttp%3A%2F%2Fsparql.wikipathways.org%2Fsparql%3E%20%7B%0A%20%20%20%20%20%20%3Fwp_mb1%20wp%3AbdbWikidata%20%3Fmetabolite%20.%0A%20%20%20%20%20%20%3Fwp_mb1%20dcterms%3AisPartOf%20%3Finteraction%20.%0A%20%20%20%20%20%20%3Finteraction%20rdf%3Atype%20wp%3AInteraction%20.%0A%20%20%20%20%20%20%3Fwp_mb2%20dcterms%3AisPartOf%20%3Finteraction%20.%0A%20%20%20%20%20%20%3Fwp_mb2%20wp%3AbdbWikidata%20%3Fmetabolite2%20.%0A%20%20%20%20%20%20FILTER%20%28%3Fwp_mb1%20%21%3D%20%3Fwp_mb2%29%0A%20%20%20%20%7D%0A%20%20%7D%20LIMIT%2020 Wikidata identifiers of WikiPathways metabolites] | ||
|} | |} |
Revision as of 12:53, 5 May 2024
About
This page collects information regarding prefixes used in SPARQL queries, with special attention to federated queries.
MaRDI portal default prefixes
Prefixes for other endpoints
Database name | endpoint URL | Sample query |
---|---|---|
FactGrid | Example | Example |
OpenStreetMap | https://sophox.org/sparql | OpenStreetMap place types and their Wikidata IDs |
WikiPathways | http://sparql.wikipathways.org/sparql | Wikidata identifiers of WikiPathways metabolites |