Contexts
Consider two YAML-LD documents: one describes Alpha Centauri, and the other describes a person whose comment mentions a planet in that system:
Source alpha-centauri.yamlld
$id: http://dbpedia.org/resource/Alpha_Centauri
$type: http://dbpedia.org/ontology/Star
name: Alpha Centauri
Source guillem-anglada-escude.yamlld
$id: http://dbpedia.org/resource/Guillem_Anglada-Escud%C3%A9
$type: https://schema.org/Person
name: Guillem Anglada-Escudé
rdfs:comment: Led the team that announced the discovery of Proxima Centauri b.
Query the data:
Source triples.rq
SELECT ?predicate ?object
WHERE {
<http://dbpedia.org/resource/Guillem_Anglada-Escud%C3%A9> ?predicate ?object .
}
ORDER BY ?predicate
| predicate | object |
|---|---|
| http://www.w3.org/1999/02/22-rdf-syntax-ns#type | https://schema.org/Person |
| http://www.w3.org/2000/01/rdf-schema#comment | Led the team that announced the discovery of Proxima Centauri b. |
The query returns each predicate and value for this person in the default
graph. The default context defines the
rdfs prefix and maps $type to
rdf:type. It does not
define name, so JSON-LD drops that property from this source. The
discovery announcement credits the
person with leading the team that found the planet. An
overview of Alpha Centauri
describes the planet's orbit around a star in that system.
Keyword aliases such as $type come from the
default context. Vocabulary terms such as name need a
declared or registered context:
project or remote.