curie 0.1.0 copy "curie: ^0.1.0" to clipboard
curie: ^0.1.0 copied to clipboard

Implementation of the W3C CURIE Syntax 1.0. Supports prefix mapping as well as the expansion of CURIEs and the shrinking of IRIs.

example/curie_example.dart

import 'package:curie/curie.dart';

void main() {
  // Initialize a prefix mapper.
  final mapper = PrefixMapping()
    ..addPrefix("foaf", "http://xmlns.com/foaf/0.1/")
    // Set a default prefix value
    ..defaultPrefixValue = "http://example.com/";

  print("--- Expanded CURIEs ---");

  // Prints "http://example.com/Entity"
  print(mapper.expandCurieString("Entity"));

  // Prints "http://xmlns.com/foaf/0.1/Agent"
  print(mapper.expandCurieString("foaf:Agent"));

  final curie = Curie(prefix: "foaf", reference: "Agent");

  // Prints "http://xmlns.com/foaf/0.1/Agent"
  print(mapper.expandCurie(curie));

  print("\n--- Shrunken IRI ---");

  // Creates a Curie object that prints "foaf:Agent"
  print(mapper.shrinkIri("http://xmlns.com/foaf/0.1/Agent"));
}
2
likes
160
points
38
downloads

Publisher

verified publishernamib.me

Weekly Downloads

Implementation of the W3C CURIE Syntax 1.0. Supports prefix mapping as well as the expansion of CURIEs and the shrinking of IRIs.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

More

Packages that depend on curie