SPARQL - sgml/signature GitHub Wiki
WikiData Query Autocomplete Documentation
- Prefix words with "?" to autocomplete subjects
- Prefix words with "wdt:" or "wd:" to autocomplete objects
Flow
select alexa rank > 500; get website where alexa > 500
Syntax
# Demonstrates filtering for value greater than a real number
SELECT DISTINCT ?alexarank ?website ?websiteLabel ?sitelink
WHERE
{
?website wdt:P1661 ?alexarank.
OPTIONAL{ ?website wdt:P856 ?sitelink }
FILTER (?alexarank < 200) .
SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en" }
}
ORDER BY ?alexarank
URL
https://query.wikidata.org/#%23%20Demonstrates%20filtering%20for%20value%20greater%20than%20a%20real%20number%0ASELECT%20DISTINCT%20%3Falexarank%20%3Fwebsite%20%3FwebsiteLabel%20%3Fsitelink%20%0AWHERE%0A%7B%0A%09%3Fwebsite%20wdt%3AP1661%20%3Falexarank.%0A%20%20%20%20OPTIONAL%7B%20%3Fwebsite%20wdt%3AP856%20%3Fsitelink%20%7D%0A%09FILTER%20%28%3Falexarank%20<%20200%29%20.%0A%09SERVICE%20wikibase%3Alabel%20%7B%20bd%3AserviceParam%20wikibase%3Alanguage%20"%5BAUTO_LANGUAGE%5D%2Cen"%20%7D%0A%7D%0AORDER%20BY%20%3Falexarank
Cheatsheets
- https://ai.ia.agh.edu.pl/_media/pl:dydaktyka:semweb:sparql-cheat-sheet.pdf
- http://www.iro.umontreal.ca/~lapalme/ift6281/sparql-1_1-cheat-sheet.pdf
- https://www.slideshare.net/jelabra/introduction-to-sparql-83806610
- https://www.slideshare.net/OpenDataSupport/introduction-to-rdf-sparql
- https://www.slideshare.net/_Emw/an-ambitious-wikidata-tutorial
- https://www.mediawiki.org/wiki/Wikibase/DataModel
Endpoints
-
https://www.w3.org/wiki/SparqlEndpoints References
-
https://virtuoso.openlinksw.com/whitepapers/composite%20services.pdf
-
http://svn.aksw.org/papers/2015/ISWC_Wikidata2DBpedia/public.pdf
-
https://www.wikidata.org/wiki/Wikidata:Relation_between_properties_in_RDF_and_in_Wikidata
-
https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/suggestions
-
https://www.wikidata.org/wiki/Wikidata:SPARQL_query_service/queries
-
https://www.wikidata.org/wiki/Wikidata_talk:SPARQL_query_service/queries
-
https://en.wikibooks.org/wiki/SPARQL/Expressions_and_Functions
-
https://en.wikibooks.org/wiki/SPARQL/WIKIDATA_Qualifiers,_References_and_Ranks
-
http://download.oracle.com/otndocs/tech/semantic_web/pdf/semtech_datamining_v8.pdf
-
https://static.googleusercontent.com/media/research.google.com/en//pubs/archive/44818.pdf
-
https://franz.com/agraph/support/documentation/current/sparql-reference.html
-
https://www.cambridgesemantics.com/blog/semantic-university/learn-sparql/sparql-nuts-bolts/
-
https://www.cambridgesemantics.com/blog/semantic-university/learn-sparql/sparql-vs-sql/
-
https://www.cambridgesemantics.com/blog/semantic-university/learn-sparql/sparql-vs-sql/
-
http://dig.csail.mit.edu/2010/Courses/6.898/resources/sparql-tutorial.pdf
-
https://www.oit.va.gov/library/programs/ts/edp/dataSharing/DataIntegrationwithSWT_v1.pdf
-
https://franz.com/agraph/cresources/white_papers/SemWeb-Language-Primer.pdf
-
http://www.biomedbridges.eu/sites/biomedbridges.eu/files/training/1_-_introduction_to_rdf.pdf
-
http://www.semantic-web-book.org/w/images/9/94/W2011-03-rdf.pdf
-
http://www.cs.rpi.edu/academics/courses/fall07/semantic/CH4.pdf
-
https://www.wikidata.org/wiki/Wikidata:List_of_properties/all_in_one_table
-
https://docs.data.world/tutorials/sparql/list-of-sparql-filter-functions.html
-
https://docs.marklogic.com/guide/semantics/semantic-searches
-
https://docs.oracle.com/cd/E11882_01/appdev.112/e25609/sdo_rdf_concepts.htm#RDFRM595
-
https://franz.com/agraph/support/documentation/current/sparql-tutorial.html
-
https://www.xml.com/pub/a/2007/03/14/a-relational-view-of-the-semantic-web.html
-
http://www.oraclealchemist.com/news/linked-data-rdf-and-sparql-part-1/
-
https://www.topquadrant.com/2014/05/05/comparing-sparql-with-sql/
-
http://www.site.uottawa.ca/~diana/csi5180/AIMagzine-DeepQA.pdf
-
https://docs.aws.amazon.com/neptune/latest/userguide/bulk-load-tutorial-format-rdf.html
SELECT Person.fname, Address.city FROM Person, Address WHERE Person.addr=Address.ID AND Address.state=”MA”
Conceptually, we are SELECTing a list of attributes FROM a set of tables WHERE certain constraints are met. These constraints capture the relationships implicit in the scheme, Person.addr=Addresses.ID, and the selection criteria, e.g. Address.state=”MA”.
A SPARQL query of the same data could look like
SELECT ?name ?city
WHERE {
?who <Person#fname> ?name ;
<Person#addr> ?adr .
?adr <Address#city> ?city ;
<Address#state> “MA”
}
SELECT ?reaction ?p ?o
WHERE {
?compound ex:name “illudium phosdex” ;
?reaction ex:involves ?compound ;
?reaction ?p ?o
}
In SQL, this would be like:
SELECT reactions.*
FROM reactions, compounds
WHERE reactions.compoundID=compounds.ID
AND compounds.name=”illudium phosdex”