createApiKey static method

String createApiKey(
  1. String apiKeyId,
  2. String apiKeyValue, {
  3. String source = 'TMDB',
})

Creates an API key file in TTL format following the ontology structure.

Implementation

static String createApiKey(
  String apiKeyId,
  String apiKeyValue, {
  String source = 'TMDB',
}) {
  final triples = <URIRef, Map<URIRef, dynamic>>{};

  // Create the API key resource.

  final apiKeyResource = moviestarDataNS.withAttr('ApiKey-$apiKeyId');
  triples[apiKeyResource] = {
    rdfType: [owlNS.withAttr('NamedIndividual'), apiKeyType],
    identifier: Literal(apiKeyId),
    keyValue: Literal(apiKeyValue),
    TurtleSerializer.source: Literal(source),
    rdfsLabel: Literal('|filePath=moviestar/data/keys/ApiKey-$apiKeyId.ttl|'),
  };

  // Use ontology-compliant namespace bindings.

  return tripleMapToTurtle(triples, bindNamespaces: _getOntologyNamespaces());
}