How to get started ?¶
The data format returned by the API can be controlled using the Accept
header.
Valid values are application/rdf+xml
, application/n-triples
, application/ld+json
, application/n-quads
, application/trix
, application/trig
and text/turtle
- the default format.
While it's possible to use the command line with curl
, Python is used in the remaining part of this guide using the module RDFLib.
It's also possible to use the module Owlready2
Info
The full CDE API is available at https://www.w3id.org/cde/docs.
How to load RDF data from the CDE API¶
from rdflib import Graph
g = Graph()
g.parse("https://w3id.clouddataengine.io/admin-loc/v1.0/countries")
print(f"fetched {len(g)} tuples")
for s, o, p in g:
print(s, o, p)