├── README.md
├── ecrm-labels.pl
├── ecrm-simplify.xq
├── ecrm_091125.owl
├── ecrm_091216.owl
├── ecrm_091217.owl
├── ecrm_100302.owl
├── ecrm_100408.owl
├── ecrm_100707.owl
├── ecrm_101001-fu.owl
├── ecrm_101001.owl
├── ecrm_110224.owl
├── ecrm_110317.owl
├── ecrm_110404.owl
├── ecrm_110505.owl
├── ecrm_111122.owl
├── ecrm_111201.owl
├── ecrm_120111.owl
├── ecrm_140205.owl
├── ecrm_140212.owl
├── ecrm_140218.owl
├── ecrm_140220.owl
├── ecrm_140617.owl
├── ecrm_141125.owl
├── ecrm_150218-inverse-transitive.owl
├── ecrm_150218.owl
├── ecrm_150716-inverse-transitive.owl
├── ecrm_150716-inverse.owl
├── ecrm_150716.owl
├── ecrm_150929-inverse-transitive.owl
├── ecrm_150929-inverse.owl
├── ecrm_150929.owl
├── ecrm_160331-inverse-transitive.owl
├── ecrm_160331-inverse.owl
├── ecrm_160331.owl
├── ecrm_160714-inverse-transitive.owl
├── ecrm_160714-inverse.owl
├── ecrm_160714.owl
├── ecrm_170309.owl
├── ecrm_200717.owl
├── ecrm_211015.owl
├── ecrm_231027.owl
├── ecrm_240220.owl
├── ecrm_240307.owl
├── ecrm_240920.owl
├── ecrm_current-inverse-transitive.owl
├── ecrm_current-inverse.owl
├── ecrm_current.owl
├── ecrm_iso2014-inverse-transitive.owl
└── ecrm_iso2014.owl
/README.md:
--------------------------------------------------------------------------------
1 | Ontology versions:
2 | - ecrm_current.owl: current version, using namespace http://erlangen-crm.org/ current /. Includes rdfs:label for each class and property
3 | - ecrm_ _yymmdd_.owl: older version, using namespace http://erlangen-crm.org/ _yymmdd_ /
4 |
5 | Scripts:
6 | - ecrm-labels.pl: generates rdfs:label for each class and property. (Run just once: Protege remembers them)
7 | - ecrm-simplify.xq: generates CRM "application profiles", eg to exclude the controversial owl:Restriction's
8 |
9 | Application profiles:
10 | - ecrm_current.owl: includes inverse, symmetric, transitive, functional, disjoint, restriction (full)
11 | - ecrm_current-inverse.owl: includes inverse, symmetric only (innate part of CRM)
12 | - ecrm_current-inverse-transitive.owl: includes inverse, symmetric, transitive.
13 |
14 | You can generate more profiles with ecrm-simplify.xq
15 |
--------------------------------------------------------------------------------
/ecrm-labels.pl:
--------------------------------------------------------------------------------
1 | #!perl -wn
2 | # Given the ECRM OWL file, extract all class and property URIs and generate rdfs:label and skos:notation for them.
3 | # Usage: perl -wn ecrm-labels.pl ecrm.owl > ecrm-with-labels.owl
4 | # Example: ecrm:P91i_is_unit_of rdfs:label "P91 is unit of"; skos:notation "P91i".
5 | # Author: vladimir.alexiev@ontotext.com, 8-Aug-2012
6 |
7 | # TODO: add opton -s (short) to skip numeric IDs and parasitic words (is/was) from rdfs:label
8 |
9 | print; # print the original line first!
10 | m{xmlns:ecrm="http://erlangen-crm.org/current/"} and
11 | print qq{ xmlns:skos="http://www.w3.org/2004/02/skos/core#"\n};
12 | m{^ <.*rdf:about="http://erlangen-crm.org/current/([^_]+)_([^"]+)} and do {
13 | my ($notation,$label) = ($1,$2);
14 | my $id = $notation; $id =~ s{i}{}; # "P91"
15 | $label =~ s{_}{ }g; # "is unit of"
16 | print << "EOF"
17 | $id $label
18 | $notation
19 | EOF
20 | }
21 |
--------------------------------------------------------------------------------
/ecrm-simplify.xq:
--------------------------------------------------------------------------------
1 | (: Simplifies the ecrm.owl file by removing some OWL constructs. Usage:
2 | - Get https://raw.github.com/erlangen-crm/ecrm/master/ecrm.owl
3 | - Download the Saxon xquery processor from http://www.saxonica.com
4 | - Run eg:
5 | Query ecrm-simplify.xq > ecrm-inverse.owl
6 | Query ecrm-simplify.xq keep=transitive > ecrm-inverse-transitive.owl
7 |
8 | Always keeps owl:inverseOf and owl:SymmetricProperty (self-inverses): they are an innate part of CRM.
9 | Parameter keep= gives a comma-separated list of other features to keep:
10 | - transitive: owl:TransitiveProperty
11 | - restriction: owl:Restriction (blank-node subClassOf)
12 | - functional: owl:FunctionalProperty, owl:InverseFunctionalProperty
13 | - disjoint: owl:disjointWith
14 |
15 | Author: vladimir.alexiev@ontotext.com, 18-Dec-2012
16 | Last updated: 12-Feb-2014
17 | :)
18 |
19 | (:
20 | References
21 | - http://en.wikibooks.org/wiki/XQuery/Filtering_Nodes : remove and rename elements
22 | - http://www.saxonica.com/documentation/using-xquery/commandline.xml
23 | - XQuery (O'Reilly 2007) p135 "Controlling Namespace Declarations in Your Results"
24 | :)
25 |
26 | declare namespace rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
27 | declare namespace rdfs="http://www.w3.org/2000/01/rdf-schema#";
28 | declare namespace owl="http://www.w3.org/2002/07/owl#";
29 | declare namespace saxon="http://saxon.sf.net/";
30 | (: declare copy-namespaces no-preserve, inherit; :)
31 | declare option saxon:output "indent=yes";
32 |
33 | declare option saxon:default "''";
34 | declare variable $keep external;
35 |
36 | declare variable $transitive as xs:boolean := matches($keep,"transitive");
37 | declare variable $restriction as xs:boolean := matches($keep,"restriction");
38 | declare variable $functional as xs:boolean := matches($keep,"functional");
39 | declare variable $disjoint as xs:boolean := matches($keep,"disjoint");
40 |
41 | declare function local:process($n as node()) as node()?
42 | {
43 | if (not($n instance of element())) then $n
44 | else
45 | let $name := name($n)
46 | return
47 | if ($name="owl:disjointWith" and not ($disjoint)
48 | or $name="rdfs:subClassOf" and $n/owl:Restriction and not($restriction))
49 | then ()
50 | (: ECRM doesn't have DataProperties with special traits, so if we find such, we replace with simple ObjectProperty :)
51 | else if ($name="owl:TransitiveProperty" and not($transitive)
52 | or $name="owl:FunctionalProperty" and not($functional)
53 | or $name="owl:InverseFunctionalProperty" and not($functional))
54 | then element {QName(namespace-uri($n),"owl:ObjectProperty")}
55 | {$n/@*,
56 | for $c in $n/node() return local:process($c)}
57 | else element {node-name($n)}
58 | {$n/@*,
59 | for $c in $n/node() return local:process($c)}
60 | };
61 |
62 |
70 | {
71 | for $n in doc("ecrm.owl")/rdf:RDF/* return local:process($n)
72 | }
73 |
74 |
--------------------------------------------------------------------------------