#rdf #iri #namespaces #string #vocabulary #module #q-name

field33_rdftk_names_temporary_fork

This crate provides a set of modules that contain the IRIs and QName strings for commonly used vocabularies. It also provides macro support for defining new namespaces in the same style as this library.

1 unstable release

0.1.9 Aug 23, 2022

#937 in Rust patterns

Download history 21/week @ 2024-03-14 30/week @ 2024-03-21 48/week @ 2024-03-28 38/week @ 2024-04-04 20/week @ 2024-04-11 16/week @ 2024-04-18 23/week @ 2024-04-25 19/week @ 2024-05-02 19/week @ 2024-05-09 18/week @ 2024-05-16 14/week @ 2024-05-23 15/week @ 2024-05-30 14/week @ 2024-06-06 19/week @ 2024-06-13 18/week @ 2024-06-20 9/week @ 2024-06-27

62 downloads per month
Used in 6 crates (via field33_rdftk_core_tempor…)

MIT license

175KB
2.5K SLoC

RDFtk: Names

names This crate provides a set of modules that contain the IRIs and QName strings for commonly used vocabularies. It also provides macro support for defining new namespaces in the same style as this library.

crates.io docs.rs

Vocabularies

Te following table shows the set of namespaces supported, those with "TBD" in the module column are yet to be encoded.

Module Vocabulary Namespace
dt::dcam DCMI Abstract Model http://purl.org/dc/dcam/
dt::dcmi_types DCMI Type Vocabulary http://purl.org/dc/dcmitype/
dt::elements' DCMI Terms http://purl.org/dc/elements/1.1/
dt::terms DCMI Terms legacy elements http://purl.org/dc/terms/
foaf Friend of a Friend http://xmlns.com/foaf/0.1/
geo Basic Geo Vocabulary http://www.w3.org/2003/01/geo/wgs84_pos#
owl OWL Web Ontology Language http://www.w3.org/2002/07/owl#
rdf RDF RDF Syntax http://www.w3.org/1999/02/22-rdf-syntax-ns#
rdfs RDF RDF Schema http://www.w3.org/2000/01/rdf-schema#
xsd XML Schema data types http://www.w3.org/2001/XMLSchema#
TBD SKOS Simple Knowledge Organization System (SKOS) http://www.w3.org/2004/02/skos/core#
TBD PROV PROV http://www.w3.org/ns/prov#
TBD RDFa RDF in Attributes (RDFa) http://www.w3.org/ns/rdfa#
TBD RDF Calendar http://www.w3.org/2002/12/cal#
TBD vCard Ontology http://www.w3.org/2006/vcard/ns#
TBD The Organization Ontology http://www.w3.org/ns/org#
TBD Creative Commons Rights Expression Language http://creativecommons.org/ns#

The namespace Macro

The namespace! macro takes three parameters:

  • The common prefix for the module,
  • The namespace IRI for the module,
  • A list of pairs where the first is the name of the function to return the IRI for the name, and the second is the string name of the vocabulary element.

Note that as this macro uses paste::item the client will need to have a dependency on the paste crate.

Example

The following example replicates the geo module using the namespace! macro.

#[macro_use]
extern crate rdftk_names;

use rdftk_names::Vocabulary;

namespace! {
    GeoSpatialVocabulary,
    "geo",
    "http://www.w3.org/2003/01/geo/wgs84_pos#",
    {
        spatial_thing, "SpatialThing",
        temporal_thing, "TemporalThing",
        event, "Event",
        point, "Point",
        lat, "lat",
        location, "location",
        long, "long",
        alt, "alt",
        lat_long, "lat_long"
    }
}

Changes

Version 0.1.8

  • rdftk_iri dependency reset to only major/minor.

Version 0.1.8

  • Applied a lot more warnings in lib.rs
  • Applied resulting warnings and Clippy suggestions.
  • Reformatted macro layout.

Version 0.1.7

  • Added missing names in rdfs vocabulary.

Version 0.1.6

  • Updated paste dependency.

Version 0.1.5

  • Explicit version management.

Version 0.1.3

  • namespace! macro now creates a local cache of Arc<IRI> instances to reduce memory consumption.

Version 0.1.2

  • Added rdf:li.

Version 0.1.1

  • Made nsname! macro public.

Version 0.1.0

  • First release

TODO

TBD

Dependencies

~4.5–7MB
~127K SLoC