Browse files

first commit

  • Loading branch information...
0 parents commit 0324e89c65087a9ccd7017224cb1f864c2a0873b @ldodds committed Jan 31, 2010
5 .buildpath
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<buildpath>
+ <buildpathentry kind="src" path="lib"/>
+ <buildpathentry kind="con" path="org.eclipse.dltk.launching.INTERPRETER_CONTAINER"/>
+</buildpath>
17 .project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>dowl</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.dltk.core.scriptbuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.dltk.ruby.core.nature</nature>
+ </natures>
+</projectDescription>
1 CHANGES
@@ -0,0 +1 @@
+Changes
1 README
@@ -0,0 +1 @@
+Readme for dowl
72 Rakefile
@@ -0,0 +1,72 @@
+require 'rake'
+require 'rake/gempackagetask'
+require 'rake/rdoctask'
+require 'rake/testtask'
+require 'rake/clean'
+
+NAME = "dowl"
+VER = "0.1"
+
+RDOC_OPTS = ['--quiet', '--title', 'dowl Reference', '--main', 'README']
+
+PKG_FILES = %w( README Rakefile CHANGES ) +
+ Dir.glob("{bin,doc,tests,examples,lib}/**/*")
+
+CLEAN.include ['*.gem', 'pkg']
+SPEC =
+ Gem::Specification.new do |s|
+ s.name = NAME
+ s.version = VER
+ s.platform = Gem::Platform::RUBY
+ s.required_ruby_version = ">= 1.8.5"
+ s.has_rdoc = true
+ s.extra_rdoc_files = ["README", "CHANGES"]
+ s.rdoc_options = RDOC_OPTS
+ s.summary = "dowl OWL/RDF doc generator"
+ s.description = s.summary
+ s.author = "Leigh Dodds"
+ s.email = 'leigh.dodds@talis.com'
+ s.homepage = 'http://www.ldodds.com/projects/dowl'
+ #s.rubyforge_project = ''
+ s.files = PKG_FILES
+ s.require_path = "lib"
+ s.bindir = "bin"
+ s.executables = ["dowl"]
+ s.test_file = "tests/ts_dowl.rb"
+ s.add_dependency("mocha", ">= 0.9.5")
+ end
+
+Rake::GemPackageTask.new(SPEC) do |pkg|
+ pkg.need_tar = true
+end
+
+Rake::RDocTask.new do |rdoc|
+ rdoc.rdoc_dir = 'doc/rdoc'
+ rdoc.options += RDOC_OPTS
+ rdoc.rdoc_files.include("README", "CHANGES", "lib/**/*.rb")
+ rdoc.main = "README"
+
+end
+
+#desc "Publish rdoc output to rubyforge"
+#task "publish-docs" => ["rdoc"] do
+# rubyforge_path = "/var/www/gforge-projects/#{NAME}/"
+# sh "scp -r doc/* " +
+# "#{ENV["RUBYFORGE_USER"]}@rubyforge.org:#{rubyforge_path}",
+# :verbose => true
+#end
+
+Rake::TestTask.new do |test|
+ test.test_files = FileList['tests/tc_*.rb']
+end
+
+desc "Install from a locally built copy of the gem"
+task :install do
+ sh %{rake package}
+ sh %{sudo gem install pkg/#{NAME}-#{VER}}
+end
+
+desc "Uninstall the gem"
+task :uninstall => [:clean] do
+ sh %{sudo gem uninstall #{NAME}}
+end
17 bin/dowl
@@ -0,0 +1,17 @@
+#!/usr/bin/env ruby
+require 'rubygems'
+require 'getoptlong'
+require 'rdf/redland'
+require 'dowl'
+require 'erb'
+
+PROGRAM = File::basename $0
+
+schema = DOWL::Schema.create_from_file(ARGV[0])
+if ARGV[1]
+ generator = DOWL::Generator.new( schema, ARGV[1] )
+else
+ generator = DOWL::Generator.new( schema )
+end
+file = generator.run()
+puts file
526 examples/wo.ttl
@@ -0,0 +1,526 @@
+#General Namespaces
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
+@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
+@prefix owl: <http://www.w3.org/2002/07/owl#>.
+@prefix foaf: <http://xmlns.com/foaf/0.1/>.
+@prefix dcterms: <http://purl.org/dc/terms/>.
+@prefix dctypes: <http://purl.org/dc/dcmitype/>.
+@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
+@prefix vs: <http://www.w3.org/2003/06/sw-vocab-status/ns#> .
+@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
+
+@prefix wo: <http://purl.org/ontology/wo/>.
+
+#Related Vocabularies
+#@prefix uniprot: <http://purl.uniprot.org/core/>.
+#@prefix tc: <http://rs.tdwg.org/ontology/voc/TaxonConcept#>.
+#@prefix tn: <http://rs.tdwg.org/ontology/voc/TaxonName#>.
+#@prefix tr: <http://rs.tdwg.org/ontology/voc/TaxonRank#>.
+
+############################################################################
+# General description of the schema
+############################################################################
+
+<http://purl.org/ontology/wo/>
+ a owl:Ontology;
+ dcterms:title "Wildlife Ontology"@en ;
+ rdfs:comment "A simple vocabulary for describing biological species and related taxa. The vocabulary defines terms for describing the names and ranking of taxa, as well as providing support for describing their habitats, conservation status, and behavioural characteristics, etc"@en ;
+ foaf:maker <http://www.ldodds.com#me> ;
+ dcterms:created "2010-01-12"^^xsd:date ;
+ dcterms:created "2010-01-12"^^xsd:date .
+
+<http://www.ldodds.com#me> a foaf:Person ;
+ foaf:name "Leigh Dodds" .
+
+############################################################################
+# Classes
+############################################################################
+
+wo:TaxonRank
+ a owl:Class;
+ rdfs:label "Taxonomic Rank"@en;
+ rdfs:comment "Generic concept for a taxonomic rank such as a Genus or Species."@en;
+ rdfs:seeAlso <http://en.wikipedia.org/wiki/Taxonomic_rank>;
+ vs:term_status "testing".
+#Could be related to TDWG TaxonRank schema:
+# owl:sameAs tr:TaxonRankTerm.
+
+wo:Kingdom
+ a owl:Class;
+ rdfs:subClassOf wo:TaxonRank;
+ rdfs:label "Kingdom"@en;
+ rdfs:comment "Kingdoms are the major categories into which scientists divide up all living things. The main kingdoms are animals, plants, fungi and bacteria, although there are others. Each kingdom has its own suite of defining characteristics - for instance plants have rigid cell walls, whilst animals do not."@en ;
+ rdfs:seeAlso <http://en.wikipedia.org/wiki/Kingdom_%28biology%29>;
+ rdfs:seeAlso <http://www.bbc.co.uk/nature/kingdom>;
+ vs:term_status "testing".
+#Could be related to TDWG TaxonRank schema:
+# owl:sameAs tr:Kingdom.
+
+wo:Phylum
+ a owl:Class;
+ rdfs:subClassOf wo:TaxonRank;
+ rdfs:label "Phylum"@en;
+ rdfs:comment "A phylum - also known as a division when referring to plants - is a scientfic way of grouping together related organisms. All the members of a phylum have a common ancestor and anatomical similarities. For instance, all the arthropods have external skeletons. Phlya are large groups and are further subdivided into classes, orders, families and so on."@en ;
+ rdfs:seeAlso <http://en.wikipedia.org/wiki/Phylum>;
+ rdfs:seeAlso <http://www.bbc.co.uk/nature/phylum>;
+ vs:term_status "testing".
+#Could be related to TDWG TaxonRank schema:
+# owl:sameAs tr:Phylum.
+
+wo:Class
+ a owl:Class;
+ rdfs:subClassOf wo:TaxonRank;
+ rdfs:label "Class"@en;
+ rdfs:comment "A class is a scientific way to group related organisms together, some examples of classes being jellyfish, reptiles and sea urchins. Classes are big groups and contain within them smaller groupings called orders, families, genera and species."@en;
+ rdfs:seeAlso <http://en.wikipedia.org/wiki/Class_%28biology%29>;
+ rdfs:seeAlso <http://www.bbc.co.uk/nature/class>;
+ vs:term_status "testing".
+#Could be related to TDWG TaxonRank schema:
+# owl:sameAs tr:Class.
+
+wo:Order
+ a owl:Class;
+ rdfs:subClassOf wo:TaxonRank;
+ rdfs:label "Order"@en;
+ rdfs:comment "An order is a scientific way to categorise related organisms. An order is a smaller grouping than a class, but bigger than a family or genus. Examples of orders are willows, cockroaches and primates."@en;
+ rdfs:seeAlso <http://en.wikipedia.org/wiki/Order_%28biology%29>;
+ rdfs:seeAlso <http://www.bbc.co.uk/nature/order>;
+ vs:term_status "testing".
+#Could be related to TDWG TaxonRank schema:
+# owl:sameAs tr:Order.
+
+wo:Family
+ a owl:Class;
+ rdfs:subClassOf wo:TaxonRank;
+ rdfs:label "Family"@en;
+ rdfs:comment "A family is a scientific grouping of closely related organisms. It has smaller groups, called genera and species, within it. A family can have a lot of members or only a few. Examples of families include the cats (Felidae), the gulls (Laridae) and the grasses (Poaceae)."@en;
+ rdfs:seeAlso <http://en.wikipedia.org/wiki/Family_%28biology%29>;
+ rdfs:seeAlso <http://www.bbc.co.uk/nature/family>;
+ vs:term_status "testing".
+#Could be related to TDWG TaxonRank schema:
+# owl:sameAs tr:Family.
+
+wo:Genus
+ a owl:Class;
+ rdfs:subClassOf wo:TaxonRank;
+ rdfs:label "Genus"@en;
+ rdfs:comment "A genus is a scientific way of showing that species are very closed related to each other. In fact the first word of the species' scientific name is its genus. So for lions (Panthera leo), Panthera is the genus and tells us that they are closely related to tigers (Panthera tigris), because they share the name"@en;
+ rdfs:seeAlso <http://en.wikipedia.org/wiki/Genus>;
+ rdfs:seeAlso <http://www.bbc.co.uk/nature/genus>;
+ vs:term_status "testing".
+#Could be related to TDWG TaxonRank schema:
+# owl:sameAs tr:Genus.
+
+wo:Species
+ a owl:Class;
+ rdfs:subClassOf wo:TaxonRank;
+ rdfs:label "Species"@en;
+ rdfs:comment "Generic class defining a biological species"@en;
+ rdfs:seeAlso <http://en.wikipedia.org/wiki/Species>;
+ rdfs:seeAlso <http://www.bbc.co.uk/nature/species>;
+ vs:term_status "testing".
+#Could be related to TDWG TaxonRank schema:
+# owl:sameAs tr:Species.
+
+wo:TaxonName
+ a owl:Class;
+ rdfs:label "Taxon Name"@en;
+ rdfs:comment "A taxonomic name, describing the structure and provenance of a taxonomic name."@en;
+ vs:term_status "testing".
+#Could be related to TDWG TaxonName schema:
+# owl:sameAs tn:TaxonName.
+
+wo:ConservationStatus
+ a owl:Class;
+ rdfs:label "Conservation Status"@en;
+ rdfs:comment "Conservation status as described by the IUCN Red List. Will typically have a number of properties including an official IUCN status, population trend, and a year of assessment."@en;
+ vs:term_status "testing".
+
+wo:Adaptation
+ a owl:Class;
+ rdfs:label "Adaptation"@en;
+ rdfs:comment "An adaptation is any feature of an animal or plant which makes it better suited for a particular habitat or to do a particular task. For instance, being streamlined is an adaptation to swimming fast and being able to survive on very little water is an adaptation to life in the desert."@en;
+ rdfs:seeAlso <http://en.wikipedia.org/wiki/Adaptation>;
+ rdfs:seeAlso <http://www.bbc.co.uk/nature/adaptations>;
+ vs:term_status "testing".
+
+wo:BehaviouralPattern
+ a owl:Class;
+ rdfs:subClassOf wo:Adaptation;
+ rdfs:label "Behavioural Pattern"@en;
+ rdfs:comment "Behavioural pattern describes an animal's dominant way of life. Arboreal animals, for example, live in trees and nocturnal animals are active at night."@en;
+ vs:term_status "testing".
+
+wo:CommunicationAdaptation
+ a owl:Class;
+ rdfs:subClassOf wo:Adaptation;
+ rdfs:label "Communication Adaptation"@en;
+ rdfs:comment "Communication and senses are how an organism perceives the world - for instance through scent or sight - and how it sends messages or warnings to others."@en;
+ vs:term_status "testing".
+
+wo:DevelopmentAdaptation
+ a owl:Class;
+ rdfs:subClassOf wo:Adaptation;
+ rdfs:label "Development Adaptation"@en;
+ rdfs:comment "Development covers all the different stages of life through which an animal or plant passes from conception, through adulthood to death. So a male deer is first an embryo, then a fawn, then a stag, whilst an oak tree goes from acorn to seedling to sapling to mature tree."@en;
+ vs:term_status "testing".
+
+wo:EcosystemRole
+ a owl:Class;
+ rdfs:subClassOf wo:Adaptation;
+ rdfs:label "Ecosystem Role"@en;
+ rdfs:comment "Ecosystem roles are about the part an animal or plant plays in sustaining or maintaining the habitat around them. Bees, for example, pollinate flowers, without which those plants would not produce fruits or seeds. Other species, such as dung beetles, play a vital role in keeping grasslands clear of animal waste and recycling valuable resources."@en;
+ vs:term_status "testing".
+
+wo:FeedingHabit
+ a owl:Class;
+ rdfs:subClassOf wo:Adaptation;
+ rdfs:label "Feeding Habit"@en;
+ rdfs:comment "Feeding habits describe the dominant diet of a particular species or group of species, and how they go about obtaining it."@en;
+ vs:term_status "testing".
+
+wo:LocomotionAdaptation
+ a owl:Class;
+ rdfs:subClassOf wo:Adaptation;
+ rdfs:label "Locomotion"@en;
+ rdfs:comment "Locomotion is how an animal gets around - for instance by swimming, flying or climbing."@en;
+ vs:term_status "testing".
+
+wo:MorphologyAdaptation
+ a owl:Class;
+ rdfs:subClassOf wo:Adaptation;
+ rdfs:label "Morphology"@en;
+ rdfs:comment "Morphology is anything to do with what a plant or animal looks like - its size, shape, colour or structure."@en;
+ vs:term_status "testing".
+
+wo:PredationAdaptation
+ a owl:Class;
+ rdfs:subClassOf wo:Adaptation;
+ rdfs:label "Predation Adaptation"@en;
+ rdfs:comment "Predation is catching and killing an animal in order to eat it. The prey can be chased, ambushed or caught in a trap such as a spider's web."@en;
+ vs:term_status "testing".
+
+wo:ReproductionAdaptation
+ a owl:Class;
+ rdfs:subClassOf wo:Adaptation;
+ rdfs:label "Reproduction Adaptation"@en;
+ rdfs:comment "Reproduction covers all the tactics and behaviours involved in obtaining a mate, conceiving the next generation and successfully raising them. It includes everything from plants being pollinated, to stags fighting over hinds, to lionesses babysitting their sisters' cubs."@en;
+ vs:term_status "testing".
+
+wo:SocialBehaviour
+ a owl:Class;
+ rdfs:subClassOf wo:Adaptation;
+ rdfs:label "Social Behaviour"@en;
+ rdfs:comment "Social behaviour is all about how an animal interacts with members of its own species. For instance, does it live in a colony or on its own, does it fight to be top of the pecking order, or does it try to keep strangers away from its home?"@en;
+ vs:term_status "testing".
+
+wo:Habitat
+ a owl:Class;
+ rdfs:label "Habitat"@en;
+ rdfs:comment "A habitat, or biome, is the type of environment in which plant and animals live. Habitat is dictated by what kinds of plants grow there, the climate and the geography. Rainforest, coral reefs and the tundra are all habitats where particular kinds of plants and animals might be found."@en;
+ rdfs:seeAlso <http://en.wikipedia.org/wiki/Habitat>;
+ rdfs:seeAlso <http://www.bbc.co.uk/nature/habitats>;
+ vs:term_status "testing".
+
+wo:TerrestrialHabitat
+ a owl:Class;
+ rdfs:subClassOf wo:Habitat;
+ rdfs:label "Terrestrial Habitat"@en;
+ rdfs:comment "Terrestrial habitats include forests, grasslands, deserts and rainforests. They are typically defined by factors such as plant structure (trees and grasses), leaf types (eg broadleaf and needleleaf), plant spacing (forest, woodland, savanna) and climate.";
+ vs:term_status "testing".
+
+wo:FreshwaterHabitat
+ a owl:Class;
+ rdfs:subClassOf wo:Habitat;
+ rdfs:label "Freshwater Habitat"@en;
+ rdfs:comment "Freshwater habitats include bogs, ponds, lakes, rivers and streams. About 3% of Earth's water is freshwater, but this includes the water locked up in the ice caps and trapped in rocks and soil as groundwater. Only a tiny fraction (0.014%) is surface water in the form of rivers, lakes and swamps.";
+ vs:term_status "testing".
+
+wo:MarineHabitat
+ a owl:Class;
+ rdfs:subClassOf wo:Habitat;
+ rdfs:label "Marine Habitat"@en;
+ rdfs:comment "Approximately 71% of the Earth's surface is covered by the oceans, an area of some 223698816km/sq. Although marine life evolved around three billion years before life on land, marine habitats are relatively poorly studied and much of the ocean's depths remains unexplored.";
+ vs:term_status "testing".
+
+wo:Ecozone
+ a owl:Class;
+ rdfs:label "Ecozone"@en;
+ rdfs:comment "Ecozones are a method of dividing up the Earth's surface. Each ecozone is a large area that contains a number of habitats, which are linked by the evolutionary history of the animals and plants within them. For instance one ecozone is Australasia, because its marsupials evolved in isolation to mammals in the rest of the world."@en;
+ vs:term_status "testing".
+
+wo:RedListStatus
+ a owl:Class;
+ rdfs:subClassOf skos:Category;
+ rdfs:label "Red List Status"@en;
+ rdfs:comment "A category in the IUCN red list, 2001."@en;
+ rdfs:seeAlso <http://www.iucnredlist.org/technical-documents/categories-and-criteria/2001-categories-criteria>;
+ vs:term_status "testing".
+
+wo:Collection
+ a owl:Class;
+ rdfs:subClassOf dctypes:Collection;
+ rdfs:label "Collection";
+ rdfs:comment "A collection of resources, including documents, multimedia files, programme clips and their associated taxa, which aims to showcase a particular aspect of natural history film-making, or illustrate aspects of the natural world. A collection provides an alternate way to organize content over and above the basic taxonomic hierarchy.";
+ vs:term_status "testing".
+
+############################################################################
+# Object Properties
+############################################################################
+
+wo:kingdom
+ a owl:ObjectProperty;
+ rdfs:label "kingdom"@en;
+ rdfs:comment "associates a taxon rank with a kingdom"@en;
+ rdfs:range wo:Kingdom;
+ rdfs:domain wo:TaxonRank;
+ vs:term_status "testing".
+
+wo:phylum
+ a owl:ObjectProperty;
+ rdfs:label "phylum"@en;
+ rdfs:comment "associates a taxon rank with a phylum"@en;
+ rdfs:range wo:Phylum;
+ rdfs:domain wo:TaxonRank;
+ vs:term_status "testing".
+
+wo:class
+ a owl:ObjectProperty;
+ rdfs:label "class"@en;
+ rdfs:comment "associates a taxon rank with a class"@en;
+ rdfs:range wo:Class;
+ rdfs:domain wo:TaxonRank;
+ vs:term_status "testing".
+
+wo:order
+ a owl:ObjectProperty;
+ rdfs:label "order"@en;
+ rdfs:comment "associates a taxon rank with an order"@en;
+ rdfs:range wo:Kingdom;
+ rdfs:domain wo:TaxonRank;
+ vs:term_status "testing".
+
+wo:family
+ a owl:ObjectProperty;
+ rdfs:label "family"@en;
+ rdfs:comment "associates a taxon rank with a family"@en;
+ rdfs:range wo:Family;
+ rdfs:domain wo:TaxonRank;
+ vs:term_status "testing".
+
+wo:genus
+ a owl:ObjectProperty;
+ rdfs:label "genus"@en;
+ rdfs:comment "associates a taxon rank with a genus"@en;
+ rdfs:range wo:Genus;
+ rdfs:domain wo:TaxonRank;
+ vs:term_status "testing".
+
+wo:species
+ a owl:ObjectProperty;
+ rdfs:label "genus"@en;
+ rdfs:comment "associates a taxon rank with a species"@en;
+ rdfs:range wo:Species;
+ rdfs:domain wo:TaxonRank;
+ vs:term_status "testing".
+
+wo:name
+ a owl:ObjectProperty;
+ rdfs:label "name"@en;
+ rdfs:comment "associates a taxon rank with a taxon name"@en;
+ rdfs:range wo:TaxonName;
+ rdfs:domain wo:TaxonRank;
+ vs:term_status "testing".
+
+wo:conservationStatus
+ a owl:ObjectProperty;
+ rdfs:label "conservation status"@en;
+ rdfs:comment "associates a taxon rank with a description of a recent assessment of its conservation status"@en;
+ rdfs:range wo:ConservationStatus;
+ rdfs:domain wo:TaxonRank;
+ vs:term_status "testing".
+
+#defined as Image but what about KML, etc?
+wo:distributionMap
+ a owl:ObjectProperty;
+ rdfs:label "distribution map"@en;
+ rdfs:comment "associates a habitat, ecozone, or taxon rank with a map depicting its distribution or location"@en;
+ rdfs:range foaf:Image;
+ rdfs:domain [
+ a owl:Class;
+ owl:unionOf (wo:TaxonRank wo:Habitat wo:Ecozone);
+ ];
+ vs:term_status "unstable".
+
+wo:adaptation
+ a owl:ObjectProperty;
+ rdfs:label "adaptation"@en;
+ rdfs:comment "associates a taxon rank with an adaptation which it displays"@en;
+ rdfs:range wo:Adaptation;
+ rdfs:domain wo:TaxonRank;
+ vs:term_status "testing".
+
+wo:habitat
+ a owl:ObjectProperty;
+ rdfs:label "habitat"@en;
+ rdfs:comment "associates a taxon rank with a habitat in which it may typically be found"@en;
+ rdfs:range wo:Habitat;
+ rdfs:domain wo:TaxonRank;
+ vs:term_status "testing".
+
+wo:livesIn
+ a owl:ObjectProperty;
+ rdfs:label "lives in"@en;
+ rdfs:comment "associates a taxon rank with a habitat in which it lives. Sub-property of wo:habitat to be used for members of the animal kingdom"@en;
+ rdfs:range wo:Habitat;
+ rdfs:domain wo:TaxonRank;
+ vs:term_status "testing".
+
+wo:growsIn
+ a owl:ObjectProperty;
+ rdfs:label "lives in"@en;
+ rdfs:comment "associates a taxon rank with a habitat in which it grows. Sub-property of wo:habitat to be used for plants, fungi, etc"@en;
+ rdfs:range wo:Habitat;
+ rdfs:domain wo:TaxonRank;
+ vs:term_status "testing".
+
+
+wo:redListStatus
+ a owl:ObjectProperty;
+ rdfs:label "red list status"@en;
+ rdfs:comment "associates a Conservation Status with a category in the IUCN Red List"@en;
+ rdfs:range wo:RedListStatus;
+ rdfs:domain wo:ConservationStatus;
+ vs:term_status "testing".
+
+wo:collection
+ a owl:ObjectProperty;
+ rdfs:subPropertyOf dcterms:isPartOf;
+ rdfs:label "collection"@en;
+ rdfs:comment "associates a taxon rank, habitat, species, clip with a collection of which it is a member"@en;
+ rdfs:range wo:Collection;
+ vs:term_status "testing".
+
+wo:ecozone
+ a owl:ObjectProperty;
+ rdfs:label "ecozone"@en;
+ rdfs:comment "indicates that a habitat can be found within an ecozone"@en;
+ rdfs:range wo:Ecozone;
+ rdfs:domain wo:Habitat;
+ vs:term_status "testing".
+
+############################################################################
+# Datatype Properties
+############################################################################
+
+wo:commonName
+ a owl:DatatypeProperty;
+ rdfs:label "common name"@en;
+ rdfs:comment "associates a formal taxon name with a common version. E.g. Panthera leo might be associated with a common name of 'Lion'. A given taxon name may have several common names"@en;
+ rdfs:range xsd:string;
+ rdfs:domain wo:TaxonName;
+ vs:term_status "testing".
+
+wo:scientificName
+ a owl:DatatypeProperty;
+ rdfs:label "scientific name"@en;
+ rdfs:comment "associates a taxon name with its formal scientific name. This may be a binomial name (e.g. Panthera leo) in the case of a species name, or a uninomial (e.g. Panthera) name in the case of a name associated with another taxon rank. In formal taxonomic naming conventions, the scientific name is often qualified with the source of the name, e.g. Panthera leo (Linnaeus, 1758)."@en;
+ rdfs:range xsd:string;
+ rdfs:domain wo:TaxonName;
+ vs:term_status "testing".
+
+wo:taxonomicName
+ a owl:DatatypeProperty;
+ rdfs:label "taxonomic name"@en;
+ rdfs:comment "a naming property, associating a formal taxonomic name with a Taxon Name instance. This property is a parent of a number of sub-properties that provide more specific terms for denoting names of families, phyla, species, etc."@en;
+ rdfs:range xsd:string;
+ rdfs:domain wo:TaxonName;
+ vs:term_status "testing".
+
+wo:kingdomName
+ a owl:DatatypeProperty;
+ rdfs:subPropertyOf wo:taxonomicName;
+ rdfs:label "kingdom name"@en;
+ rdfs:comment "Used to specify the name of a kingdom as part of a Taxon Name"@en;
+ vs:term_status "testing".
+
+wo:phylumName
+ a owl:DatatypeProperty;
+ rdfs:subPropertyOf wo:taxonomicName;
+ rdfs:label "phylum name"@en;
+ rdfs:comment "Used to specify the name of a phylum as part of a Taxon Name"@en;
+ vs:term_status "testing".
+
+wo:className
+ a owl:DatatypeProperty;
+ rdfs:subPropertyOf wo:taxonomicName;
+ rdfs:label "class name"@en;
+ rdfs:comment "Used to specify the name of a class as part of a Taxon Name"@en;
+ vs:term_status "testing".
+
+wo:orderName
+ a owl:DatatypeProperty;
+ rdfs:subPropertyOf wo:taxonomicName;
+ rdfs:label "order name"@en;
+ rdfs:comment "Used to specify the name of an order as part of a Taxon Name"@en;
+ vs:term_status "testing".
+
+wo:familyName
+ a owl:DatatypeProperty;
+ rdfs:subPropertyOf wo:taxonomicName;
+ rdfs:label "family name"@en;
+ rdfs:comment "Used to specify the name of a family as part of a Taxon Name"@en;
+ vs:term_status "testing".
+
+wo:genusName
+ a owl:DatatypeProperty;
+ rdfs:subPropertyOf wo:taxonomicName;
+ rdfs:label "genus name"@en;
+ rdfs:comment "specifies the genus part of a binomial name, allowing this portion of the name to be explicitly described. Therefore this property will typically only be used in TaxonNames associated with species. The property is largely provided as a convenience to avoid applications having to parse the binomial name."@en;
+ vs:term_status "testing".
+
+wo:speciesName
+ a owl:DatatypeProperty;
+ rdfs:subPropertyOf wo:taxonomicName;
+ rdfs:label "species name"@en;
+ rdfs:comment "specifies the species part of a binomial name, allowing this portion of the name to be explicitly described. Therefore this property will typically only be used in TaxonNames associated with species. The property is largely provided as a convenience to avoid applications having to parse the binomial name."@en;
+ rdfs:range xsd:string;
+ rdfs:domain wo:TaxonName;
+ vs:term_status "testing".
+
+#should be a URI?
+wo:populationTrend
+ a owl:DatatypeProperty;
+ rdfs:label "population trend"@en;
+ rdfs:comment "provides some indication of the population trend associated with an assessment of a taxon's conversation status. The value of this property is a simple literal, and is recommended to be one of: Decreasing, Increasing, Stable, Unknown."@en;
+ rdfs:range xsd:string;
+ rdfs:domain wo:ConservationStatus;
+ vs:term_status "unstable".
+
+wo:yearAssessed
+ a owl:DatatypeProperty;
+ rdfs:label "year assessed"@en;
+ rdfs:comment "the year in which the conservation status was assessed."@en;
+ rdfs:range xsd:string;
+ rdfs:domain wo:ConservationStatus;
+ vs:term_status "testing".
+
+wo:threatDescription
+ a owl:DatatypeProperty;
+ rdfs:label "threatDescription"@en;
+ rdfs:comment "description of the threat(s) that have been identified as part of the assessment of the Conservation Status of a taxon"@en;
+ rdfs:range xsd:string;
+ rdfs:domain wo:ConservationStatus;
+ vs:term_status "testing".
+
+wo:shortDescription
+ a owl:DatatypeProperty;
+ rdfs:label "short description"@en;
+ rdfs:comment "associates a short description with a Collection."@en;
+ rdfs:range xsd:string;
+ rdfs:domain [
+ a owl:Class;
+ owl:unionOf (wo:Collection wo:Ecozone);
+ ];
+ vs:term_status "testing".
+
50 lib/dowl.rb
@@ -0,0 +1,50 @@
+require 'rubygems'
+require 'erb'
+require 'rdf/redland'
+
+require 'dowl/util'
+require 'dowl/schema'
+require 'dowl/class'
+require 'dowl/property'
+require 'dowl/ontology'
+require 'dowl/generator'
+
+module DOWL
+
+ class Namespaces
+
+ OWLNS = Redland::Namespace.new("http://www.w3.org/2002/07/owl#")
+
+ OWL_CLASS = OWLNS["Class"]
+ OWL_ONTOLOGY = OWLNS["Ontology"]
+ OWL_DATATYPE_PROPERTY = OWLNS["DatatypeProperty"]
+ OWL_OBJECT_PROPERTY = OWLNS["ObjectProperty"]
+
+ RDFS = Redland::Namespace.new("http://www.w3.org/2000/01/rdf-schema#")
+
+ RDFS_CLASS = RDFS["Class"]
+ RDFS_LABEL = RDFS["label"]
+ RDFS_COMMENT = RDFS["comment"]
+ RDFS_SUB_CLASS_OF = RDFS["subClassOf"]
+ RDFS_SUB_PROPERTY_OF = RDFS["subPropertyOf"]
+ RDFS_SEE_ALSO = RDFS["seeAlso"]
+ RDFS_RANGE = RDFS["range"]
+ RDFS_DOMAIN = RDFS["domain"]
+
+ VS = Redland::Namespace.new("http://www.w3.org/2003/06/sw-vocab-status/ns#")
+
+ VS_STATUS = VS["term_status"]
+
+ DCTERMS = Redland::Namespace.new("http://purl.org/dc/terms/")
+ DCTERMS_TITLE = DCTERMS["title"]
+ DCTERMS_CREATED = DCTERMS["created"]
+ DCTERMS_MODIFIED = DCTERMS["modified"]
+
+ FOAF = Redland::Namespace.new("http://xmlns.com/foaf/0.1/")
+
+ FOAF_MAKER = FOAF["maker"]
+ FOAF_NAME = FOAF["name"]
+
+ end
+
+end
53 lib/dowl/class.rb
@@ -0,0 +1,53 @@
+module DOWL
+
+ class Class < DOWL::LabelledDocObject
+ include Comparable
+
+ attr_reader :resource
+
+ def initialize(resource, schema)
+ super(resource, schema)
+ end
+
+ def uri
+ return @resource.uri.to_s
+ end
+
+ def sub_class_of()
+ parent = @resource.get_property(DOWL::Namespaces::RDFS_SUB_CLASS_OF)
+ if parent
+ uri = parent.uri.to_s
+ if @schema.classes[uri]
+ return @schema.classes[uri]
+ else
+ return uri
+ end
+ end
+ return nil
+ end
+
+ def see_alsos()
+ seeAlsos = @resource.get_properties(DOWL::Namespaces::RDFS_SEE_ALSO)
+ links = []
+ seeAlsos.each do |obj|
+ links << obj.uri
+ end
+ return links
+ end
+
+ def to_s
+ return short_name
+ end
+
+ def sub_classes()
+ children = @resource.model.find(nil, DOWL::Namespaces::RDFS_SUB_CLASS_OF, @resource)
+ list = []
+ children.each do |child|
+ list << DOWL::Class.new(child.subject, @schema)
+ end
+ return list
+ end
+
+ end
+
+end
226 lib/dowl/default.erb
@@ -0,0 +1,226 @@
+<html>
+ <head>
+ <title><%= schema.ontology.title %></title>
+ </head>
+ <body>
+ <h1><%= schema.ontology.title %></h1>
+
+ <dl>
+ <dt>Latest Version</dt>
+ <dd><a href="<%= schema.ontology.uri %>"><%= schema.ontology.uri %></a></dd>
+ <% if schema.ontology.created %>
+ <dt>Created</dt>
+ <dd><%= schema.ontology.created %></dd>
+ <% end %>
+ <% if schema.ontology.modified %>
+ <dt>Last Modified</dt>
+ <dd><%= schema.ontology.modified %></dd>
+ <% end %>
+ <dt>Authors</dt>
+ <dd><% schema.ontology.authors.each do |author| %><a href="<%= author.uri %>"><%= author.name %></a><%end%></dd>
+ </dl>
+
+ <h1>Abstract</h1>
+
+ <%= schema.ontology.comment %>
+
+ <% if introduction %>
+ <%= introduction %>
+ <% end %>
+
+ <div id="overview">
+ <h2>Overview Of Terms</h2>
+ <p>An alphabetical index of the ontology terms, divided into classes, properties and individuals. All the terms are hyperlinked to their
+ detailed description for quick reference.
+ </p>
+
+ <p><strong>Classes</strong>:
+ <% schema.list_classes().each do |key,val| %>
+ | <a href="#class_<%= val.short_name %>"><%= val.short_name %></a>
+ <% end %>
+ </p>
+ <p><strong>Properties</strong>:
+ <% schema.list_properties().each do |key,val| %>
+ | <a href="#prop_<%= val.short_name %>"><%= val.short_name %></a>
+ <% end %>
+ </p>
+ </div>
+
+ <div id="terms">
+ <h2>Ontology Terms</h2>
+ </div>
+
+ <div id="classes">
+ <h3>Classes</h3>
+
+ <%schema.list_classes().each do |t| %>
+ <div class="term" id="class_<%= t[1].short_name %>">
+ <h4>Class: <%= t[1].short_name %></h4>
+ <table>
+ <tr><td class="label">Label</td><td><%= t[1].label %> </ts></tr>
+ <tr><td class="label">Status</td><td><%= t[1].status %> </ts></tr>
+ <% if t[1].sub_class_of %>
+ <% if t[1].sub_class_of.class.to_s == "String" %>
+ <tr><td class="label">Has Parent Class</td><td><a href="<%= t[1].sub_class_of %>"><%= t[1].sub_class_of %></a></td></tr>
+ <% else %>
+ <tr><td class="label">Has Parent Class</td><td><a href="#class_<%= t[1].sub_class_of.short_name %>"><%= t[1].sub_class_of.short_name %></a></td></tr>
+ <% end %>
+ <% end %>
+ <% if t[1].sub_classes.length > 0 %>
+ <tr>
+ <td class="label">Sub-Classes</td>
+ <td>
+ <% t[1].sub_classes.each do |child| %>
+ <a href="#class_<%= child.short_name %>"><%= child.short_name %></a>
+ <% end %>
+ </td>
+ </tr>
+ <% end %>
+ </table>
+ <p><%= t[1].comment %> </p>
+ <% if t[1].see_alsos.length > 0 %>
+ <p><em>Further Reading:</em></p>
+ <ul>
+ <% t[1].see_alsos.each do |link| %>
+ <li><a href="<%= link %>"><%= link %></a></li>
+ <% end %>
+ </ul>
+ <% end %>
+ </div>
+ <%end%>
+
+ </div>
+
+ <div id="properties">
+ <h3>Object Properties</h3>
+
+ <% schema.list_object_properties().each do |t| %>
+ <div class="term" id="prop_<%= t[1].short_name %>">
+ <h4>Property: <%= t[1].short_name %></h4>
+ <table>
+ <tr><td class="label">Label</td><td><%= t[1].label %> </ts></tr>
+ <tr><td class="label">Status</td><td><%= t[1].status %> </ts></tr>
+ <% if t[1].sub_property_of %>
+ <% if t[1].sub_property_of.class.to_s == "String" %>
+ <tr><td class="label">Has Parent Property</td><td><a href="<%= t[1].sub_property_of %>"><%= t[1].sub_property_of %></a></td></tr>
+ <% else %>
+ <tr><td class="label">Has Parent Property</td><td><a href="#prop_<%= t[1].sub_property_of.short_name %>"><%= t[1].sub_property_of.short_name %></a></td></tr>
+ <% end %>
+ <% end %>
+ <% if t[1].sub_properties.length > 0 %>
+ <tr>
+ <td class="label">Sub-Properties</td>
+ <td>
+ <% t[1].sub_properties.each do |child| %>
+ <a href="#class_<%= child.short_name %>"><%= child.short_name %></a>
+ <% end %>
+ </td>
+ </tr>
+ <% end %>
+ <% if t[1].range.length > 0 %>
+ <tr><td class="label">Range</td>
+ <td>
+ <% t[1].range.each do |cls| %>
+ <% if cls.class.to_s == "String" %>
+ <a href="<%= cls %>"><%= cls %></a>
+ <% else %>
+ <a href="#class_<%= cls.short_name %>"><%= cls.short_name %></a>
+ <% end %>
+ <% end %>
+ </td>
+ </tr>
+ <% end %>
+ <% if t[1].domain.length > 0 %>
+ <tr><td class="label">Domain</td>
+ <td>
+ <% t[1].domain.each do |cls| %>
+ <% if cls.class.to_s == "String" %>
+ <a href="<%= cls %>"><%= cls %></a>
+ <% else %>
+ <a href="#class_<%= cls.short_name %>"><%= cls.short_name %></a>
+ <% end %>
+ <% end %>
+ </td>
+ </tr>
+ <% end %>
+ </table>
+ <p><%= t[1].comment %> </p>
+ <% if t[1].see_alsos.length > 0 %>
+ <p><em>Further Reading:</em></p>
+ <ul>
+ <% t[1].see_alsos.each do |link| %>
+ <li><a href="<%= link %>"><%= link %></a></li>
+ <% end %>
+ </ul>
+ <% end %>
+ </div>
+ <%end%>
+
+
+ <h3>Datatype Properties</h3>
+
+ <%schema.list_datatype_properties().each do |t| %>
+ <div class="term" id="prop_<%= t[1].short_name %>">
+ <h4>Property: <%= t[1].short_name %></h4>
+ <table>
+ <tr><td class="label">Label</td><td><%= t[1].label %> </ts></tr>
+ <tr><td class="label">Status</td><td><%= t[1].status %> </ts></tr>
+ <% if t[1].sub_property_of %>
+ <% if t[1].sub_property_of.class.to_s == "String" %>
+ <tr><td class="label">Has Parent Property</td><td><a href="<%= t[1].sub_property_of %>"><%= t[1].sub_property_of %></a></td></tr>
+ <% else %>
+ <tr><td class="label">Has Parent Property</td><td><a href="#prop_<%= t[1].sub_property_of.short_name %>"><%= t[1].sub_property_of.short_name %></a></td></tr>
+ <% end %>
+ <% end %>
+ <% if t[1].sub_properties.length > 0 %>
+ <tr>
+ <td class="label">Sub-Properties</td>
+ <td>
+ <% t[1].sub_properties.each do |child| %>
+ <a href="#class_<%= child.short_name %>"><%= child.short_name %></a>
+ <% end %>
+ </td>
+ </tr>
+ <% end %>
+ <% if t[1].range.length > 0 %>
+ <tr><td class="label">Range</td>
+ <td>
+ <% t[1].range.each do |cls| %>
+ <% if cls.class.to_s == "String" %>
+ <a href="<%= cls %>"><%= cls %></a>
+ <% else %>
+ <a href="#class_<%= cls.short_name %>"><%= cls.short_name %></a>
+ <% end %>
+ <% end %>
+ </td>
+ </tr>
+ <% end %>
+ <% if t[1].domain.length > 0 %>
+ <tr><td class="label">Domain</td>
+ <td>
+ <% t[1].domain.each do |cls| %>
+ <% if cls.class.to_s == "String" %>
+ <a href="<%= cls %>"><%= cls %></a>
+ <% else %>
+ <a href="#class_<%= cls.short_name %>"><%= cls.short_name %></a>
+ <% end %>
+ <% end %>
+ </td>
+ </tr>
+ <% end %>
+ </table>
+ <p><%= t[1].comment %> </p>
+ <% if t[1].see_alsos.length > 0 %>
+ <p><em>Further Reading:</em></p>
+ <ul>
+ <% t[1].see_alsos.each do |link| %>
+ <li><a href="<%= link %>"><%= link %></a></li>
+ <% end %>
+ </ul>
+ <% end %>
+ </div>
+ <%end%>
+
+ </div>
+ </body>
+</html>
27 lib/dowl/generator.rb
@@ -0,0 +1,27 @@
+module DOWL
+
+ class Generator
+
+ def initialize(schema, template=Generator.default_template())
+ @template = ERB.new(File.read(template))
+ @schema = schema
+ if schema.introduction
+ @introduction = File.read(schema.introduction)
+ end
+ end
+
+ def Generator.default_template()
+ dir = File.dirname( __FILE__ )
+ return default_template_file = File.join(dir, "default.erb")
+ end
+
+ def run()
+ b = binding
+ schema = @schema
+ introduction = @introduction
+ return @template.result(b)
+ end
+
+ end
+
+end
62 lib/dowl/ontology.rb
@@ -0,0 +1,62 @@
+require 'dowl'
+
+module DOWL
+
+ class Person < DOWL::DocObject
+ def initialize(resource, schema)
+ super(resource, schema)
+ end
+
+ def uri()
+ return @resource.uri
+ end
+
+ def name()
+ return get_literal(DOWL::Namespaces::FOAF_NAME)
+ end
+
+ def <=>(other)
+ return name() <=> other.name()
+ end
+
+ end
+
+ class Ontology < DOWL::DocObject
+
+ def initialize(resource, schema)
+ super(resource, schema)
+ end
+
+ def uri()
+ return @resource.uri.to_s
+ end
+
+ def title()
+ return get_literal(DOWL::Namespaces::DCTERMS_TITLE)
+ end
+
+ def comment()
+ return get_literal(DOWL::Namespaces::RDFS_COMMENT)
+ end
+
+ def created()
+ return get_literal(DOWL::Namespaces::DCTERMS_CREATED)
+ end
+
+ def modified()
+ return get_literal(DOWL::Namespaces::DCTERMS_MODIFIED)
+ end
+
+ def authors()
+ people = @resource.get_properties(DOWL::Namespaces::FOAF_MAKER)
+ authors = []
+ if people
+ people.each do |s|
+ authors << Person.new(s, @schema)
+ end
+ end
+ return authors.sort
+ end
+
+ end
+end
79 lib/dowl/property.rb
@@ -0,0 +1,79 @@
+require 'dowl'
+
+module DOWL
+
+ class Property < DOWL::LabelledDocObject
+
+ def initialize(resource, schema)
+ super(resource, schema)
+ end
+
+ def see_alsos()
+ seeAlsos = @resource.get_properties(DOWL::Namespaces::RDFS_SEE_ALSO)
+ links = []
+ seeAlsos.each do |obj|
+ links << obj.uri
+ end
+ return links
+ end
+
+ def sub_property_of()
+ parent = @resource.get_property(DOWL::Namespaces::RDFS_SUB_PROPERTY_OF)
+ if parent
+ uri = parent.uri.to_s
+ if @schema.properties[uri]
+ return @schema.properties[uri]
+ else
+ return uri
+ end
+ end
+ return nil
+ end
+
+ def range()
+ ranges = @resource.get_properties(DOWL::Namespaces::RDFS_RANGE)
+ classes = []
+ if ranges
+ ranges.each do |o|
+ if o.resource?
+ uri = o.uri.to_s
+ if @schema.classes[uri]
+ classes << @schema.classes[uri]
+ else
+ classes << uri
+ end
+ end
+ end
+ end
+ return classes
+ end
+
+ def domain()
+ domains = @resource.get_properties(DOWL::Namespaces::RDFS_DOMAIN)
+ classes = []
+ if domains
+ domains.each do |o|
+ if o.resource?
+ uri = o.uri.to_s
+ if @schema.classes[uri]
+ classes << @schema.classes[uri]
+ else
+ classes << uri
+ end
+ end
+ #TODO union
+ end
+ end
+ return classes
+ end
+
+ def sub_properties()
+ children = @resource.model.find(nil, DOWL::Namespaces::RDFS_SUB_PROPERTY_OF, @resource)
+ list = []
+ children.each do |child|
+ list << DOWL::Property.new(child.subject, @schema)
+ end
+ return list
+ end
+ end
+end
91 lib/dowl/schema.rb
@@ -0,0 +1,91 @@
+module DOWL
+
+ #Utility class providing access to information about the schema, e.g. its description, lists of classes, etc
+ class Schema
+
+ attr_reader :model
+ attr_reader :introduction
+ attr_reader :datatype_properties
+ attr_reader :object_properties
+ attr_reader :classes
+
+ def initialize(model, introduction=nil)
+ @model = model
+ @introduction = introduction
+ init()
+ end
+
+ def Schema.create_from_file(file=nil, format="turtle", mimetype="", base=nil)
+ if file == nil
+ raise "Filename should be provided"
+ end
+ model = Redland::Model.new()
+ parser = Redland::Parser.new(format, mimetype, base)
+ parser.parse_into_model(model,"file:#{file}")
+
+ dir = File.dirname(file)
+ introduction = File.join(dir, "introduction.html")
+ if File.exists?(introduction)
+ return Schema.new(model, introduction)
+ end
+ return Schema.new(model)
+ end
+
+ def init()
+ @classes = Hash.new
+ init_classes( DOWL::Namespaces::OWL_CLASS )
+ init_classes( DOWL::Namespaces::RDFS_CLASS )
+ ontology = model.subject(Redland::TYPE, DOWL::Namespaces::OWL_ONTOLOGY)
+ if ontology
+ @ontology = Ontology.new(ontology, self)
+ end
+ @datatype_properties = init_properties( DOWL::Namespaces::OWL_DATATYPE_PROPERTY)
+ @object_properties = init_properties( DOWL::Namespaces::OWL_OBJECT_PROPERTY)
+ end
+
+ def ontology()
+ return @ontology
+ end
+
+ def init_classes(type)
+ model.find(nil, Redland::TYPE, type) do |s,p,o|
+ if s.resource?
+ cls = DOWL::Class.new(s, self)
+ @classes[ s.uri.to_s ] = cls
+ end
+ end
+ end
+
+ def init_properties(type)
+ properties = Hash.new
+ model.find(nil, Redland::TYPE, type) do |s,p,o|
+ properties[ s.uri.to_s] = DOWL::Property.new(s, self)
+ end
+ return properties
+ end
+
+ def properties()
+ return @datatype_properties.merge( @object_properties )
+ end
+
+ def list_properties()
+ return properties().sort { |x,y| x[1] <=> y[1] }
+ end
+
+ def list_datatype_properties()
+ return datatype_properties().sort { |x,y| x[1] <=> y[1] }
+ end
+
+ def list_object_properties()
+ return object_properties().sort { |x,y| x[1] <=> y[1] }
+ end
+
+ #Return sorted, nested array
+ def list_classes()
+ sorted = classes().sort { |x,y| x[1] <=> y[1] }
+ return sorted
+ end
+
+ end
+
+end
44 lib/dowl/util.rb
@@ -0,0 +1,44 @@
+module DOWL
+
+ class DocObject
+ attr_reader :resource
+ attr_reader :schema
+ def initialize(resource, schema)
+ @resource = resource
+ @schema = schema
+ end
+
+ def get_literal(property)
+ object = @resource.get_property(property)
+ if object
+ return object.value
+ end
+ return nil
+ end
+
+ end
+
+ class LabelledDocObject < DOWL::DocObject
+ def initialize(resource, schema)
+ super(resource, schema)
+ end
+ def short_name()
+ uri = resource.uri.to_s
+ ontology_uri = schema.ontology.uri.to_s
+ return uri.gsub(ontology_uri, "")
+ end
+ def label()
+ return get_literal(DOWL::Namespaces::RDFS_LABEL)
+ end
+ def comment()
+ return get_literal(DOWL::Namespaces::RDFS_COMMENT)
+ end
+ def status()
+ return get_literal(DOWL::Namespaces::VS_STATUS)
+ end
+ def <=>(other)
+ return label().downcase <=> other.label().downcase
+ end
+ end
+
+end
BIN pkg/dowl-0.1.gem
Binary file not shown.
BIN pkg/dowl-0.1.tgz
Binary file not shown.
1 pkg/dowl-0.1/CHANGES
@@ -0,0 +1 @@
+Changes
1 pkg/dowl-0.1/README
@@ -0,0 +1 @@
+Readme for dowl
72 pkg/dowl-0.1/Rakefile
@@ -0,0 +1,72 @@
+require 'rake'
+require 'rake/gempackagetask'
+require 'rake/rdoctask'
+require 'rake/testtask'
+require 'rake/clean'
+
+NAME = "dowl"
+VER = "0.1"
+
+RDOC_OPTS = ['--quiet', '--title', 'dowl Reference', '--main', 'README']
+
+PKG_FILES = %w( README Rakefile CHANGES ) +
+ Dir.glob("{bin,doc,tests,examples,lib}/**/*")
+
+CLEAN.include ['*.gem', 'pkg']
+SPEC =
+ Gem::Specification.new do |s|
+ s.name = NAME
+ s.version = VER
+ s.platform = Gem::Platform::RUBY
+ s.required_ruby_version = ">= 1.8.5"
+ s.has_rdoc = true
+ s.extra_rdoc_files = ["README", "CHANGES"]
+ s.rdoc_options = RDOC_OPTS
+ s.summary = "dowl OWL/RDF doc generator"
+ s.description = s.summary
+ s.author = "Leigh Dodds"
+ s.email = 'leigh.dodds@talis.com'
+ s.homepage = 'http://www.ldodds.com/projects/dowl'
+ #s.rubyforge_project = ''
+ s.files = PKG_FILES
+ s.require_path = "lib"
+ s.bindir = "bin"
+ s.executables = ["dowl"]
+ s.test_file = "tests/ts_dowl.rb"
+ s.add_dependency("mocha", ">= 0.9.5")
+ end
+
+Rake::GemPackageTask.new(SPEC) do |pkg|
+ pkg.need_tar = true
+end
+
+Rake::RDocTask.new do |rdoc|
+ rdoc.rdoc_dir = 'doc/rdoc'
+ rdoc.options += RDOC_OPTS
+ rdoc.rdoc_files.include("README", "CHANGES", "lib/**/*.rb")
+ rdoc.main = "README"
+
+end
+
+#desc "Publish rdoc output to rubyforge"
+#task "publish-docs" => ["rdoc"] do
+# rubyforge_path = "/var/www/gforge-projects/#{NAME}/"
+# sh "scp -r doc/* " +
+# "#{ENV["RUBYFORGE_USER"]}@rubyforge.org:#{rubyforge_path}",
+# :verbose => true
+#end
+
+Rake::TestTask.new do |test|
+ test.test_files = FileList['tests/tc_*.rb']
+end
+
+desc "Install from a locally built copy of the gem"
+task :install do
+ sh %{rake package}
+ sh %{sudo gem install pkg/#{NAME}-#{VER}}
+end
+
+desc "Uninstall the gem"
+task :uninstall => [:clean] do
+ sh %{sudo gem uninstall #{NAME}}
+end
17 pkg/dowl-0.1/bin/dowl
@@ -0,0 +1,17 @@
+#!/usr/bin/env ruby
+require 'rubygems'
+require 'getoptlong'
+require 'rdf/redland'
+require 'dowl'
+require 'erb'
+
+PROGRAM = File::basename $0
+
+schema = DOWL::Schema.create_from_file(ARGV[0])
+if ARGV[1]
+ generator = DOWL::Generator.new( schema, ARGV[1] )
+else
+ generator = DOWL::Generator.new( schema )
+end
+file = generator.run()
+puts file
526 pkg/dowl-0.1/examples/wo.ttl
@@ -0,0 +1,526 @@
+#General Namespaces
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
+@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
+@prefix owl: <http://www.w3.org/2002/07/owl#>.
+@prefix foaf: <http://xmlns.com/foaf/0.1/>.
+@prefix dcterms: <http://purl.org/dc/terms/>.
+@prefix dctypes: <http://purl.org/dc/dcmitype/>.
+@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
+@prefix vs: <http://www.w3.org/2003/06/sw-vocab-status/ns#> .
+@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
+
+@prefix wo: <http://purl.org/ontology/wo/>.
+
+#Related Vocabularies
+#@prefix uniprot: <http://purl.uniprot.org/core/>.
+#@prefix tc: <http://rs.tdwg.org/ontology/voc/TaxonConcept#>.
+#@prefix tn: <http://rs.tdwg.org/ontology/voc/TaxonName#>.
+#@prefix tr: <http://rs.tdwg.org/ontology/voc/TaxonRank#>.
+
+############################################################################
+# General description of the schema
+############################################################################
+
+<http://purl.org/ontology/wo/>
+ a owl:Ontology;
+ dcterms:title "Wildlife Ontology"@en ;
+ rdfs:comment "A simple vocabulary for describing biological species and related taxa. The vocabulary defines terms for describing the names and ranking of taxa, as well as providing support for describing their habitats, conservation status, and behavioural characteristics, etc"@en ;
+ foaf:maker <http://www.ldodds.com#me> ;
+ dcterms:created "2010-01-12"^^xsd:date ;
+ dcterms:created "2010-01-12"^^xsd:date .
+
+<http://www.ldodds.com#me> a foaf:Person ;
+ foaf:name "Leigh Dodds" .
+
+############################################################################
+# Classes
+############################################################################
+
+wo:TaxonRank
+ a owl:Class;
+ rdfs:label "Taxonomic Rank"@en;
+ rdfs:comment "Generic concept for a taxonomic rank such as a Genus or Species."@en;
+ rdfs:seeAlso <http://en.wikipedia.org/wiki/Taxonomic_rank>;
+ vs:term_status "testing".
+#Could be related to TDWG TaxonRank schema:
+# owl:sameAs tr:TaxonRankTerm.
+
+wo:Kingdom
+ a owl:Class;
+ rdfs:subClassOf wo:TaxonRank;
+ rdfs:label "Kingdom"@en;
+ rdfs:comment "Kingdoms are the major categories into which scientists divide up all living things. The main kingdoms are animals, plants, fungi and bacteria, although there are others. Each kingdom has its own suite of defining characteristics - for instance plants have rigid cell walls, whilst animals do not."@en ;
+ rdfs:seeAlso <http://en.wikipedia.org/wiki/Kingdom_%28biology%29>;
+ rdfs:seeAlso <http://www.bbc.co.uk/nature/kingdom>;
+ vs:term_status "testing".
+#Could be related to TDWG TaxonRank schema:
+# owl:sameAs tr:Kingdom.
+
+wo:Phylum
+ a owl:Class;
+ rdfs:subClassOf wo:TaxonRank;
+ rdfs:label "Phylum"@en;
+ rdfs:comment "A phylum - also known as a division when referring to plants - is a scientfic way of grouping together related organisms. All the members of a phylum have a common ancestor and anatomical similarities. For instance, all the arthropods have external skeletons. Phlya are large groups and are further subdivided into classes, orders, families and so on."@en ;
+ rdfs:seeAlso <http://en.wikipedia.org/wiki/Phylum>;
+ rdfs:seeAlso <http://www.bbc.co.uk/nature/phylum>;
+ vs:term_status "testing".
+#Could be related to TDWG TaxonRank schema:
+# owl:sameAs tr:Phylum.
+
+wo:Class
+ a owl:Class;
+ rdfs:subClassOf wo:TaxonRank;
+ rdfs:label "Class"@en;
+ rdfs:comment "A class is a scientific way to group related organisms together, some examples of classes being jellyfish, reptiles and sea urchins. Classes are big groups and contain within them smaller groupings called orders, families, genera and species."@en;
+ rdfs:seeAlso <http://en.wikipedia.org/wiki/Class_%28biology%29>;
+ rdfs:seeAlso <http://www.bbc.co.uk/nature/class>;
+ vs:term_status "testing".
+#Could be related to TDWG TaxonRank schema:
+# owl:sameAs tr:Class.
+
+wo:Order
+ a owl:Class;
+ rdfs:subClassOf wo:TaxonRank;
+ rdfs:label "Order"@en;
+ rdfs:comment "An order is a scientific way to categorise related organisms. An order is a smaller grouping than a class, but bigger than a family or genus. Examples of orders are willows, cockroaches and primates."@en;
+ rdfs:seeAlso <http://en.wikipedia.org/wiki/Order_%28biology%29>;
+ rdfs:seeAlso <http://www.bbc.co.uk/nature/order>;
+ vs:term_status "testing".
+#Could be related to TDWG TaxonRank schema:
+# owl:sameAs tr:Order.
+
+wo:Family
+ a owl:Class;
+ rdfs:subClassOf wo:TaxonRank;
+ rdfs:label "Family"@en;
+ rdfs:comment "A family is a scientific grouping of closely related organisms. It has smaller groups, called genera and species, within it. A family can have a lot of members or only a few. Examples of families include the cats (Felidae), the gulls (Laridae) and the grasses (Poaceae)."@en;
+ rdfs:seeAlso <http://en.wikipedia.org/wiki/Family_%28biology%29>;
+ rdfs:seeAlso <http://www.bbc.co.uk/nature/family>;
+ vs:term_status "testing".
+#Could be related to TDWG TaxonRank schema:
+# owl:sameAs tr:Family.
+
+wo:Genus
+ a owl:Class;
+ rdfs:subClassOf wo:TaxonRank;
+ rdfs:label "Genus"@en;
+ rdfs:comment "A genus is a scientific way of showing that species are very closed related to each other. In fact the first word of the species' scientific name is its genus. So for lions (Panthera leo), Panthera is the genus and tells us that they are closely related to tigers (Panthera tigris), because they share the name"@en;
+ rdfs:seeAlso <http://en.wikipedia.org/wiki/Genus>;
+ rdfs:seeAlso <http://www.bbc.co.uk/nature/genus>;
+ vs:term_status "testing".
+#Could be related to TDWG TaxonRank schema:
+# owl:sameAs tr:Genus.
+
+wo:Species
+ a owl:Class;
+ rdfs:subClassOf wo:TaxonRank;
+ rdfs:label "Species"@en;
+ rdfs:comment "Generic class defining a biological species"@en;
+ rdfs:seeAlso <http://en.wikipedia.org/wiki/Species>;
+ rdfs:seeAlso <http://www.bbc.co.uk/nature/species>;
+ vs:term_status "testing".
+#Could be related to TDWG TaxonRank schema:
+# owl:sameAs tr:Species.
+
+wo:TaxonName
+ a owl:Class;
+ rdfs:label "Taxon Name"@en;
+ rdfs:comment "A taxonomic name, describing the structure and provenance of a taxonomic name."@en;
+ vs:term_status "testing".
+#Could be related to TDWG TaxonName schema:
+# owl:sameAs tn:TaxonName.
+
+wo:ConservationStatus
+ a owl:Class;
+ rdfs:label "Conservation Status"@en;
+ rdfs:comment "Conservation status as described by the IUCN Red List. Will typically have a number of properties including an official IUCN status, population trend, and a year of assessment."@en;
+ vs:term_status "testing".
+
+wo:Adaptation
+ a owl:Class;
+ rdfs:label "Adaptation"@en;
+ rdfs:comment "An adaptation is any feature of an animal or plant which makes it better suited for a particular habitat or to do a particular task. For instance, being streamlined is an adaptation to swimming fast and being able to survive on very little water is an adaptation to life in the desert."@en;
+ rdfs:seeAlso <http://en.wikipedia.org/wiki/Adaptation>;
+ rdfs:seeAlso <http://www.bbc.co.uk/nature/adaptations>;
+ vs:term_status "testing".
+
+wo:BehaviouralPattern
+ a owl:Class;
+ rdfs:subClassOf wo:Adaptation;
+ rdfs:label "Behavioural Pattern"@en;
+ rdfs:comment "Behavioural pattern describes an animal's dominant way of life. Arboreal animals, for example, live in trees and nocturnal animals are active at night."@en;
+ vs:term_status "testing".
+
+wo:CommunicationAdaptation
+ a owl:Class;
+ rdfs:subClassOf wo:Adaptation;
+ rdfs:label "Communication Adaptation"@en;
+ rdfs:comment "Communication and senses are how an organism perceives the world - for instance through scent or sight - and how it sends messages or warnings to others."@en;
+ vs:term_status "testing".
+
+wo:DevelopmentAdaptation
+ a owl:Class;
+ rdfs:subClassOf wo:Adaptation;
+ rdfs:label "Development Adaptation"@en;
+ rdfs:comment "Development covers all the different stages of life through which an animal or plant passes from conception, through adulthood to death. So a male deer is first an embryo, then a fawn, then a stag, whilst an oak tree goes from acorn to seedling to sapling to mature tree."@en;
+ vs:term_status "testing".
+
+wo:EcosystemRole
+ a owl:Class;
+ rdfs:subClassOf wo:Adaptation;
+ rdfs:label "Ecosystem Role"@en;
+ rdfs:comment "Ecosystem roles are about the part an animal or plant plays in sustaining or maintaining the habitat around them. Bees, for example, pollinate flowers, without which those plants would not produce fruits or seeds. Other species, such as dung beetles, play a vital role in keeping grasslands clear of animal waste and recycling valuable resources."@en;
+ vs:term_status "testing".
+
+wo:FeedingHabit
+ a owl:Class;
+ rdfs:subClassOf wo:Adaptation;
+ rdfs:label "Feeding Habit"@en;
+ rdfs:comment "Feeding habits describe the dominant diet of a particular species or group of species, and how they go about obtaining it."@en;
+ vs:term_status "testing".
+
+wo:LocomotionAdaptation
+ a owl:Class;
+ rdfs:subClassOf wo:Adaptation;
+ rdfs:label "Locomotion"@en;
+ rdfs:comment "Locomotion is how an animal gets around - for instance by swimming, flying or climbing."@en;
+ vs:term_status "testing".
+
+wo:MorphologyAdaptation
+ a owl:Class;
+ rdfs:subClassOf wo:Adaptation;
+ rdfs:label "Morphology"@en;
+ rdfs:comment "Morphology is anything to do with what a plant or animal looks like - its size, shape, colour or structure."@en;
+ vs:term_status "testing".
+
+wo:PredationAdaptation
+ a owl:Class;
+ rdfs:subClassOf wo:Adaptation;
+ rdfs:label "Predation Adaptation"@en;
+ rdfs:comment "Predation is catching and killing an animal in order to eat it. The prey can be chased, ambushed or caught in a trap such as a spider's web."@en;
+ vs:term_status "testing".
+
+wo:ReproductionAdaptation
+ a owl:Class;
+ rdfs:subClassOf wo:Adaptation;
+ rdfs:label "Reproduction Adaptation"@en;
+ rdfs:comment "Reproduction covers all the tactics and behaviours involved in obtaining a mate, conceiving the next generation and successfully raising them. It includes everything from plants being pollinated, to stags fighting over hinds, to lionesses babysitting their sisters' cubs."@en;
+ vs:term_status "testing".
+
+wo:SocialBehaviour
+ a owl:Class;
+ rdfs:subClassOf wo:Adaptation;
+ rdfs:label "Social Behaviour"@en;
+ rdfs:comment "Social behaviour is all about how an animal interacts with members of its own species. For instance, does it live in a colony or on its own, does it fight to be top of the pecking order, or does it try to keep strangers away from its home?"@en;
+ vs:term_status "testing".
+
+wo:Habitat
+ a owl:Class;
+ rdfs:label "Habitat"@en;
+ rdfs:comment "A habitat, or biome, is the type of environment in which plant and animals live. Habitat is dictated by what kinds of plants grow there, the climate and the geography. Rainforest, coral reefs and the tundra are all habitats where particular kinds of plants and animals might be found."@en;
+ rdfs:seeAlso <http://en.wikipedia.org/wiki/Habitat>;
+ rdfs:seeAlso <http://www.bbc.co.uk/nature/habitats>;
+ vs:term_status "testing".
+
+wo:TerrestrialHabitat
+ a owl:Class;
+ rdfs:subClassOf wo:Habitat;
+ rdfs:label "Terrestrial Habitat"@en;
+ rdfs:comment "Terrestrial habitats include forests, grasslands, deserts and rainforests. They are typically defined by factors such as plant structure (trees and grasses), leaf types (eg broadleaf and needleleaf), plant spacing (forest, woodland, savanna) and climate.";
+ vs:term_status "testing".
+
+wo:FreshwaterHabitat
+ a owl:Class;
+ rdfs:subClassOf wo:Habitat;
+ rdfs:label "Freshwater Habitat"@en;
+ rdfs:comment "Freshwater habitats include bogs, ponds, lakes, rivers and streams. About 3% of Earth's water is freshwater, but this includes the water locked up in the ice caps and trapped in rocks and soil as groundwater. Only a tiny fraction (0.014%) is surface water in the form of rivers, lakes and swamps.";
+ vs:term_status "testing".
+
+wo:MarineHabitat
+ a owl:Class;
+ rdfs:subClassOf wo:Habitat;
+ rdfs:label "Marine Habitat"@en;
+ rdfs:comment "Approximately 71% of the Earth's surface is covered by the oceans, an area of some 223698816km/sq. Although marine life evolved around three billion years before life on land, marine habitats are relatively poorly studied and much of the ocean's depths remains unexplored.";
+ vs:term_status "testing".
+
+wo:Ecozone
+ a owl:Class;
+ rdfs:label "Ecozone"@en;
+ rdfs:comment "Ecozones are a method of dividing up the Earth's surface. Each ecozone is a large area that contains a number of habitats, which are linked by the evolutionary history of the animals and plants within them. For instance one ecozone is Australasia, because its marsupials evolved in isolation to mammals in the rest of the world."@en;
+ vs:term_status "testing".
+
+wo:RedListStatus
+ a owl:Class;
+ rdfs:subClassOf skos:Category;
+ rdfs:label "Red List Status"@en;
+ rdfs:comment "A category in the IUCN red list, 2001."@en;
+ rdfs:seeAlso <http://www.iucnredlist.org/technical-documents/categories-and-criteria/2001-categories-criteria>;
+ vs:term_status "testing".
+
+wo:Collection
+ a owl:Class;
+ rdfs:subClassOf dctypes:Collection;
+ rdfs:label "Collection";
+ rdfs:comment "A collection of resources, including documents, multimedia files, programme clips and their associated taxa, which aims to showcase a particular aspect of natural history film-making, or illustrate aspects of the natural world. A collection provides an alternate way to organize content over and above the basic taxonomic hierarchy.";
+ vs:term_status "testing".
+
+############################################################################
+# Object Properties
+############################################################################
+
+wo:kingdom
+ a owl:ObjectProperty;
+ rdfs:label "kingdom"@en;
+ rdfs:comment "associates a taxon rank with a kingdom"@en;
+ rdfs:range wo:Kingdom;
+ rdfs:domain wo:TaxonRank;
+ vs:term_status "testing".
+
+wo:phylum
+ a owl:ObjectProperty;
+ rdfs:label "phylum"@en;
+ rdfs:comment "associates a taxon rank with a phylum"@en;
+ rdfs:range wo:Phylum;
+ rdfs:domain wo:TaxonRank;
+ vs:term_status "testing".
+
+wo:class
+ a owl:ObjectProperty;
+ rdfs:label "class"@en;
+ rdfs:comment "associates a taxon rank with a class"@en;
+ rdfs:range wo:Class;
+ rdfs:domain wo:TaxonRank;
+ vs:term_status "testing".
+
+wo:order
+ a owl:ObjectProperty;
+ rdfs:label "order"@en;
+ rdfs:comment "associates a taxon rank with an order"@en;
+ rdfs:range wo:Kingdom;
+ rdfs:domain wo:TaxonRank;
+ vs:term_status "testing".
+
+wo:family
+ a owl:ObjectProperty;
+ rdfs:label "family"@en;
+ rdfs:comment "associates a taxon rank with a family"@en;
+ rdfs:range wo:Family;
+ rdfs:domain wo:TaxonRank;
+ vs:term_status "testing".
+
+wo:genus
+ a owl:ObjectProperty;
+ rdfs:label "genus"@en;
+ rdfs:comment "associates a taxon rank with a genus"@en;
+ rdfs:range wo:Genus;
+ rdfs:domain wo:TaxonRank;
+ vs:term_status "testing".
+
+wo:species
+ a owl:ObjectProperty;
+ rdfs:label "genus"@en;
+ rdfs:comment "associates a taxon rank with a species"@en;
+ rdfs:range wo:Species;
+ rdfs:domain wo:TaxonRank;
+ vs:term_status "testing".
+
+wo:name
+ a owl:ObjectProperty;
+ rdfs:label "name"@en;
+ rdfs:comment "associates a taxon rank with a taxon name"@en;
+ rdfs:range wo:TaxonName;
+ rdfs:domain wo:TaxonRank;
+ vs:term_status "testing".
+
+wo:conservationStatus
+ a owl:ObjectProperty;
+ rdfs:label "conservation status"@en;
+ rdfs:comment "associates a taxon rank with a description of a recent assessment of its conservation status"@en;
+ rdfs:range wo:ConservationStatus;
+ rdfs:domain wo:TaxonRank;
+ vs:term_status "testing".
+
+#defined as Image but what about KML, etc?
+wo:distributionMap
+ a owl:ObjectProperty;
+ rdfs:label "distribution map"@en;
+ rdfs:comment "associates a habitat, ecozone, or taxon rank with a map depicting its distribution or location"@en;
+ rdfs:range foaf:Image;
+ rdfs:domain [
+ a owl:Class;
+ owl:unionOf (wo:TaxonRank wo:Habitat wo:Ecozone);
+ ];
+ vs:term_status "unstable".
+
+wo:adaptation
+ a owl:ObjectProperty;
+ rdfs:label "adaptation"@en;
+ rdfs:comment "associates a taxon rank with an adaptation which it displays"@en;
+ rdfs:range wo:Adaptation;
+ rdfs:domain wo:TaxonRank;
+ vs:term_status "testing".
+
+wo:habitat
+ a owl:ObjectProperty;
+ rdfs:label "habitat"@en;
+ rdfs:comment "associates a taxon rank with a habitat in which it may typically be found"@en;
+ rdfs:range wo:Habitat;
+ rdfs:domain wo:TaxonRank;
+ vs:term_status "testing".
+
+wo:livesIn
+ a owl:ObjectProperty;
+ rdfs:label "lives in"@en;
+ rdfs:comment "associates a taxon rank with a habitat in which it lives. Sub-property of wo:habitat to be used for members of the animal kingdom"@en;
+ rdfs:range wo:Habitat;
+ rdfs:domain wo:TaxonRank;
+ vs:term_status "testing".
+
+wo:growsIn
+ a owl:ObjectProperty;
+ rdfs:label "lives in"@en;
+ rdfs:comment "associates a taxon rank with a habitat in which it grows. Sub-property of wo:habitat to be used for plants, fungi, etc"@en;
+ rdfs:range wo:Habitat;
+ rdfs:domain wo:TaxonRank;
+ vs:term_status "testing".
+
+
+wo:redListStatus
+ a owl:ObjectProperty;
+ rdfs:label "red list status"@en;
+ rdfs:comment "associates a Conservation Status with a category in the IUCN Red List"@en;
+ rdfs:range wo:RedListStatus;
+ rdfs:domain wo:ConservationStatus;
+ vs:term_status "testing".
+
+wo:collection
+ a owl:ObjectProperty;
+ rdfs:subPropertyOf dcterms:isPartOf;
+ rdfs:label "collection"@en;
+ rdfs:comment "associates a taxon rank, habitat, species, clip with a collection of which it is a member"@en;
+ rdfs:range wo:Collection;
+ vs:term_status "testing".
+
+wo:ecozone
+ a owl:ObjectProperty;
+ rdfs:label "ecozone"@en;
+ rdfs:comment "indicates that a habitat can be found within an ecozone"@en;
+ rdfs:range wo:Ecozone;
+ rdfs:domain wo:Habitat;
+ vs:term_status "testing".
+
+############################################################################
+# Datatype Properties
+############################################################################
+
+wo:commonName
+ a owl:DatatypeProperty;
+ rdfs:label "common name"@en;
+ rdfs:comment "associates a formal taxon name with a common version. E.g. Panthera leo might be associated with a common name of 'Lion'. A given taxon name may have several common names"@en;
+ rdfs:range xsd:string;
+ rdfs:domain wo:TaxonName;
+ vs:term_status "testing".
+
+wo:scientificName
+ a owl:DatatypeProperty;
+ rdfs:label "scientific name"@en;
+ rdfs:comment "associates a taxon name with its formal scientific name. This may be a binomial name (e.g. Panthera leo) in the case of a species name, or a uninomial (e.g. Panthera) name in the case of a name associated with another taxon rank. In formal taxonomic naming conventions, the scientific name is often qualified with the source of the name, e.g. Panthera leo (Linnaeus, 1758)."@en;
+ rdfs:range xsd:string;
+ rdfs:domain wo:TaxonName;
+ vs:term_status "testing".
+
+wo:taxonomicName
+ a owl:DatatypeProperty;
+ rdfs:label "taxonomic name"@en;
+ rdfs:comment "a naming property, associating a formal taxonomic name with a Taxon Name instance. This property is a parent of a number of sub-properties that provide more specific terms for denoting names of families, phyla, species, etc."@en;
+ rdfs:range xsd:string;
+ rdfs:domain wo:TaxonName;
+ vs:term_status "testing".
+
+wo:kingdomName
+ a owl:DatatypeProperty;
+ rdfs:subPropertyOf wo:taxonomicName;
+ rdfs:label "kingdom name"@en;
+ rdfs:comment "Used to specify the name of a kingdom as part of a Taxon Name"@en;
+ vs:term_status "testing".
+
+wo:phylumName
+ a owl:DatatypeProperty;
+ rdfs:subPropertyOf wo:taxonomicName;
+ rdfs:label "phylum name"@en;
+ rdfs:comment "Used to specify the name of a phylum as part of a Taxon Name"@en;
+ vs:term_status "testing".
+
+wo:className
+ a owl:DatatypeProperty;
+ rdfs:subPropertyOf wo:taxonomicName;
+ rdfs:label "class name"@en;
+ rdfs:comment "Used to specify the name of a class as part of a Taxon Name"@en;
+ vs:term_status "testing".
+
+wo:orderName
+ a owl:DatatypeProperty;
+ rdfs:subPropertyOf wo:taxonomicName;
+ rdfs:label "order name"@en;
+ rdfs:comment "Used to specify the name of an order as part of a Taxon Name"@en;
+ vs:term_status "testing".
+
+wo:familyName
+ a owl:DatatypeProperty;
+ rdfs:subPropertyOf wo:taxonomicName;
+ rdfs:label "family name"@en;
+ rdfs:comment "Used to specify the name of a family as part of a Taxon Name"@en;
+ vs:term_status "testing".
+
+wo:genusName
+ a owl:DatatypeProperty;
+ rdfs:subPropertyOf wo:taxonomicName;
+ rdfs:label "genus name"@en;
+ rdfs:comment "specifies the genus part of a binomial name, allowing this portion of the name to be explicitly described. Therefore this property will typically only be used in TaxonNames associated with species. The property is largely provided as a convenience to avoid applications having to parse the binomial name."@en;
+ vs:term_status "testing".
+
+wo:speciesName
+ a owl:DatatypeProperty;
+ rdfs:subPropertyOf wo:taxonomicName;
+ rdfs:label "species name"@en;
+ rdfs:comment "specifies the species part of a binomial name, allowing this portion of the name to be explicitly described. Therefore this property will typically only be used in TaxonNames associated with species. The property is largely provided as a convenience to avoid applications having to parse the binomial name."@en;
+ rdfs:range xsd:string;
+ rdfs:domain wo:TaxonName;
+ vs:term_status "testing".
+
+#should be a URI?
+wo:populationTrend
+ a owl:DatatypeProperty;
+ rdfs:label "population trend"@en;
+ rdfs:comment "provides some indication of the population trend associated with an assessment of a taxon's conversation status. The value of this property is a simple literal, and is recommended to be one of: Decreasing, Increasing, Stable, Unknown."@en;
+ rdfs:range xsd:string;
+ rdfs:domain wo:ConservationStatus;
+ vs:term_status "unstable".
+
+wo:yearAssessed
+ a owl:DatatypeProperty;
+ rdfs:label "year assessed"@en;
+ rdfs:comment "the year in which the conservation status was assessed."@en;
+ rdfs:range xsd:string;
+ rdfs:domain wo:ConservationStatus;
+ vs:term_status "testing".
+
+wo:threatDescription
+ a owl:DatatypeProperty;
+ rdfs:label "threatDescription"@en;
+ rdfs:comment "description of the threat(s) that have been identified as part of the assessment of the Conservation Status of a taxon"@en;
+ rdfs:range xsd:string;
+ rdfs:domain wo:ConservationStatus;
+ vs:term_status "testing".
+
+wo:shortDescription
+ a owl:DatatypeProperty;
+ rdfs:label "short description"@en;
+ rdfs:comment "associates a short description with a Collection."@en;
+ rdfs:range xsd:string;
+ rdfs:domain [
+ a owl:Class;
+ owl:unionOf (wo:Collection wo:Ecozone);
+ ];
+ vs:term_status "testing".
+
50 pkg/dowl-0.1/lib/dowl.rb
@@ -0,0 +1,50 @@
+require 'rubygems'
+require 'erb'
+require 'rdf/redland'
+
+require 'dowl/util'
+require 'dowl/schema'
+require 'dowl/class'
+require 'dowl/property'
+require 'dowl/ontology'
+require 'dowl/generator'
+
+module DOWL
+
+ class Namespaces
+
+ OWLNS = Redland::Namespace.new("http://www.w3.org/2002/07/owl#")
+
+ OWL_CLASS = OWLNS["Class"]
+ OWL_ONTOLOGY = OWLNS["Ontology"]
+ OWL_DATATYPE_PROPERTY = OWLNS["DatatypeProperty"]
+ OWL_OBJECT_PROPERTY = OWLNS["ObjectProperty"]
+
+ RDFS = Redland::Namespace.new("http://www.w3.org/2000/01/rdf-schema#")
+
+ RDFS_CLASS = RDFS["Class"]
+ RDFS_LABEL = RDFS["label"]
+ RDFS_COMMENT = RDFS["comment"]
+ RDFS_SUB_CLASS_OF = RDFS["subClassOf"]
+ RDFS_SUB_PROPERTY_OF = RDFS["subPropertyOf"]
+ RDFS_SEE_ALSO = RDFS["seeAlso"]
+ RDFS_RANGE = RDFS["range"]
+ RDFS_DOMAIN = RDFS["domain"]
+
+ VS = Redland::Namespace.new("http://www.w3.org/2003/06/sw-vocab-status/ns#")
+
+ VS_STATUS = VS["term_status"]
+
+ DCTERMS = Redland::Namespace.new("http://purl.org/dc/terms/")
+ DCTERMS_TITLE = DCTERMS["title"]
+ DCTERMS_CREATED = DCTERMS["created"]
+ DCTERMS_MODIFIED = DCTERMS["modified"]
+
+ FOAF = Redland::Namespace.new("http://xmlns.com/foaf/0.1/")
+
+ FOAF_MAKER = FOAF["maker"]
+ FOAF_NAME = FOAF["name"]
+
+ end
+
+end
53 pkg/dowl-0.1/lib/dowl/class.rb
@@ -0,0 +1,53 @@
+module DOWL
+
+ class Class < DOWL::LabelledDocObject
+ include Comparable
+
+ attr_reader :resource
+
+ def initialize(resource, schema)
+ super(resource, schema)
+ end
+
+ def uri
+ return @resource.uri.to_s
+ end
+
+ def sub_class_of()
+ parent = @resource.get_property(DOWL::Namespaces::RDFS_SUB_CLASS_OF)
+ if parent
+ uri = parent.uri.to_s
+ if @schema.classes[uri]
+ return @schema.classes[uri]
+ else
+ return uri
+ end
+ end
+ return nil
+ end
+
+ def see_alsos()
+ seeAlsos = @resource.get_properties(DOWL::Namespaces::RDFS_SEE_ALSO)
+ links = []
+ seeAlsos.each do |obj|
+ links << obj.uri
+ end
+ return links
+ end
+
+ def to_s
+ return short_name
+ end
+
+ def sub_classes()
+ children = @resource.model.find(nil, DOWL::Namespaces::RDFS_SUB_CLASS_OF, @resource)
+ list = []
+ children.each do |child|
+ list << DOWL::Class.new(child.subject, @schema)
+ end
+ return list
+ end
+
+ end
+
+end
226 pkg/dowl-0.1/lib/dowl/default.erb
@@ -0,0 +1,226 @@
+<html>
+ <head>
+ <title><%= schema.ontology.title %></title>
+ </head>
+ <body>
+ <h1><%= schema.ontology.title %></h1>
+
+ <dl>
+ <dt>Latest Version</dt>
+ <dd><a href="<%= schema.ontology.uri %>"><%= schema.ontology.uri %></a></dd>
+ <% if schema.ontology.created %>
+ <dt>Created</dt>
+ <dd><%= schema.ontology.created %></dd>
+ <% end %>
+ <% if schema.ontology.modified %>
+ <dt>Last Modified</dt>
+ <dd><%= schema.ontology.modified %></dd>
+ <% end %>
+ <dt>Authors</dt>
+ <dd><% schema.ontology.authors.each do |author| %><a href="<%= author.uri %>"><%= author.name %></a><%end%></dd>
+ </dl>
+
+ <h1>Abstract</h1>
+
+ <%= schema.ontology.comment %>
+
+ <% if introduction %>
+ <%= introduction %>
+ <% end %>
+
+ <div id="overview">
+ <h2>Overview Of Terms</h2>
+ <p>An alphabetical index of the ontology terms, divided into classes, properties and individuals. All the terms are hyperlinked to their
+ detailed description for quick reference.
+ </p>
+
+ <p><strong>Classes</strong>:
+ <% schema.list_classes().each do |key,val| %>
+ | <a href="#class_<%= val.short_name %>"><%= val.short_name %></a>
+ <% end %>
+ </p>
+ <p><strong>Properties</strong>:
+ <% schema.list_properties().each do |key,val| %>
+ | <a href="#prop_<%= val.short_name %>"><%= val.short_name %></a>
+ <% end %>
+ </p>
+ </div>
+
+ <div id="terms">
+ <h2>Ontology Terms</h2>
+ </div>
+
+ <div id="classes">
+ <h3>Classes</h3>
+
+ <%schema.list_classes().each do |t| %>
+ <div class="term" id="class_<%= t[1].short_name %>">
+ <h4>Class: <%= t[1].short_name %></h4>
+ <table>
+ <tr><td class="label">Label</td><td><%= t[1].label %> </ts></tr>
+ <tr><td class="label">Status</td><td><%= t[1].status %> </ts></tr>
+ <% if t[1].sub_class_of %>
+ <% if t[1].sub_class_of.class.to_s == "String" %>
+ <tr><td class="label">Has Parent Class</td><td><a href="<%= t[1].sub_class_of %>"><%= t[1].sub_class_of %></a></td></tr>
+ <% else %>
+ <tr><td class="label">Has Parent Class</td><td><a href="#class_<%= t[1].sub_class_of.short_name %>"><%= t[1].sub_class_of.short_name %></a></td></tr>
+ <% end %>
+ <% end %>
+ <% if t[1].sub_classes.length > 0 %>
+ <tr>
+ <td class="label">Sub-Classes</td>
+ <td>
+ <% t[1].sub_classes.each do |child| %>
+ <a href="#class_<%= child.short_name %>"><%= child.short_name %></a>
+ <% end %>
+ </td>
+ </tr>
+ <% end %>
+ </table>
+ <p><%= t[1].comment %> </p>
+ <% if t[1].see_alsos.length > 0 %>
+ <p><em>Further Reading:</em></p>
+ <ul>
+ <% t[1].see_alsos.each do |link| %>
+ <li><a href="<%= link %>"><%= link %></a></li>
+ <% end %>
+ </ul>
+ <% end %>
+ </div>
+ <%end%>
+
+ </div>
+
+ <div id="properties">
+ <h3>Object Properties</h3>
+
+ <% schema.list_object_properties().each do |t| %>
+ <div class="term" id="prop_<%= t[1].short_name %>">
+ <h4>Property: <%= t[1].short_name %></h4>
+ <table>
+ <tr><td class="label">Label</td><td><%= t[1].label %> </ts></tr>
+ <tr><td class="label">Status</td><td><%= t[1].status %> </ts></tr>
+ <% if t[1].sub_property_of %>
+ <% if t[1].sub_property_of.class.to_s == "String" %>
+ <tr><td class="label">Has Parent Property</td><td><a href="<%= t[1].sub_property_of %>"><%= t[1].sub_property_of %></a></td></tr>
+ <% else %>
+ <tr><td class="label">Has Parent Property</td><td><a href="#prop_<%= t[1].sub_property_of.short_name %>"><%= t[1].sub_property_of.short_name %></a></td></tr>
+ <% end %>
+ <% end %>
+ <% if t[1].sub_properties.length > 0 %>
+ <tr>
+ <td class="label">Sub-Properties</td>
+ <td>
+ <% t[1].sub_properties.each do |child| %>
+ <a href="#class_<%= child.short_name %>"><%= child.short_name %></a>
+ <% end %>
+ </td>
+ </tr>
+ <% end %>
+ <% if t[1].range.length > 0 %>
+ <tr><td class="label">Range</td>
+ <td>
+ <% t[1].range.each do |cls| %>
+ <% if cls.class.to_s == "String" %>
+ <a href="<%= cls %>"><%= cls %></a>
+ <% else %>
+ <a href="#class_<%= cls.short_name %>"><%= cls.short_name %></a>
+ <% end %>
+ <% end %>
+ </td>
+ </tr>
+ <% end %>
+ <% if t[1].domain.length > 0 %>
+ <tr><td class="label">Domain</td>
+ <td>
+ <% t[1].domain.each do |cls| %>
+ <% if cls.class.to_s == "String" %>
+ <a href="<%= cls %>"><%= cls %></a>
+ <% else %>
+ <a href="#class_<%= cls.short_name %>"><%= cls.short_name %></a>
+ <% end %>
+ <% end %>
+ </td>
+ </tr>
+ <% end %>
+ </table>
+ <p><%= t[1].comment %> </p>
+ <% if t[1].see_alsos.length > 0 %>
+ <p><em>Further Reading:</em></p>
+ <ul>
+ <% t[1].see_alsos.each do |link| %>
+ <li><a href="<%= link %>"><%= link %></a></li>
+ <% end %>
+ </ul>
+ <% end %>
+ </div>
+ <%end%>
+
+
+ <h3>Datatype Properties</h3>
+
+ <%schema.list_datatype_properties().each do |t| %>
+ <div class="term" id="prop_<%= t[1].short_name %>">
+ <h4>Property: <%= t[1].short_name %></h4>
+ <table>
+ <tr><td class="label">Label</td><td><%= t[1].label %> </ts></tr>
+ <tr><td class="label">Status</td><td><%= t[1].status %> </ts></tr>
+ <% if t[1].sub_property_of %>
+ <% if t[1].sub_property_of.class.to_s == "String" %>
+ <tr><td class="label">Has Parent Property</td><td><a href="<%= t[1].sub_property_of %>"><%= t[1].sub_property_of %></a></td></tr>
+ <% else %>
+ <tr><td class="label">Has Parent Property</td><td><a href="#prop_<%= t[1].sub_property_of.short_name %>"><%= t[1].sub_property_of.short_name %></a></td></tr>
+ <% end %>
+ <% end %>
+ <% if t[1].sub_properties.length > 0 %>
+ <tr>
+ <td class="label">Sub-Properties</td>
+ <td>
+ <% t[1].sub_properties.each do |child| %>
+ <a href="#class_<%= child.short_name %>"><%= child.short_name %></a>
+ <% end %>
+ </td>
+ </tr>
+ <%