okf 0.1.1 copy "okf: ^0.1.1" to clipboard
okf: ^0.1.1 copied to clipboard

A format-first Dart toolkit for reading, validating, writing, indexing, and graphing Open Knowledge Format bundles.

example/okf.dart

import 'dart:io';

import 'package:okf/okf_io.dart';

Future<void> main(List<String> arguments) async {
  if (arguments.length != 1) {
    stderr.writeln('Usage: dart run example/okf.dart <bundle>');
    exitCode = 2;
    return;
  }

  final result = await const OkfBundleLoader().inspect(arguments.single);
  final report = const OkfValidator().validate(result.bundle);
  final graph = OkfGraph.fromBundle(result.bundle);

  stdout.writeln(
    'Loaded ${result.bundle.concepts.length} concepts and '
    '${graph.edges.length} relationships.',
  );
  for (final issue in result.issues) {
    stdout.writeln(issue);
  }
  for (final diagnostic in report.diagnostics) {
    stdout.writeln(diagnostic);
  }

  exitCode = result.hasIssues || !report.isValid ? 1 : 0;
}
1
likes
150
points
157
downloads

Documentation

API reference

Publisher

verified publisherconcepta.dev

Weekly Downloads

A format-first Dart toolkit for reading, validating, writing, indexing, and graphing Open Knowledge Format bundles.

Topics

#okf #knowledge #markdown #yaml #metadata

License

Apache-2.0 (license)

Dependencies

args, markdown, path, yaml

More

Packages that depend on okf