rdf-vocab
Common OWL/RDFS Vocabularies for use with Ruby RDF.rb
Extensions
This gem extends RDF::Vocabulary
with #to_ttl
, #to_jsonld
, and #to_html
methods to create special-purpose vocabulary serializations. The HTML version is templated using a Haml template to allow output to be customized.
Also extends RDF::Vocabulary::Format
with the gen-vocab
command extension to the rdf
executable.
Limiting vocabularies used for lookup
As loading vocabularies can dominate processing time, the RDF::Vocabulary.limit_vocabs
method can be used to set a specific set of vocabularies over which to reason. For example:
RDF::Vocabulary.limit_vocabs(:rdf, :rdf, :schema)
will limit the vocabularies which are returned from RDF::Vocabulary.each
, which is used for reasoning and other operations over vocabularies and terms.
Vocabularies
- RDF::Vocab::ACL - Web Access Control (W3C)
- RDF::Vocab::AS - Activity Streams 2.0 (W3C)
- RDF::Vocab::BF2 - BIBFRAME 2.0 (LoC)
- RDF::Vocab::Bibframe - Bibliographic Framework Initiative (LoC)
- RDF::Vocab::BIBO - Bibliographic Ontology
- RDF::Vocab::CC - Creative Commons Vocabulary (Creative Commons)
- RDF::Vocab::CERT - Cert Ontology (W3C)
- RDF::Vocab::CNT - Representing Content in RDF (W3C)
- RDF::Vocab::DataCite - DataCite Ontology
- RDF::Vocab::DBO - The DBpedia Ontology
- RDF::Vocab::DC - DCMI Metadata Terms (DCMI)
- RDF::Vocab::DC11 - Dublin Core Metadata Element Set (DCMI)
- RDF::Vocab::DCAT - Data Catalog Vocabulary (DCMI)
- RDF::Vocab::DCMIType - DCMI Type Vocabulary (DCMI)
- RDF::Vocab::DISCO - DDI-RDF Discovery Vocabulary (DDI)
- RDF::Vocab::DOAP - Description of a Project (DOAP) vocabulary
- RDF::Vocab::DWC - Darwin Core
- RDF::Vocab::EARL - Evaluation and Report Language (EARL) 1.0 Schema (W3C)
- RDF::Vocab::EBUCore - EBUCore
- RDF::Vocab::EDM - Europeana Data Model (EDM)
- RDF::Vocab::EXIF - Exif vocabulary workspace (W3C)
- RDF::Vocab::Fcrepo4 - Fedora Commons Repository 4 Ontology
- RDF::Vocab::FOAF - Friend of a Friend (FOAF) vocabulary
- RDF::Vocab::GEO - GEO Vocabulary (W3C)
- RDF::Vocab::GEOJSON - GEOJSON Vocabulary
- RDF::Vocab::GEONAMES - GeoNames Ontology Vocabulary
- RDF::Vocab::GR - Good Relations
- RDF::Vocab::GS1 - GS1 Web Vocabulary for GS1 SmartSearch (GS1)
- RDF::Vocab::HT - HTTP Vocabulary in RDF 1.0 (W3C)
- RDF::Vocab::HYDRA - Hydra Core Vocabulary (W3C)
- RDF::Vocab::IANA - Link Relations (IANA)
- RDF::Vocab::ICAL - iCalendar vocabulary (W3C)
- RDF::Vocab::Identifiers - Standard Identifiers Scheme (LoC)
- RDF::Vocab::IIIF - International Image Interoperability Framework Presentation API (IIIF)
- RDF::Vocab::JSONLD - JSON-LD Vocabulary
- RDF::Vocab::LDP - Linked Data Platform (W3C)
- RDF::Vocab::LRMI - Learning Resources Metadata Initiative (DCMI)
- RDF::Vocab::MA - Ontology for Media Resources (W3C)
- RDF::Vocab::MADS - Metadata Authority Description Schema (LoC)
- RDF::Vocab::MARCRelators - MARC Code List for Relators (LoC)
- RDF::Vocab::MO - Music Ontology
- RDF::Vocab::MODS - Metadata Object Description Schema (LoC)
- RDF::Vocab::NFO - NEPOMUK File Ontology (NFO)
- RDF::Vocab::OA - Open Annotation Data Model (W3C)
- RDF::Vocab::OG - Open Graph protocol
- RDF::Vocab::OGC - Open Graph protocol classes
- RDF::Vocab::ORE - Object Reuse and Exchange Ontology (OAI)
- RDF::Vocab::ORG - Organization Ontology (W3C)
- RDF::Vocab::PCDM - PCDM Ontology (PCDM)
- RDF::Vocab::PPLAN - P-Plan Ontology
- RDF::Vocab::PREMIS - Preservation Metadata Implementation Strategies Ontology (LoC)
- RDF::Vocab::PremisEventType - PREMIS Event Type (LoC)
- RDF::Vocab::PROV - Provenance Ontology (W3C)
- RDF::Vocab::PTR - Pointer Methods in RDF 1.0 (W3C)
- RDF::Vocab::RDAU - RDA Vocabularies
- RDF::Vocab::RightsStatements - Rights Statements for Cultural Heritage Institutions
- RDF::Vocab::RSA - The RSA Ontology
- RDF::Vocab::RSS - RDF Site Summary
- RDF::Vocab::SCHEMA - Schema.org
- RDF::Vocab::SD - SPARQL Service Description (W3C)
- RDF::Vocab::SH - Shapes Constraint Language (SHACL) (W3C)
- RDF::Vocab::SIOC - Semantically-Interlinked Online Communities
- RDF::Vocab::SiocServices - SIOC Services (SIOC)
- RDF::Vocab::SiocTypes - SIOC Types Ontology (SIOC)
- RDF::Vocab::SKOS - Simple Knowledge Organization System (W3C)
- RDF::Vocab::SKOSXL - SKOS eXtension for Labels (W3C)
- RDF::Vocab::V - RDF data vocabulary
- RDF::Vocab::VMD - RDF data vocabulary
- RDF::Vocab::VCARD - Ontology for vCards (W3C)
- RDF::Vocab::VMD - RDF data vocabulary
- RDF::Vocab::VOID - Vocabulary of Interlinked Datasets (W3C)
- RDF::Vocab::VS - SemWeb Vocab Status ontology (W3C)
- RDF::Vocab::WDRS - Protocol for Web Description Resources (W3C)
- RDF::Vocab::WOT - Web of Trust
- RDF::Vocab::XKOS - XKOS An SKOS extension for representing statistical classifications (DDI)
- RDF::Vocab::XHTML - Extensible HyperText Markup Language (W3C)
- RDF::Vocab::XHV - XHTML Vocabulary (W3C)
Installation
Add to your Gemfile
gem "rdf-vocab"
then
bundle install
Usage
require "rdf/vocab"
This will load all the vocabulary classes in the library.
Also adds the gen-vocab
command to the rdf
command-line executable to generate specifically generated output in Turtle, JSON-LD, and HTML+RDFa for either built-in or arbitrary vocabularies. Other output serialization formats are also supported as generic RDF Writers and may lack the vocabulary-specific formatting of Turtle, JSON-LD, and HTML+RDFa.
Adding new vocabularies
Vocabularies should only be added to this gem if they are widely used. An equivalent process can be used to add a vocabulary to an arbitrary Ruby application or gem if it is more application specific.
New vocabularies should be generated via a pull request after cloning from GitHub. Be sure to use a custom branch name before creating the PR.
- First, add an entry to
lib/rdf/vocab.rb
, the key is used to identify the vocabulary, and as the default basis for the prefix label to use for the vocabulary. The key names of the object value come from the following:- uri (required)
- The namespace URI for the vocabulary.
- module_name (default RDF::Vocab)
- The Ruby module in which the vocabulary class is created.
- class_name (default from uppercase of the vocabulary identity)
- The class name of the vocabulary
- source (default from uri)
- The source used to fetch the RDF vocabulary definition (most formats supported). Defaults to the vocabulary uri.
- strict (default false)
- Creates a strict vocabulary, so that attempts to use undefined terms in the vocabulary namespace become errors.
- alias (Internal only)
- Indicates that this is an alias for a vocabulary defined directly in the RDF namespace.
- skip
- Do not process this vocabulary, typically when the vocabulary source is inaccessible.
- patch
- The value is taken as a string formatted as an LD Patch used to correct issues in the vocabulary source that may show up when the vocabulary is validated.
- extra
- Value is a JSON Object which is added to the resulting vocabulary definition.
For more information, see the documentation on RDF::Vocabulary.
- Next, create an empty file in
lib/rdf/vocab
based on the key name for your vocabulary. For example, if you've added the vocabulary:foo
, create a new empty file atlib/rdf/vocab/foo.rb
. - Create an entry in the README to document the availability of the library within this gem.
- Run
rake gen_vocabs
.
After the PR is merged, it will be available in the develop
branch until the next library release.
Example vocabulary definition
The following definition is for the EARL vocabulary, which uses the patch
capability to address inherent problems in the vocabulary definition.
earl: {
uri: "http://www.w3.org/ns/earl#",
source: "http://www.w3.org/ns/earl",
patch: %{
@prefix earl: <http://www.w3.org/ns/earl#>.
@prefix owl: <http://www.w3.org/2002/07/owl#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
AddNew {
# Extends EARL to talk about collections of assertions
earl:Report a rdfs:Class, owl:Class ;
rdfs:label "Report" ;
rdfs:comment "A collection of earl:Assertion" .
earl:assertion a owl:ObjectProperty, rdfs:Property ;
rdfs:label "assertion" ;
rdfs:comment "Test Assertions associated with an earl:Report or earl:TestCase" ;
rdfs:domain [
a owl:Class ;
owl:unionOf (earl:Report earl:TestCase)
] ;
rdfs:range earl:Assertion .
} .
}
}
Change Log
Authors
Contributing
This repository uses Git Flow to mange development and release activity. All submissions must be on a feature branch based on the develop branch to ease staging and integration.
- Do your best to adhere to the existing coding conventions and idioms.
- Don't use hard tabs, and don't leave trailing whitespace on any line.
Before committing, run
git diff --check
to make sure of this. - Do document every method you add using YARD annotations. Read the tutorial or just look at the existing code for examples.
- Don't touch the
.gemspec
orVERSION
files. If you need to change them, do so on your private branch only. - Do note that in order for us to merge any non-trivial changes (as a rule of thumb, additions larger than about 15 lines of code), we need an explicit public domain dedication on record from you, which you will be asked to agree to on the first commit to a repo within the organization. Note that the agreement applies to all repos in the Ruby RDF organization.
License
This is free and unencumbered public domain software. For more information, see https://unlicense.org/ or the accompanying LICENSE file.