This SPARQL endpoint allows you to query the Computer Science Knowledge Graph (CS-KG).
We encourage all users to familiarise with the CS-KG data model and the full ontology documentation before running queries with this SPARQL endpoint.
A public SPARQL endpoint (based on OpenLink Virtuoso v. 7.2) for querying CS-KG is available at https://w3id.org/cskg/sparql.
Here you can find a handful of examples to kick-start the exploration of CS-KG.
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX cskg: <https://w3id.org/cskg/resource/> # CS-KG resources
PREFIX cskg-ont: <https://w3id.org/cskg/ontology#> # CS-KG ontology
PREFIX provo: <http://www.w3.org/ns/prov#>
PREFIX cso: <http://cso.kmi.open.ac.uk/schema/cso#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX dcterm: <http://purl.org/dc/terms/>
SELECT ?sub ?pre ?obj ?sup
FROM <https://w3id.org/cskg>
WHERE {
?t rdf:subject ?sub ;
rdf:predicate ?pre ;
rdf:object ?obj ;
cskg-ont:hasSupport ?sup .
FILTER (xsd:integer(?sup) >= 3)
{{?t rdf:subject cskg:wikipedia}
UNION
{?t rdf:object cskg:wikipedia}
}}
LIMIT 100
Given a research entity (e.g., sentiment analysis) as the subject, retrieve the relevant statements ordered by support.
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX cskg: <https://w3id.org/cskg/resource/> # CS-KG resources
PREFIX cskg-ont: <https://w3id.org/cskg/ontology#> # CS-KG ontology
PREFIX provo: <http://www.w3.org/ns/prov#>
PREFIX cso: <http://cso.kmi.open.ac.uk/schema/cso#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX dcterm: <http://purl.org/dc/terms/>
SELECT (cskg:sentiment_analysis as ?sub) ?prop ?research_entity ?sup
FROM <https://w3id.org/cskg>
WHERE {
?t rdf:subject cskg:sentiment_analysis ;
rdf:predicate ?prop ;
rdf:object ?research_entity ;
cskg-ont:hasSupport ?sup .
}
ORDER BY desc (?sup)
LIMIT 100
Given the material “twitter”, find the tasks where it was used and the list of relevant articles.
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX cskg: <https://w3id.org/cskg/resource/> # CS-KG resources
PREFIX cskg-ont: <https://w3id.org/cskg/ontology#> # CS-KG ontology
PREFIX provo: <http://www.w3.org/ns/prov#>
PREFIX cso: <http://cso.kmi.open.ac.uk/schema/cso#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX dcterm: <http://purl.org/dc/terms/>
SELECT ?sub (cskg-ont:usesMaterial as ?prop) (cskg:twitter as ?obj) ?paperID FROM <http://scholkg.kmi.open.ac.uk/cskg>
WHERE {
?t rdf:subject ?sub ;
rdf:predicate cskg-ont:usesMaterial ;
rdf:object cskg:twitter ;
provo:wasDerivedFrom ?paperID .
?sub a cskg-ont:Task
}
LIMIT 100
Given a material (e.g., Twitter), identify the tasks for which it was used and list the articles from which this information was derived.
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX cskg: <https://w3id.org/cskg/resource/> # CS-KG resources
PREFIX cskg-ont: <https://w3id.org/cskg/ontology#> # CS-KG ontology
PREFIX provo: <http://www.w3.org/ns/prov#>
PREFIX cso: <http://cso.kmi.open.ac.uk/schema/cso#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX dcterm: <http://purl.org/dc/terms/>
SELECT ?sub (cskg-ont:usesMaterial as ?prop) (cskg:twitter as ?obj) ?paper ?doi
FROM <https://w3id.org/cskg>
WHERE {
?t rdf:subject ?sub ;
rdf:predicate cskg-ont:usesMaterial ;
rdf:object cskg:twitter ;
provo:wasDerivedFrom ?paper .
?sub a cskg-ont:Task .
?paper cskg-ont:doi ?doi .
}
LIMIT 100
Retrieve the statements derived from a paper with a specific ID (e.g., W2060391699) in the OpenAlex catalog.
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX cskg: <https://w3id.org/cskg/resource/> # CS-KG resources
PREFIX cskg-ont: <https://w3id.org/cskg/ontology#> # CS-KG ontology
PREFIX provo: <http://www.w3.org/ns/prov#>
PREFIX cso: <http://cso.kmi.open.ac.uk/schema/cso#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX dcterm: <http://purl.org/dc/terms/>
SELECT (cskg:W2060391699 as ?paperID) ?sub ?prop ?obj
FROM <https://w3id.org/cskg>
WHERE {
?t rdf:subject ?sub ;
rdf:predicate ?prop ;
rdf:object ?obj ;
provo:wasDerivedFrom cskg:W2060391699 .
}
LIMIT 100
Given a research entity (e.g., sentiment analysis), return all corresponding entities on external knowledge graphs.
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX cskg: <https://w3id.org/cskg/resource/> # CS-KG resources
PREFIX cskg-ont: <https://w3id.org/cskg/ontology#> # CS-KG ontology
PREFIX provo: <http://www.w3.org/ns/prov#>
PREFIX cso: <http://cso.kmi.open.ac.uk/schema/cso#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX dcterm: <http://purl.org/dc/terms/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
SELECT (cskg:sentiment_analysis as ?sub) ?same_entity
FROM <https://w3id.org/cskg>
WHERE {
cskg:sentiment_analysis owl:sameAs ?same_entity .
}
LIMIT 100
List the entities that appeared in at least 100 triples extracted from papers in 2015.
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX cskg: <https://w3id.org/cskg/resource/> # CS-KG resources
PREFIX cskg-ont: <https://w3id.org/cskg/ontology#> # CS-KG ontology
PREFIX provo: <http://www.w3.org/ns/prov#>
PREFIX cso: <http://cso.kmi.open.ac.uk/schema/cso#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX dcterm: <http://purl.org/dc/terms/>
SELECT DISTINCT ?entity ?year ?frequency
FROM <https://w3id.org/cskg>
WHERE {
{?t rdf:subject ?entity} UNION {?t rdf:object ?entity}
?entity cskg-ont:hasTimeObservation ?to .
?to cskg-ont:year ?year .
?to cskg-ont:frequency ?frequency .
FILTER (?frequency >= 100)
FILTER (?year = '2015'^^rdfs:Literal)
}
LIMIT 100
List the statements with a frequency of at least 100 in the year 2020.
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX cskg: <https://w3id.org/cskg/resource/> # CS-KG resources
PREFIX cskg-ont: <https://w3id.org/cskg/ontology#> # CS-KG ontology
PREFIX provo: <http://www.w3.org/ns/prov#>
PREFIX cso: <http://cso.kmi.open.ac.uk/schema/cso#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX dcterm: <http://purl.org/dc/terms/>
SELECT ?sub ?pred ?obj ?year ?frequency
FROM <https://w3id.org/cskg>
WHERE {
?t rdf:subject ?sub;
rdf:predicate ?pred;
rdf:object ?obj;
cskg-ont:hasTimeObservation ?to .
?to cskg-ont:year ?year .
?to cskg-ont:frequency ?frequency .
FILTER (?frequency >= 100)
FILTER (?year = '2020'^^rdfs:Literal)
}
LIMIT 100
LIMIT 100
Return the frequency over the years of an entity (e.g., machine learning).
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX cskg: <https://w3id.org/cskg/resource/> # CS-KG resources
PREFIX cskg-ont: <https://w3id.org/cskg/ontology#> # CS-KG ontology
PREFIX provo: <http://www.w3.org/ns/prov#>
PREFIX cso: <http://cso.kmi.open.ac.uk/schema/cso#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX dcterm: <http://purl.org/dc/terms/>
SELECT (cskg:machine_learning as ?entity) ?year ?frequency
FROM <https://w3id.org/cskg>
WHERE {
cskg:machine_learning cskg-ont:hasTimeObservation ?to .
?to cskg-ont:year ?year .
?to cskg-ont:frequency ?frequency .
}
ORDER BY (?year)
LIMIT 100
Return the frequency over the years of the statement describing the triple (machine learning, usesMaterial, twitter).
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX cskg: <https://w3id.org/cskg/resource/> # CS-KG resources
PREFIX cskg-ont: <https://w3id.org/cskg/ontology#> # CS-KG ontology
PREFIX provo: <http://www.w3.org/ns/prov#>
PREFIX cso: <http://cso.kmi.open.ac.uk/schema/cso#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX dcterm: <http://purl.org/dc/terms/>
SELECT ?year ?frequency
FROM <https://w3id.org/cskg>
WHERE {
?t rdf:subject cskg:machine_learning;
rdf:predicate cskg-ont:usesMaterial;
rdf:object cskg:twitter;
cskg-ont:hasTimeObservation ?to .
?to cskg-ont:year ?year .
?to cskg-ont:frequency ?frequency .
}
ORDER BY (?year)
LIMIT 100
Find the 20 most frequent entities that appeared with a statement describing a triple
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX cskg: <https://w3id.org/cskg/resource/> # CS-KG resources
PREFIX cskg-ont: <https://w3id.org/cskg/ontology#> # CS-KG ontology
PREFIX provo: <http://www.w3.org/ns/prov#>
PREFIX cso: <http://cso.kmi.open.ac.uk/schema/cso#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX dcterm: <http://purl.org/dc/terms/>
SELECT ?ceo ?entity ?freq
FROM <https://w3id.org/cskg>
WHERE {
?stm rdf:subject cskg:internet_of_thing ;
rdf:predicate cskg-ont:usesMethod ;
rdf:object cskg:wireless_protocol ;
cskg-ont:hasContextEntityObservation ?ceo .
?ceo cskg-ont:relatedEntity ?entity;
cskg-ont:co-occurrence ?freq .
}
ORDER BY DESC (?freq)
LIMIT 100
Find the 20 most frequent statements that appeared with a statement describing a triple
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX cskg: <https://w3id.org/cskg/resource/> # CS-KG resources
PREFIX cskg-ont: <https://w3id.org/cskg/ontology#> # CS-KG ontology
PREFIX provo: <http://www.w3.org/ns/prov#>
PREFIX cso: <http://cso.kmi.open.ac.uk/schema/cso#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX dcterm: <http://purl.org/dc/terms/>
SELECT ?related_stm ?freq ?s ?p ?o
FROM <https://w3id.org/cskg>
WHERE {
?stm rdf:subject cskg:internet_of_thing ;
rdf:predicate cskg-ont:usesMethod ;
rdf:object cskg:wireless_protocol ;
cskg-ont:hasContextStatementObservation ?cs .
?cs cskg-ont:relatedStatement ?related_stm;
cskg-ont:co-occurrence ?freq .
?related_stm rdf:subject ?s ;
rdf:predicate ?p ;
rdf:object ?o .
}
ORDER BY DESC (?freq)
LIMIT 100