hermes.ontology
Vocabulary
load_vocabulary reads a Turtle file and returns a small dict the prompt can list. It does not send the whole ontology.
Result
{
"path": "city.ttl",
"classes": ['ex:City "City"'],
"properties": ['ex:inCountry "in country"'],
"prefixes": [("ex", "http://example.org/demo#")],
}
The parser is RDFLib with format="turtle". Other serializations are not accepted. 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. Blank nodes are dropped. Each term is kept once.
An rdfs:label is appended in quotes when one exists. The list stops at 60 classes and 60 properties. Later terms are omitted, so a large ontology is only partly visible to the model until this cap moves.
A term is written as prefix:local when its namespace has a prefix, otherwise as a full IRI in angle brackets.
Prefixes
Declared prefixes come from prefix name: <namespace> and @prefix lines in the file text, not from the graph. RDF, RDFS, OWL, XSD, and XML namespaces are skipped. At most 12 prefixes are kept.
A namespace that appears on a kept term and has no declaration gets a prefix from its last path segment, lowercased, cut to 16 characters, and made to start with a letter. Collisions gain a numeric suffix (outage2). Derivation also stops at 12 prefixes total.