buda-base / owl-schema

BDRC Ontology Schema
11 stars 2 forks source link
owl-ontology

Buddhist Digital Ontology vocabulary

This repository contains the files that define the Buddhist Digital Ontology (BDO).

Organization of the Ontology components

The overall ontology is organized in a collection of directories and files as follows:

Using ont-policy.rdf

The policy is used with the Jena library to locate components of the ontology and cache them for later use. There are two ways to load an ontology: 1) processing imports; and 2) ignoring imports during loading of an ontology document.

import org.apache.jena.ontology.OntDocumentManager;
import org.apache.jena.ontology.OntModel;
import org.apache.jena.ontology.OntModelSpec;

public class OntExample {

    static String bdoNS = "http://purl.bdrc.io/ontology/core/";
    static String policyURL = "https://raw.githubusercontent.com/buda-base/owl-schema/master/ont-policy.rdf";
    public static void main( String[] args ){

        OntDocumentManager ontMgr = new OntDocumentManager( policyURL );
        ontMgr.setProcessImports( true ); // default but it doesn't hurt to be explicit

        OntModelSpec ontSpec = new OntModelSpec( OntModelSpec.OWL_DL_MEM );
        ontSpec.setDocumentManager( ontMgr );

        OntModel bdoModel = ontMgr.getOntology( bdoNS, ontSpecImporting );
        System.out.println( "bdoModel.size() = " + bdoModel.size() + " triples" );
    }
}

The above loads the entire Buddhist Digital Ontology, bdoModel, into a model which can then be interrogated, inferencing run on it and so on. The reported size is currently 4067 triples.

If you want to just access the bdoNS document without processing any of the imports defined in the document then ontMgr.setProcessImports( false ) before using the ontMgr the first time, in which case the reported size currently is 2602 triples

So if you need both aggregate models (all imports processed) and just the documents, then you need two instances of OntDocumentManager one with processImports == true and one with processImports == false.

Changes

See Change log.

RDF 1.0 / 1.1

Protégé handles only RDF 1.0 while TopBraid Composer and Jena handles RDF 1.1. The files are in RDF 1.1 format. They can be easily converted to RDF 1.0 (handled by Protégé) with:

$ sed 's,http://www.w3.org/1999/02/22-rdf-syntax-ns#langString,http://www.w3.org/1999/02/22-rdf-syntax-ns#PlainLiteral' bdo.ttl > bdo-rdf10.ttl

License

All files, such as bdo.ttl and associated documentation are distributed under the CC0 license.