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
140
pub points
28%
popularity

Publisher

verified publishernamib.me

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)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

More

Packages that depend on curie