SPARQL_SNIPPETS.md 2.1 KB

SPARQL Snippets (Atlas)

Purpose: keep stable, reusable queries close to the project so we do not drift.

1) Entity + all attached claims + claim provenance

Use this to read one coherent entity record from the graph.

PREFIX atlas: <http://world.eu.org/atlas_ontology#>

SELECT ?entity ?label ?claim ?pred ?objIri ?objLit ?layer ?prov ?src ?method ?conf ?ts
WHERE {
  ?entity a atlas:Entity ;
          atlas:canonicalLabel ?label ;
          atlas:hasClaim ?claim .

  ?claim atlas:claimSubjectIri ?entity ;
         atlas:claimPredicate ?pred ;
         atlas:claimLayer ?layer .

  OPTIONAL { ?claim atlas:claimObjectIri ?objIri . }
  OPTIONAL { ?claim atlas:claimObjectLiteral ?objLit . }

  OPTIONAL {
    ?claim atlas:hasProvenance ?prov .
    ?prov atlas:provenanceSource ?src .
    OPTIONAL { ?prov atlas:retrievalMethod ?method . }
    OPTIONAL { ?prov atlas:confidence ?conf . }
    OPTIONAL { ?prov atlas:retrievedAt ?ts . }
  }
}
ORDER BY ?entity ?claim

2) Same query filtered to one entity node

Replace atlas_data:entity_atlas_mid__m_0cqt90 with the target entity URI.

PREFIX atlas: <http://world.eu.org/atlas_ontology#>
PREFIX atlas_data: <http://world.eu.org/atlas_data#>

SELECT ?entity ?label ?claim ?pred ?objIri ?objLit ?layer ?prov ?src ?method ?conf ?ts
WHERE {
  VALUES ?entity { atlas_data:entity_atlas_mid__m_0cqt90 }

  ?entity a atlas:Entity ;
          atlas:canonicalLabel ?label ;
          atlas:hasClaim ?claim .

  ?claim atlas:claimSubjectIri ?entity ;
         atlas:claimPredicate ?pred ;
         atlas:claimLayer ?layer .

  OPTIONAL { ?claim atlas:claimObjectIri ?objIri . }
  OPTIONAL { ?claim atlas:claimObjectLiteral ?objLit . }

  OPTIONAL {
    ?claim atlas:hasProvenance ?prov .
    ?prov atlas:provenanceSource ?src .
    OPTIONAL { ?prov atlas:retrievalMethod ?method . }
    OPTIONAL { ?prov atlas:confidence ?conf . }
    OPTIONAL { ?prov atlas:retrievedAt ?ts . }
  }
}
ORDER BY ?claim

Notes

  • Keep this file as the canonical place for read/query snippets.
  • If claim schema changes, update this file in the same commit.