hermes.ontology

Vocabulary

The vocabulary is a compact list of prefixes, classes, and properties. It is queried through a store, so it works the same for a file and an endpoint.

Result

kg.vocabulary
{
  "classes": ['ex:City "City"'],
  "properties": ['ex:inCountry "in country"'],
  "prefixes": [("ex", "http://example.org/demo#")],
}

vocabulary(store, declared, limit) runs two queries on the store; load_vocabulary(path) does the same for one file. Source: ontology.py.

Classes and properties

Classes are IRIs typed owl:Class or rdfs:Class. Properties are IRIs typed owl:ObjectProperty, owl:DatatypeProperty, or rdf:Property. An rdfs:label is appended in quotes. Each list stops at vocabulary_limit terms (60 by default). A limit of 0 skips the queries, which is how large graphs such as DBpedia and Wikidata are declared in data/graphs.yaml.

Prefixes

For files, declared prefixes come from the @prefix lines in the file text; for endpoints, from the graph's entry in data/graphs.yaml. RDF, RDFS, OWL, XSD, and XML namespaces are skipped, and at most 12 prefixes are kept. A namespace without a declaration gets a prefix from its last path segment, with a numeric suffix on collision.