RED FLAG Data Platform
The Red Flag Data Platform aims to provide access to Red Flag RDF data using Semantic Web technologies so that it can be queried across resources using the W3C SPARQL query language.
How can the data be accessed?
There are three ways to access the RDF data:
- SPARQL
You can programmatically have access to Red Flag data via public SPARQL endpoints where you can run queries against the datasets remotely using http requests. More on this later.
- Faceted Linked Data Browser
You can browse across the RDF data through your web browser using any Faceted Linked Data browser software like OpenLink Faceted Browser. This allows you to understand the data contained within and its relationships.
- CURL
Graphs
All data is stored in one database, therefore all entries can be access through any endpoint. However, the database contains many different named graphs to organize the data. Named Graphs can be used to speed up your search by excluding the data that you do not care about - this can be done by using the from statement in your SPARQL query (see examples on this page).
Some examples for named Graphs are:
For now, you can explore the data via any public SPARQL Endpoint like sparql.org URIBurner etc.
http://sparql.org/sparql
https://linkeddata.uriburner.com/sparql
Basic Queries
If you want to run a basic query for a single dataset, you do not need to do anything special. For example:
DESCRIBE
You can also choose to limit a SPARQL query to a specific graph using the FROM keyword. This can speed up your query and is therefore recommended:
SELECT *
FROM
WHERE {
?subject ?predicate ?object
}
Intermediate Queries
If you want to run a simple query, you do not need to do anything special. For example, to extract the attributes of a person, Kwami Ahiabenu, we have to use his URI which is http://redfla.org/entity/person/12:
DESCRIBE <http://www.redflagmovement.org/storygraph/cs00001>
Query issued via cURL:
curl -F "query=DESCRIBE <http://www.redflagmovement.org/storygraph/cs00001>" http://www.redflagmovement.org/sparql
The query below can extract data from the Red Flag RDF data using the FROM keyword:
SELECT *
FROM <http://www.redflagmovement.org/storygraph/cs00001>
WHERE {
?subject ?predicate ?object
}
Query issued via cURL:
curl -F "query=SELECT * FROM <http:///www.redflagmovement.org> WHERE { ?subject ?predicate ?object }" http://redflagmovement.org/sparql
The query below will list 10 cases about financial loss:
SELECT DISTINCT ?label
FROM <http://www.redflagmovement.org>
WHERE {
?subject a corruption:Case.
?subject rdfs:label ?label.
?subject corruption:hasNatureOfAllegation "Financial loss" .
}
LIMIT 10
Query issued via cURL:
curl -F "query=SELECT DISTINCT ?label FROM <http:///www.redflagmovement.org> WHERE { ?subject a corruption:Case. ?subject rdfs:label ?label ?subject corruption:hasNatureOfAllegation "Financial loss" . } LIMIT 10" http://www.redflagmovement.org/sparql
The query below will list 10 organizations being investigated:
SELECT DISTINCT ?label
FROM <hhttp://www.redflagmovement.org>
WHERE {
?subject a corruption:Case.
?subject corruption:hasOrganization ?label .
}
LIMIT 10
Query issued via cURL:
curl -F "query=SELECT DISTINCT ?label FROM <http://www.redflagmovement.org> WHERE { ?subject a corruption:Case. ?subject corruption:hasOrganization ?label . } LIMIT 10" http://localhost:8890/sparql
Prefixes
Our SPARQL Endpoint is configured with some namespace prefixes by default. These are:
You can use these prefixes in SPARQL queries without needing to specify them.
Federated Queries (SPARQL-FED)
You can execute queries that use data from multiple datasets by federating the query across more than one SPARQL endpoint. This is accomplished with the SERVICE keyword. This example .....:
SELECT ?dataset ?triples
WHERE {
{
?dataset <http://rdfs.org/ns/void#triples> ?triples .
}
UNION {
SERVICE <http://www.ebi.ac.uk/rdf/services/atlas/sparql> {
?dataset <http://rdfs.org/ns/void#triples> ?triples .
}
}
}