Skip to content

Projects and samples

Projects

A project keeps a set of documents apart: its own facts, ontologies, shapes and extraction defaults, so documents in one project are never read against another's ontologies. Your work starts in the default project. Create one with POST /projects ({"name": "Thesis"}; the slug, here thesis, never changes) and pass project=thesis to /process, /jobs, /ontologies and /shapes.

# every graph of a project, one file per graph, with a manifest
curl -o thesis.zip -H "Authorization: Bearer $ONTOCAST_KEY" \
  "$ONTOCAST_API/projects/thesis/export?bundle=true&format=turtle"
# or one TriG document, each graph named
curl -o thesis.trig -H "Authorization: Bearer $ONTOCAST_KEY" \
  "$ONTOCAST_API/projects/thesis/export?format=trig"
# a read-only SPARQL query on the project's facts (or "dataset": "ontologies" / "shapes")
curl -H "Authorization: Bearer $ONTOCAST_KEY" -H "Content-Type: application/json" \
  -d '{"query": "SELECT ?class (COUNT(?s) AS ?n) WHERE { ?s a ?class } GROUP BY ?class"}' \
  $ONTOCAST_API/projects/thesis/sparql

The bundle's manifest.json maps each file to the jobs that produced it, their source files, options and cost. SELECT and ASK answer SPARQL JSON results; CONSTRUCT and DESCRIBE answer Turtle. Queries may not update data or call other services (SERVICE), and each has a time and a size limit. Deleting a project (DELETE /projects/{slug} with {"confirm": "<slug>"}) deletes everything in it; the default project stays.

To look at several graphs together, GET /projects/{slug}/graphs takes extractions (jobs=<id>,<id>) and ontologies (ontologies=<id> for the current version, <id>@<key> for one) and answers TriG, one named graph each: an extraction's graph_uri, an ontology version's <iri>#<key>. It takes up to 20 sources and 50,000 triples together.

Samples

A sample is a finished extraction you can copy into a project of your own to explore before you run anything: GET /samples lists them, and POST /samples/{id} adds one as a new project (slug sample-<id>) holding its job, ontologies and graph. It costs nothing, works while your account awaits approval, and is read-only; delete the project to remove it. You can hold one project per sample, and adding samples is limited per day.