├── .gitignore ├── INSTALL.md ├── Makefile ├── README-REPL.md ├── README.md ├── bin ├── README.md ├── owljs ├── owljs-decluster ├── owljs-decluster.js ├── owljs-diff ├── owljs-diff.js ├── owljs-dlmatch ├── owljs-dlmatch.js ├── owljs-dlquery ├── owljs-dlquery.js ├── owljs-expand-literals-using-ld-context.js ├── owljs-grep ├── owljs-grep.js ├── owljs-merge.js ├── owljs-obol ├── owljs-obol.js ├── owljs-owlstats ├── owljs-owlstats.js ├── owljs-refilter ├── owljs-refilter.js ├── owljs-remove-random-axioms ├── owljs-remove-random-axioms.js ├── owljs-repl ├── owljs-repl.js ├── owljs-sed ├── owljs-sed.js ├── owljs-svn-diffwrap ├── owljs-tableify ├── owljs-tableify.js ├── owljs-treeify ├── owljs-treeify.js ├── ringo-owl ├── svn-owl-diff └── svn-owl-htmldiff ├── conf ├── cl │ └── cl-cjm-conf.js ├── learner │ ├── class.conf │ ├── mptest.conf │ └── mptest.ofn └── uberon │ └── uberon-cjm-conf.js ├── docs ├── files │ ├── dlmatch-js.html │ ├── javautil-js.html │ ├── obol-js.html │ ├── owl-js.html │ ├── owlframe-js.html │ └── repl-js.html ├── index.html ├── index │ ├── Classes.html │ ├── Functions.html │ ├── Functions2.html │ ├── Functions3.html │ ├── General.html │ ├── General2.html │ ├── General3.html │ └── Variables.html ├── javascript │ ├── main.js │ ├── prettify.js │ └── searchdata.js ├── search │ ├── ClassesD.html │ ├── ClassesJ.html │ ├── ClassesO.html │ ├── ClassesR.html │ ├── ClassesV.html │ ├── FunctionsA.html │ ├── FunctionsC.html │ ├── FunctionsD.html │ ├── FunctionsE.html │ ├── FunctionsF.html │ ├── FunctionsG.html │ ├── FunctionsH.html │ ├── FunctionsI.html │ ├── FunctionsJ.html │ ├── FunctionsL.html │ ├── FunctionsM.html │ ├── FunctionsN.html │ ├── FunctionsO.html │ ├── FunctionsP.html │ ├── FunctionsR.html │ ├── FunctionsS.html │ ├── FunctionsT.html │ ├── FunctionsU.html │ ├── FunctionsW.html │ ├── GeneralA.html │ ├── GeneralC.html │ ├── GeneralD.html │ ├── GeneralE.html │ ├── GeneralF.html │ ├── GeneralG.html │ ├── GeneralH.html │ ├── GeneralI.html │ ├── GeneralJ.html │ ├── GeneralL.html │ ├── GeneralM.html │ ├── GeneralN.html │ ├── GeneralO.html │ ├── GeneralP.html │ ├── GeneralR.html │ ├── GeneralS.html │ ├── GeneralT.html │ ├── GeneralU.html │ ├── GeneralV.html │ ├── GeneralW.html │ ├── NoResults.html │ ├── VariablesL.html │ └── VariablesO.html └── styles │ └── main.css ├── jars └── owltools-runner-all.jar ├── lib ├── .naturaldocs_project │ ├── Data │ │ ├── ClassHierarchy.nd │ │ ├── ConfigFileInfo.nd │ │ ├── FileInfo.nd │ │ ├── ImageFileInfo.nd │ │ ├── ImageReferenceTable.nd │ │ ├── IndexInfo.nd │ │ ├── PreviousMenuState.nd │ │ ├── PreviousSettings.nd │ │ └── SymbolTable.nd │ ├── Languages.txt │ ├── Menu.txt │ ├── Menu_Backup.txt │ └── Topics.txt ├── Differ.js ├── Stats.js ├── annotator.js ├── dlmatch.js ├── io │ ├── dotty.js │ ├── markdown.js │ └── table.js ├── javautil.js ├── learner.js ├── linky.js ├── obol.js ├── obol │ ├── anatomy.js │ ├── bp.js │ ├── bp │ │ ├── cellDevelopment.js │ │ ├── involvedIn.js │ │ └── regulationOfQuality.js │ ├── equiv.js │ └── phenotype.js ├── owl.js ├── owl │ ├── addons.js │ ├── attic.js │ ├── owlframe.js │ ├── owlserver.js │ └── owlservices.js ├── owlframe.js ├── repl.js └── vocab │ ├── nif.js │ └── obo.js ├── package.json ├── server.js └── tests ├── alltests.js ├── data ├── caro.owl ├── catalog-v001.xml ├── ceph-import.owl ├── ceph.owl ├── clmin.ofn └── linkytest.owl ├── differ └── differ_test.js ├── dlmatch ├── dlmatch_nested_test.js └── dlmatch_test.js ├── learner ├── catalog-v001.xml ├── mp_test.js ├── mptest.ofn └── mptest.owl ├── linky └── linky_test.js ├── obol ├── obol_test.js └── obolsyn_test.js ├── obol_test_mp.obo ├── obolt.omn ├── owl ├── addimport_test.js ├── anc_test.js ├── import_test.js ├── owl_test.js └── owljson_test.js ├── owlfun_test.js ├── repl ├── author_test.js ├── catalog-v001.xml ├── fin2limb.js ├── foo.owl ├── instancequery_test.js ├── instont.js ├── limbs.js └── mkont.js └── vocab └── obo_test.js /.gitignore: -------------------------------------------------------------------------------- 1 | .pl-history -------------------------------------------------------------------------------- /INSTALL.md: -------------------------------------------------------------------------------- 1 | 2 | # Install RingoJS 3 | 4 | http://ringojs.org/ 5 | 6 | 7 | 8 | Add ringo and owl.js to your PATH. E.g. assume you checked out this 9 | repo into a ~/repos directory: 10 | 11 | export PATH=$PATH:$HOME/ringojs/bin 12 | export PATH=$PATH:$HOME/repos/owljs/bin 13 | 14 | I'm currently working on installation via rp, the ringo package 15 | manager. For now, do this hacky measure: 16 | 17 | cd $RINGO_HOME/packages/ 18 | ln -s ~/repos/owljs owl 19 | ln -s ~/repos/owljs owljs 20 | 21 | 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | 2 | .PHONY: docs 3 | docs: 4 | naturaldocs --rebuild-output --input lib --project lib/.naturaldocs_project/ --output html docs/ 5 | 6 | jars/owltools-runner-all.jar: 7 | cd jars && wget http://build.berkeleybop.org/job/owltools/lastSuccessfulBuild/artifact/owltools/OWLTools-Runner/bin/$@ -O $@ 8 | 9 | ## http://secret-harbor-1370.herokuapp.com/ 10 | heroku-create: 11 | heroku create --stack cedar --buildpack https://github.com/cmungall/heroku-buildpack-ringojs-jdk7.git --remote monarch-heroku 12 | heroku-deploy: 13 | git push monarch-heroku master 14 | 15 | TEST = ringo-owl 16 | 17 | test: 18 | $(TEST) tests/alltests.js 19 | -------------------------------------------------------------------------------- /bin/README.md: -------------------------------------------------------------------------------- 1 | owljs scripts 2 | 3 | Be sure to add this directory to your $PATH 4 | 5 | ## Scripts 6 | 7 | * [owljs-repl](owljs-repl.js) - start a Read-Eval-Print Loop 8 | * [owljs-grep](owljs-grep.js) - filter axioms or objects from an ontology 9 | * [owljs-dlquery](owljs-dlquery.js) - perform a DL query using a reasoner 10 | * [owljs-dlmatch](owljs-dlmatch.js) - query axioms for those matching a template pattern 11 | * [owljs-diff](owljs-diff.js) - performs diff on two OWL files 12 | 13 | ## Script architecture 14 | 15 | Currently each script comes in pairs - the actual implementation 16 | (owljs-foo.js) and a shell wrapper (owljs-foo). You should run the 17 | shell wrapper. 18 | 19 | The shell wrapper actually calls a generic wrapper, ringo-owl, also, 20 | in this directory, which takes care of mundanities such as setting 21 | your classpath. 22 | 23 | Note the owljs-foo.js file must be both executable and in the PATH for 24 | this to work. 25 | 26 | Note that you can run ringo-owl at any time to get a REPL. -------------------------------------------------------------------------------- /bin/owljs: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | X=`which owljs-repl.js` 3 | ringo-owl $X "$@" 4 | -------------------------------------------------------------------------------- /bin/owljs-decluster: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | X=`which owljs-decluster.js` 3 | ringo-owl $X "$@" 4 | -------------------------------------------------------------------------------- /bin/owljs-decluster.js: -------------------------------------------------------------------------------- 1 | var Parser = require('ringo/args').Parser; 2 | var system = require('system'); 3 | var fs = require('fs'); 4 | var {OWL} = require("owljs"); 5 | var {Linky} = require("owljs/Linky"); 6 | 7 | var owl; 8 | function main(args) { 9 | var script = args.shift(); 10 | var parser = new Parser(system.args); 11 | var grepFunc = null; 12 | 13 | parser.addOption('h', 'help', null, 'Display help'); 14 | parser.addOption('r', 'reasoner', 'Reasoner', 'set reasoner factory. Default is elk. NOT IMPLEMENTED'); 15 | parser.addOption('c', 'importsClosure', null, 'set this flag if the full import closure is to be declustered'); 16 | parser.addOption('C', 'catalog', 'File', 'XML catalog for imports'); 17 | parser.addOption('m', 'markdownFile', 'File', 'output file for md report'); 18 | parser.addOption('o', 'outputFile', 'File', 'output file (defaults to stdout)'); 19 | 20 | var options = parser.parse(args); 21 | 22 | if (options.help) { 23 | print("Usage: owljs-decluster OPTIONS OWLFILE_A OWLFILE_B\n"); 24 | print("Breaks equivalence clusters such that bipartite equivalence graphs are retained"); 25 | print("\nOptions:"); 26 | print(parser.help()); 27 | print("\nExample:"); 28 | print("owljs-decluster -o decluster.md ont.owl"); 29 | system.exit('-1'); 30 | } 31 | 32 | owl = new OWL(); 33 | owl.addCatalog(options.catalog); 34 | owl.loadFile(args[0]); 35 | 36 | var incClosure = options.importsClosure == null ? false : true; 37 | 38 | var linky = new Linky(owl); 39 | if (options.markdownFile != null) { 40 | linky.io = fs.open(options.markdownFile, {write:true}); 41 | } 42 | 43 | linky.decluster(); 44 | 45 | if (options.outputFile != null) { 46 | owl.save(options.outputFile); 47 | } 48 | else { 49 | console.warn("No save"); 50 | } 51 | if (linky.io != null) { 52 | linky.io.close(); 53 | } 54 | } 55 | 56 | 57 | // call the main method; ringo specific 58 | if (require.main == module.id) { 59 | main(system.args); 60 | } 61 | -------------------------------------------------------------------------------- /bin/owljs-diff: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | X=`which owljs-diff.js` 3 | ringo-owl $X "$@" 4 | -------------------------------------------------------------------------------- /bin/owljs-diff.js: -------------------------------------------------------------------------------- 1 | var Parser = require('ringo/args').Parser; 2 | var system = require('system'); 3 | var {OWL} = require("owljs"); 4 | var {Differ} = require("owljs/Differ"); 5 | 6 | var owlA; 7 | var owlB; 8 | function main(args) { 9 | var script = args.shift(); 10 | var parser = new Parser(system.args); 11 | var grepFunc = null; 12 | var useReasoner = false; 13 | 14 | parser.addOption('h', 'help', null, 'Display help'); 15 | parser.addOption('r', 'reasoner', 'Reasoner', 'set reasoner factory. Default is elk. NOT IMPLEMENTED'); 16 | parser.addOption('e', 'useReasoner', null, 'set this flag if reasoner diffs are tgo be performed'); 17 | parser.addOption('c', 'importsClosure', null, 'set this flag if the full import closure is to be diffed'); 18 | parser.addOption('C', 'catalog', 'File', 'XML catalog for imports'); 19 | parser.addOption('o', 'outputFile', 'File', 'output file (defaults to stdout)'); 20 | 21 | var options = parser.parse(args); 22 | 23 | if (options.help) { 24 | print("Usage: owljs-owldiff OPTIONS OWLFILE_A OWLFILE_B\n"); 25 | print("Writes differences between two files. Current output is markdown"); 26 | print("\nOptions:"); 27 | print(parser.help()); 28 | print("\nExample:"); 29 | print("owljs-diff -o diff.md ont1.owl ont2.owl"); 30 | system.exit('-1'); 31 | } 32 | 33 | owlA = new OWL(); 34 | owlA.addCatalog(options.catalog); 35 | owlA.loadFile(args[0]); 36 | 37 | owlB = new OWL(); 38 | owlB.addCatalog(options.catalog); 39 | owlB.loadFile(args[1]); 40 | 41 | var incClosure = options.importsClosure == null ? false : true; 42 | 43 | var differ = new Differ(); 44 | var md = differ.getDiffsAsMarkdown(owlA, owlB, incClosure, useReasoner); 45 | 46 | if (options.outputFile != null) { 47 | var fs = require('fs'); 48 | fs.write(options.outputFile, md); 49 | } 50 | else { 51 | print(md); 52 | } 53 | } 54 | 55 | 56 | // call the main method; ringo specific 57 | if (require.main == module.id) { 58 | main(system.args); 59 | } 60 | -------------------------------------------------------------------------------- /bin/owljs-dlmatch: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | X=`which owljs-dlmatch.js` 3 | ringo-owl $X "$@" 4 | -------------------------------------------------------------------------------- /bin/owljs-dlquery: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | X=`which owljs-dlquery.js` 3 | ringo-owl $X "$@" 4 | -------------------------------------------------------------------------------- /bin/owljs-dlquery.js: -------------------------------------------------------------------------------- 1 | var Parser = require('ringo/args').Parser; 2 | var system = require('system'); 3 | var {OWL} = require("owljs"); 4 | 5 | var owl; 6 | function main(args) { 7 | var script = args.shift(); 8 | var parser = new Parser(system.args); 9 | var grepFunc = null; 10 | 11 | parser.addOption('h', 'help', null, 'Display help'); 12 | parser.addOption('q', 'query', 'ManchesterString', 'class expression in owltools manchester syntax (all labels enclosed in single quotes)'); 13 | parser.addOption('r', 'reasoner', 'Reasoner', 'set reasoner factory. Default is elk.'); 14 | parser.addOption('a', 'ancestors', null, 'TODO'); 15 | parser.addOption('d', 'direct', null, 'direct only (defaults to direct plus indirect)'); 16 | parser.addOption('p', 'property', 'ObjectProperty', 'ancestors over specified relation. queries SELECT ?x WHERE {CLASSEXPR SubClassOf ?p some ?x}'); 17 | 18 | var options = parser.parse(args); 19 | 20 | if (options.help) { 21 | print("Usage: owljs-dlquery OPTIONS OWLFILE\n"); 22 | print("DL-query"); 23 | print("\nOptions:"); 24 | print(parser.help()); 25 | print("\nExample (what are the things that are parts of some cell):"); 26 | print("$ owljs-dlquery -r elk \"'part_of' some 'cell'\" foo.owl"); 27 | print("\nExample (what does this cell type have as parts)?:"); 28 | print("$ owljs-dlquery -p has_part -q \"'small pre-B-II cell'\" cl-edit.owl"); 29 | system.exit('-1'); 30 | } 31 | 32 | owl = new OWL(); 33 | owl.addCatalog(); 34 | args.forEach(function(fn) { owl.loadFile(fn) } ); 35 | 36 | var cx = owl.parseManchesterExpression(options.query); 37 | owl.log("Query="+cx); 38 | var subs; 39 | if (options.property == null) { 40 | subs = owl.getInferredSubClasses(cx); 41 | } 42 | else { 43 | var objprop = owl.find(options.property); 44 | owl.log("Prop="+objprop); 45 | subs = owl.getAncestorsOver(cx, objprop, false, options.direct != null); 46 | } 47 | subs.forEach(show); 48 | } 49 | 50 | function show(c) { 51 | print(c + " " + owl.getLabel(c)); 52 | } 53 | 54 | // call the main method; ringo specific 55 | if (require.main == module.id) { 56 | main(system.args); 57 | } 58 | -------------------------------------------------------------------------------- /bin/owljs-expand-literals-using-ld-context.js: -------------------------------------------------------------------------------- 1 | var Parser = require('ringo/args').Parser; 2 | var system = require('system'); 3 | var {OWL} = require("owljs"); 4 | var ov = require("owljs/vocab/obo"); 5 | 6 | importPackage(Packages.org.semanticweb.owlapi.model); 7 | 8 | var owl; 9 | var part_of; 10 | var rels; 11 | var relObjs = []; 12 | var isElk; 13 | 14 | function main(args) { 15 | var script = args.shift(); 16 | var parser = new Parser(system.args); 17 | var grepFunc = null; 18 | 19 | parser.addOption('h', 'help', null, 'Display help'); 20 | parser.addOption('c', 'importsClosure', null, 'set this flag if the full import closure is to used'); 21 | parser.addOption('x', 'context', 'File', 'context file'); 22 | parser.addOption('o', 'outputFile', 'File', 'output file (defaults to stdout)'); 23 | parser.addOption('t', 'toOutputFormat', 'OWLOntologyFormat', 'output format (defaults to RDFXML)'); 24 | 25 | var options = parser.parse(args); 26 | var incClosure = options.importsClosure == null ? false : true; 27 | 28 | if (options.help) { 29 | print("Usage: owljs-expand-literals-using-ld-context.js OPTIONS OWLFILE\n"); 30 | print("Stats"); 31 | print("\nOptions:"); 32 | print(parser.help()); 33 | system.exit('-1'); 34 | } 35 | 36 | owl = new OWL(); 37 | owl.addCatalog(); 38 | 39 | if (options.toOutputFormat != null) { 40 | console.log("Setting format to "+options.toOutputFormat); 41 | owl.setDefaultFormat(options.toOutputFormat); 42 | } 43 | 44 | args.forEach(function(fn) { owl.loadFile(fn) } ); 45 | 46 | owl.log("Saving to " + options.outputFile); 47 | owl.save(options.outputFile); 48 | 49 | } 50 | 51 | function render(c) { 52 | if (c == null) { 53 | return ""; 54 | } 55 | if (c.map != null) { 56 | return c.map(render).join("|"); 57 | } 58 | else { 59 | if (c.getIRI != null) { 60 | return owl.getLabel(c) 61 | } 62 | else { 63 | return markdown.renderOWLObject(c, owl, {isLabelOnly : true}); 64 | } 65 | } 66 | } 67 | 68 | function getColVals(c, type) { 69 | var def = ov.getDefinitionObject(owl,c); 70 | // shared by all types 71 | var vals = 72 | [ 73 | { name: "iri", 74 | value: c.getIRI()}, 75 | { name: "label", 76 | value: owl.getLabel(c)}, 77 | { name: "definition", 78 | value: def == null ? "" : def.value}, 79 | { name: "definitionXrefs", 80 | value: def == null ? "" : def.xrefs.join(",")} 81 | ]; 82 | if (type == 'Class') { 83 | vals = vals.concat([ 84 | { name: "superClasses", 85 | value: render(owl.getInferredSuperClasses(c, true, false, true)) }, 86 | //{ name: "part_of", 87 | // value: render(owl.getAncestorsOver(c, part_of, true, false)) } 88 | ]); 89 | relObjs.forEach(function(r) { 90 | vals.push( 91 | { name: r.label, 92 | value: render(owl.getAncestorsOver(c, r.obj, true, false)) } 93 | ); 94 | }); 95 | } 96 | else if (type == 'ObjectProperty') { 97 | if (!isElk) { 98 | vals = vals.concat([ 99 | { name: "superProperties", 100 | value: render(owl.getInferredSuperProperties(c, true, false, true)) }, 101 | ]); 102 | } 103 | var axs = owl.getAxiomsReferencing(c, true); 104 | vals = vals.concat([ 105 | { name: "classAxiomUsages", 106 | value: axs.length }, 107 | ]); 108 | vals = vals.concat([ 109 | { name: "classAxiomExampleUsage", 110 | value: render(axs. 111 | filter(interesting). 112 | slice(0,5)) }, 113 | ]); 114 | } 115 | return vals; 116 | 117 | } 118 | 119 | function interesting(ax) { 120 | return ax.getSubClass != null || ax.getClassExpressions != null; 121 | } 122 | 123 | 124 | // call the main method; ringo specific 125 | if (require.main == module.id) { 126 | main(system.args); 127 | } 128 | -------------------------------------------------------------------------------- /bin/owljs-grep: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | X=`which owljs-grep.js` 3 | ringo-owl $X "$@" 4 | -------------------------------------------------------------------------------- /bin/owljs-merge.js: -------------------------------------------------------------------------------- 1 | var Parser = require('ringo/args').Parser; 2 | var system = require('system'); 3 | var {OWL} = require("owljs"); 4 | var {Differ} = require("owljs/Differ"); 5 | 6 | var owlA; 7 | var owlB; 8 | function main(args) { 9 | var script = args.shift(); 10 | var parser = new Parser(system.args); 11 | var grepFunc = null; 12 | 13 | parser.addOption('h', 'help', null, 'Display help'); 14 | parser.addOption('r', 'reasoner', 'Reasoner', 'set reasoner factory. Default is elk. NOT IMPLEMENTED'); 15 | parser.addOption('c', 'importsClosure', null, 'set this flag if the full import closure is to be diffed'); 16 | parser.addOption('o', 'outputFile', 'File', 'output file (defaults to stdout)'); 17 | 18 | var options = parser.parse(args); 19 | 20 | if (options.help) { 21 | print("Usage: owljs-owldiff OPTIONS OWLFILE_A OWLFILE_B\n"); 22 | print("Writes differences between two files. Current output is markdown"); 23 | print("\nOptions:"); 24 | print(parser.help()); 25 | print("\nExample:"); 26 | print("owljs-diff -o diff.md ont1.owl ont2.owl"); 27 | system.exit('-1'); 28 | } 29 | 30 | owlOrig = new OWL(); 31 | owlOrig.addCatalog(); 32 | owlOrig.loadFile(args.shift); 33 | 34 | owlA = new OWL(); 35 | owlA.addCatalog(); 36 | owlA.loadFile(args.shift); 37 | 38 | owlB = new OWL(); 39 | owlB.addCatalog(); 40 | owlB.loadFile(args.shift); 41 | 42 | if (options.toOutputFormat != null) { 43 | console.log("Setting format to "+options.toOutputFormat); 44 | owl.setDefaultFormat(options.toOutputFormat); 45 | } 46 | 47 | var differ = new Differ(); 48 | differ.merge(owlOrig, owlA, owlB); 49 | 50 | owlA.save(options.outputFile); 51 | 52 | } 53 | 54 | 55 | // call the main method; ringo specific 56 | if (require.main == module.id) { 57 | main(system.args); 58 | } 59 | -------------------------------------------------------------------------------- /bin/owljs-obol: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | X=`which owljs-obol.js` 3 | ringo-owl $X "$@" 4 | -------------------------------------------------------------------------------- /bin/owljs-owlstats: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | X=`which owljs-owlstats.js` 3 | ringo-owl $X "$@" 4 | -------------------------------------------------------------------------------- /bin/owljs-owlstats.js: -------------------------------------------------------------------------------- 1 | var Parser = require('ringo/args').Parser; 2 | var system = require('system'); 3 | var {OWL} = require("owljs"); 4 | var stats = require("owljs/Stats"); 5 | 6 | var owl; 7 | function main(args) { 8 | var script = args.shift(); 9 | var parser = new Parser(system.args); 10 | var grepFunc = null; 11 | 12 | parser.addOption('h', 'help', null, 'Display help'); 13 | parser.addOption('r', 'reasoner', 'Reasoner', 'set reasoner factory. Default is elk.'); 14 | parser.addOption('o', 'outputFile', 'File', 'output file (defaults to stdout)'); 15 | 16 | var options = parser.parse(args); 17 | 18 | if (options.help) { 19 | print("Usage: owljs-owlstats OPTIONS OWLFILE\n"); 20 | print("Stats"); 21 | print("\nOptions:"); 22 | print(parser.help()); 23 | system.exit('-1'); 24 | } 25 | 26 | owl = new OWL(); 27 | owl.addCatalog(); 28 | args.forEach(function(fn) { owl.loadFile(fn) } ); 29 | 30 | var info = stats.getOntologyStats(owl); 31 | var json = JSON.stringify(info, null, ' '); 32 | if (options.outputFile != null) { 33 | var fs = require('fs'); 34 | fs.write(options.outputFile, json); 35 | } 36 | else { 37 | print(json); 38 | } 39 | } 40 | 41 | function show(c) { 42 | print(c + " " + owl.getLabel(c)); 43 | } 44 | 45 | // call the main method; ringo specific 46 | if (require.main == module.id) { 47 | main(system.args); 48 | } 49 | -------------------------------------------------------------------------------- /bin/owljs-refilter: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | X=`which owljs-cgrep.js` 3 | ringo-owl $X "$@" 4 | -------------------------------------------------------------------------------- /bin/owljs-refilter.js: -------------------------------------------------------------------------------- 1 | var Parser = require('ringo/args').Parser; 2 | var system = require('system'); 3 | var {OWL} = require("owljs"); 4 | 5 | function main(args) { 6 | var script = args.shift(); 7 | var parser = new Parser(system.args); 8 | var re = null; 9 | 10 | parser.addOption('h', 'help', null, 'Display help'); 11 | parser.addOption('v', 'invertMatch', null, 'Invert (negate) match'); 12 | parser.addOption('o', 'outputFile', 'File', 'output file (defaults to stdout)'); 13 | parser.addOption('t', 'toOutputFormat', 'OWLOntologyFormat', 'output format (defaults to RDFXML)'); 14 | parser.addOption('j', 'jsFrames', null, 'writes output as js frames'); 15 | 16 | var options = parser.parse(args); 17 | 18 | if (options.help) { 19 | print("Usage: owljs-cgrep OPTIONS [PATTERN] OWLFILE\n"); 20 | print("Filters class from an ontology using a regexp. Compare with owljs-grep, which greps axioms"); 21 | print("\nOptions:"); 22 | print(parser.help()); 23 | print("\nExample:"); 24 | print("owljs-cgrep /epithelium/ foo.owl"); 25 | system.exit('-1'); 26 | } 27 | 28 | var owl = new OWL(); 29 | 30 | if (options.toOutputFormat != null) { 31 | console.log("Setting format to "+options.toOutputFormat); 32 | owl.setDefaultFormat(options.toOutputFormat); 33 | } 34 | 35 | var reStr = args.shift(); 36 | if (reStr.indexOf("/") != 0) { 37 | reStr = "/" + reStr + "/"; 38 | } 39 | var re = eval(reStr); 40 | 41 | args.forEach(function(fn) { owl.loadFile(fn) } ); 42 | 43 | if (options.load != null) { 44 | owl.log("Loading "+options.load); 45 | } 46 | var clist = owl.mfind(re); 47 | owl.log("#filteredClasses = " + clist.length); 48 | 49 | if (options.jsFrames) { 50 | var repl = require("owljs/repl"); 51 | repl.owlinit(owl); 52 | //repl.owl = owl; 53 | for (var ci in clist) { 54 | var c = clist[ci]; 55 | var fr = owl.getFrame(c); 56 | print(repl.render(fr)); 57 | } 58 | } 59 | else { 60 | 61 | var filteredAxioms = []; 62 | for (var ci in clist) { 63 | var c = clist[ci]; 64 | var axioms = owl.getAllAxioms(c); 65 | console.log(c+" #axioms = "+axioms.length); 66 | filteredAxioms = filteredAxioms.concat(axioms); 67 | } 68 | owl.log("#filteredAxioms = " + filteredAxioms.length); 69 | 70 | owl.log("Saving to " + options.outputFile); 71 | owl.saveAxioms(filteredAxioms, null, options.outputFile); 72 | } 73 | } 74 | 75 | // call the main method; ringo specific 76 | if (require.main == module.id) { 77 | main(system.args); 78 | } 79 | -------------------------------------------------------------------------------- /bin/owljs-remove-random-axioms: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | X=`which owljs-remove-random-axioms.js` 3 | ringo-owl $X "$@" 4 | -------------------------------------------------------------------------------- /bin/owljs-remove-random-axioms.js: -------------------------------------------------------------------------------- 1 | var Parser = require('ringo/args').Parser; 2 | var system = require('system'); 3 | var {OWL} = require("owljs"); 4 | 5 | // have this available for evaluation of user functions 6 | importPackage(Packages.org.semanticweb.owlapi.model); 7 | 8 | function main(args) { 9 | var script = args.shift(); 10 | var parser = new Parser(system.args); 11 | var sedFunc = null; 12 | 13 | parser.addOption('h', 'help', null, 'Display help'); 14 | parser.addOption('o', 'outputFile', 'File', 'output file (defaults to stdout)'); 15 | parser.addOption('n', 'number', 'Number', 'Number of axioms to remove.'); 16 | parser.addOption('t', 'toOutputFormat', 'OWLOntologyFormat', 'output format (defaults to RDFXML)'); 17 | 18 | var options = parser.parse(args); 19 | 20 | if (options.help) { 21 | print("Usage: owljs-remove-random-axioms OPTIONS [FUNCTION] OWLFILE\n"); 22 | print("Removes axioms at random. For testing purposes"); 23 | print("\nOptions:"); 24 | print(parser.help()); 25 | system.exit('-1'); 26 | } 27 | 28 | var owl = new OWL(); 29 | owl.addCatalog(); 30 | 31 | if (options.toOutputFormat != null) { 32 | console.log("Setting format to "+options.toOutputFormat); 33 | owl.setDefaultFormat(options.toOutputFormat); 34 | } 35 | 36 | 37 | args.forEach(function(fn) { owl.loadFile(fn) } ); 38 | 39 | if (options.load != null) { 40 | owl.log("Loading "+options.load); 41 | } 42 | 43 | var NUM = options.number; 44 | if (NUM == null) { 45 | NUM = 1; 46 | } 47 | 48 | var axioms = owl.getAllAxioms(null, false); 49 | var axl = axioms.length; 50 | console.log("#Axioms = "+axl); 51 | var rmAxioms = []; 52 | if (NUM >= axl) { 53 | console.warn("Will remove ALL axioms!"); 54 | } 55 | 56 | var i=0; 57 | while (i < NUM) { 58 | axl = axioms.length; 59 | var ai = Math.floor(axl * Math.random()); 60 | console.log("Removing #"+ai); 61 | rmAxioms.push(axioms[ai]); 62 | axioms.splice(ai, 1); 63 | i++; 64 | } 65 | console.log("Remove Axiom Count: "+rmAxioms.length); 66 | owl.removeAxioms(rmAxioms); 67 | 68 | owl.log("Saving to " + options.outputFile); 69 | owl.save(options.outputFile); 70 | } 71 | 72 | // call the main method; ringo specific 73 | if (require.main == module.id) { 74 | main(system.args); 75 | } 76 | -------------------------------------------------------------------------------- /bin/owljs-repl: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | X=`which owljs-repl.js` 3 | ringo-owl $X "$@" 4 | -------------------------------------------------------------------------------- /bin/owljs-repl.js: -------------------------------------------------------------------------------- 1 | // we use include() rather than require(), deliberately polluting our namespace for convenience 2 | include("owljs/repl"); 3 | 4 | var Parser = require('ringo/args').Parser; 5 | var system = require('system'); 6 | var fs = require('fs'); 7 | var {OWL} = require("owljs"); 8 | var {OWLFrame} = require("owljs/owlframe"); 9 | var {DLMatch} = require("owljs/dlmatch"); 10 | var {Obol} = require("owljs/obol"); 11 | var q; 12 | var obol; 13 | var options; 14 | 15 | importPackage(Packages.org.semanticweb.owlapi.model); 16 | 17 | function main(args) { 18 | var script = args.shift(); 19 | var parser = new Parser(system.args); 20 | 21 | parser.addOption('h', 'help', null, 'Display help'); 22 | parser.addOption('i', 'include', 'File', 'loads js. Argument can be a path to a js file or a module name'); 23 | parser.addOption('e', 'evaluate', 'Code', 'evals js code block'); 24 | parser.addOption('l', 'load', 'File', 'Evals file contents'); 25 | parser.addOption('x', 'exit', null, 'Exit on completion'); 26 | parser.addOption('v', 'verbosity', 'Number', 'sets verbosity. >0 logs'); 27 | 28 | options = parser.parse(args); 29 | 30 | if (options.help) { 31 | print("Usage: owljs-repl OPTIONS [ARGUMENTS] [OWLFILE...]\n"); 32 | print("Starts an interactive Read-Eval-Print-Loop."); 33 | print("\nOptions:"); 34 | print(parser.help()); 35 | print("\nExample:"); 36 | print("owljs-repl -i bootcl.js cl-edit.owl"); 37 | print("\nVariables:"); 38 | print(" - o : lookup table keyed by safe-labels, indexing OWL objects"); 39 | print(" - owl : an OWL object"); 40 | print(" - q : a DLMatch object"); 41 | print("\nDocumentation:"); 42 | print("See https://github.com/cmungall/owl.js/blob/master/README-REPL.md"); 43 | system.exit('-1'); 44 | } 45 | 46 | owl = new OWL(); 47 | 48 | owl.config.logLevel = options.verbosity; 49 | 50 | owl.addCatalog(); 51 | 52 | args.forEach(function(fn) { owl.loadFile(fn) } ); 53 | q = new DLMatch(owl); 54 | obol = new Obol(owl); 55 | 56 | owlinit(owl); 57 | if (options.evaluate != null) { 58 | eval(options.evaluate); 59 | } 60 | if (options.load != null) { 61 | eval(fs.read(options.load)); 62 | } 63 | 64 | if (options.include != null) { 65 | var path = options.include; 66 | if (fs.exists(path)) { 67 | load(path); 68 | } 69 | else { 70 | include(path); 71 | } 72 | owlinit(owl); 73 | } 74 | } 75 | 76 | if (require.main == module.id) { 77 | main(system.args); 78 | } 79 | 80 | if (options.exit == null) { 81 | print(">> Welcome!"); 82 | require('ringo/shell').start(); 83 | } 84 | 85 | -------------------------------------------------------------------------------- /bin/owljs-sed: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | X=`which owljs-sed.js` 3 | ringo-owl $X "$@" 4 | -------------------------------------------------------------------------------- /bin/owljs-sed.js: -------------------------------------------------------------------------------- 1 | var Parser = require('ringo/args').Parser; 2 | var system = require('system'); 3 | var {OWL} = require("owljs"); 4 | 5 | // have this available for evaluation of user functions 6 | importPackage(Packages.org.semanticweb.owlapi.model); 7 | 8 | function main(args) { 9 | var script = args.shift(); 10 | var parser = new Parser(system.args); 11 | var sedFunc = null; 12 | 13 | parser.addOption('h', 'help', null, 'Display help'); 14 | parser.addOption('v', 'invertMatch', null, 'Invert (negate) match'); 15 | parser.addOption('o', 'outputFile', 'File', 'output file (defaults to stdout)'); 16 | parser.addOption('f', 'sedFunctionFile', 'File', 'file containing js that evals to sedFunc. If specified no FUNCTION arg is specified'); 17 | parser.addOption('e', 'sedEntities', null, 'True if entities (classes, individuals, properties) are to be sedped, no axioms '); 18 | parser.addOption('m', 'match', 'Regexp', 'regular expression applied to serialization of each axiom. E.g. /epithelium/. If specified, no FUNCTION arg is specified.'); 19 | parser.addOption('t', 'toOutputFormat', 'OWLOntologyFormat', 'output format (defaults to RDFXML)'); 20 | parser.addOption('j', 'jsFrames', null, 'writes output as js frames. TODO'); 21 | 22 | var options = parser.parse(args); 23 | 24 | if (options.help) { 25 | print("Usage: owljs-sed OPTIONS [FUNCTION] OWLFILE\n"); 26 | print("Search and replace axioms from an ontology using a custom function. See owl.sedAxioms() for more detauls"); 27 | print("\nOptions:"); 28 | print(parser.help()); 29 | print("\nExample:"); 30 | print("owljs-sed 'function(ax){ TODO return ax.isLogicalAxiom() }' foo.owl"); 31 | print("\nExample: (use saved function, negate query, write in functional notation)"); 32 | print("owljs-sed -v -t ofn -f lib/owlfunc/axiomIsLogical.js foo.owl"); 33 | system.exit('-1'); 34 | } 35 | 36 | var owl = new OWL(); 37 | owl.addCatalog(); 38 | 39 | if (options.toOutputFormat != null) { 40 | console.log("Setting format to "+options.toOutputFormat); 41 | owl.setDefaultFormat(options.toOutputFormat); 42 | } 43 | 44 | if (options.match != null) { 45 | var mf = eval(options.match); 46 | sedFunc = function(ax) { return mf.test(ax.toString()); }; 47 | } 48 | 49 | if (options.sedFunctionFile != null) { 50 | var fs = require("fs"); 51 | sedFunc = eval(fs.read(options.sedFunctionFile)); 52 | } 53 | 54 | if (sedFunc == null) { 55 | var sedFuncStr = args.shift(); 56 | sedFunc = eval(sedFuncStr); 57 | } 58 | 59 | args.forEach(function(fn) { owl.loadFile(fn) } ); 60 | 61 | if (options.load != null) { 62 | owl.log("Loading "+options.load); 63 | } 64 | 65 | if (options.sedEntities) { 66 | 67 | var filteredObjects = owl.sedObjects(sedFunc, options.invertMatch, true); 68 | owl.log("#filteredObjects = " + filteredObjects.length); 69 | 70 | if (options.jsFrames) { 71 | var repl = require("owljs/repl"); 72 | repl.owlinit(owl); 73 | for (var k in filteredObjects) { 74 | var obj = filteredObjects[k]; 75 | print(repl.render(owl.getFrame(obj))); 76 | } 77 | } 78 | else { 79 | owl.log("Saving to " + options.outputFile); 80 | owl.save(options.outputFile); 81 | } 82 | } 83 | else { 84 | 85 | var newAxioms = owl.sedAxioms(sedFunc, options.invertMatch, true); 86 | owl.log("#newAxioms = " + newAxioms.length); 87 | 88 | if (options.jsFrames) { 89 | var repl = require("owljs/repl"); 90 | repl.owlinit(owl); 91 | //repl.owl = owl; 92 | for (var k in filteredAxioms) { 93 | var ax = filteredAxioms[k]; 94 | print(repl.render(ax)); 95 | } 96 | } 97 | else { 98 | owl.log("Saving to " + options.outputFile); 99 | owl.save(options.outputFile); 100 | } 101 | } 102 | } 103 | 104 | // call the main method; ringo specific 105 | if (require.main == module.id) { 106 | main(system.args); 107 | } 108 | -------------------------------------------------------------------------------- /bin/owljs-svn-diffwrap: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | owljs-diff $6 $7 3 | #exit 0 4 | ##svn diff --diff-cmd owljs-diff "$@" 5 | -------------------------------------------------------------------------------- /bin/owljs-tableify: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | X=`which owljs-tableify.js` 3 | ringo-owl $X "$@" 4 | -------------------------------------------------------------------------------- /bin/owljs-treeify: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | X=`which owljs-treeify.js` 3 | ringo-owl $X "$@" 4 | -------------------------------------------------------------------------------- /bin/owljs-treeify.js: -------------------------------------------------------------------------------- 1 | var Parser = require('ringo/args').Parser; 2 | var system = require('system'); 3 | var {OWL} = require("owljs"); 4 | var ov = require("owljs/vocab/obo"); 5 | 6 | var owl; 7 | var part_of; 8 | var rels; 9 | var relObjs = []; 10 | 11 | function main(args) { 12 | var script = args.shift(); 13 | var parser = new Parser(system.args); 14 | var grepFunc = null; 15 | 16 | parser.addOption('h', 'help', null, 'Display help'); 17 | parser.addOption('r', 'reasoner', 'Reasoner', 'set reasoner factory. Default is elk.'); 18 | parser.addOption('R', 'relations', 'RelList', 'relations to query over.'); 19 | parser.addOption('S', 'superClass', 'Class', 'only use subclasses of this.'); 20 | parser.addOption('c', 'importsClosure', null, 'set this flag if the full import closure is to used'); 21 | parser.addOption('o', 'outputFile', 'File', 'output file (defaults to stdout)'); 22 | 23 | var options = parser.parse(args); 24 | var incClosure = options.importsClosure == null ? false : true; 25 | 26 | if (options.help) { 27 | print("Usage: owljs-treeify OPTIONS OWLFILE\n"); 28 | print("Stats"); 29 | print("\nOptions:"); 30 | print(parser.help()); 31 | system.exit('-1'); 32 | } 33 | 34 | owl = new OWL(); 35 | owl.addCatalog(); 36 | args.forEach(function(fn) { owl.loadFile(fn) } ); 37 | if (options.reasoner != null) { 38 | owl.setReasonerType(options.reasoner); 39 | } 40 | 41 | rels = []; 42 | if (options.relations != null) { 43 | options.relations.split(",").forEach(function(rn) { 44 | rels.push(owl.find(rn)); 45 | }); 46 | } 47 | if (rels == []) { 48 | rels = [ov.part_of(owl)]; 49 | } 50 | relObjs = rels.map( function(r) { 51 | var label = owl.getLabel(r); 52 | if (label == null) { 53 | console.warn("No label: "+r); 54 | } 55 | return { obj : r, 56 | label : label }}); 57 | 58 | var io; 59 | var fs; 60 | if (options.outputFile != null) { 61 | fs = require('fs'); 62 | io = fs.open(options.outputFile, {write:true}); 63 | //fs.write(options.outputFile, json); 64 | } 65 | else { 66 | //print(json); 67 | } 68 | 69 | 70 | var cs; 71 | var type = options.objectType; 72 | if (type == null) { 73 | type = "Class"; 74 | } 75 | if (type == 'Class') { 76 | // note that ontologies that reference other ontologies automatically have 77 | // external referenced classes in their signature; if the intent is to 78 | // show ontologies that 'belong' to an ontology we make the assumption that 79 | // the declaration is accompanied by at least one other axiom 80 | if (options.superClass != null) { 81 | cs = owl.getInferredSubClasses( owl.find(options.superClass), false, true ); 82 | } 83 | else { 84 | cs = owl.getClassesWithAxioms(incClosure); 85 | } 86 | 87 | } 88 | else if (type == 'ObjectProperty') { 89 | cs = owl.getObjectProperties(incClosure); 90 | } 91 | 92 | cs.sort(function(a,b){ return a.getIRI().compareTo(b.getIRI()) }); 93 | 94 | function peekName(obj) { 95 | return obj.name; 96 | } 97 | function peekVal(obj) { 98 | return obj.value; 99 | } 100 | 101 | 102 | var n=0; 103 | for (var k in cs) { 104 | var c = cs[k]; 105 | if (owl.isDeprecated(c)) { 106 | continue; 107 | } 108 | 109 | var tree = getTree(c); 110 | if (tree.length == 0) { 111 | continue; 112 | } 113 | 114 | var line = c.getIRI() + "\t" + owl.getLabel(c) + "\t" + tree.length + "\t" + tree.map( 115 | function(a) { 116 | return owl.getLabel(a); 117 | } 118 | ).join(","); 119 | 120 | if (io == null) { 121 | print(line); 122 | } 123 | else { 124 | io.write(line+"\n"); 125 | } 126 | n++; 127 | } 128 | if (io != null) { 129 | io.close(); 130 | } 131 | } 132 | 133 | function getTree(c) { 134 | var ancs = []; 135 | for (var k in rels) { 136 | var rel = rels[k]; 137 | ancs = ancs.concat(owl.getAncestorsOver(c, rel, true, false)); 138 | ancs.forEach( function(a) { 139 | ancs = ancs.concat(owl.getAncestorsOver(a, rel, true, false)); 140 | }); 141 | } 142 | 143 | return ancs; 144 | } 145 | 146 | 147 | // call the main method; ringo specific 148 | if (require.main == module.id) { 149 | main(system.args); 150 | } 151 | -------------------------------------------------------------------------------- /bin/ringo-owl: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | CLASSPATH_LITERAL="" 4 | 5 | PATH_SEP=":" 6 | 7 | JAVAARGS=" " 8 | CMDARGS=" " 9 | 10 | PATH_TO_ME=`which $0`; 11 | 12 | #Now see if the path is actually a symbolic link. If it is, set TEMP 13 | #to true 14 | TEMP=`ls -l $PATH_TO_ME | sed -e "s/.* -> \(.*\)/true/g"` 15 | if [ -z "$TEMP" ] 16 | then 17 | TEMP='false'; 18 | fi 19 | 20 | #While we keep finding symbolic links... 21 | while [ "$TEMP" = "true" ] 22 | do 23 | #Parse the ls output and set PATH_TO_ME to the actual location of the 24 | #symbolic link 25 | PATH_TO_ME=`ls -l $PATH_TO_ME | sed -e "s/.* -> \(.*\)/\1/g"` 26 | 27 | TEMP=`ls -l $PATH_TO_ME | sed -e "s/.* -> \(.*\)/true/g"` 28 | if [ -z "$TEMP" ] 29 | then 30 | TEMP='false' 31 | fi 32 | done 33 | 34 | #If PATH_TO_ME is a relative link, set TEMP to true, otherwise set 35 | #TEMP to false 36 | TEMP=`echo $PATH_TO_ME | sed -e "s/^\/.*/true/g"` 37 | if [ -z "$TEMP" ] 38 | then 39 | TEMP='false' 40 | fi 41 | 42 | #If PATH_TO_ME was a relative link, change it to an absolute reference 43 | if [ $TEMP != 'true' ] 44 | then 45 | PATH_TO_ME="$PWD/$PATH_TO_ME" 46 | fi 47 | 48 | SCRIPTNAME=`echo $PATH_TO_ME | sed -e "s/.*\/\(.*\)/\1/g"` 49 | 50 | #Remove the name of this script from the end of the path 51 | PATH_TO_ME=`echo $PATH_TO_ME | sed -e "s/\(.*\)\/.*/\1/g"` 52 | 53 | 54 | 55 | ## Assumption: all classes including rhino are packed into 56 | ## owltools-runner-all.jar 57 | ## These will be resolved into absolute pathnames 58 | DEFAULT_OWLTOOLS_LOCATION=../jars/owltools-runner-all.jar 59 | ALTERNATIVE_OWLTOOLS_LOCATION=../owltools-runner-all.jar 60 | 61 | if [ -f $PATH_TO_ME/$DEFAULT_OWLTOOLS_LOCATION ]; 62 | then 63 | CLASSPATH_RELATIVE=$DEFAULT_OWLTOOLS_LOCATION; 64 | else 65 | if [ -f $PATH_TO_ME/$ALTERNATIVE_OWLTOOLS_LOCATION ]; 66 | then 67 | CLASSPATH_RELATIVE=$ALTERNATIVE_OWLTOOLS_LOCATION; 68 | else 69 | echo "Cannot find owltools-runner-all.jar in any of the expected locations"; 70 | exit 1 71 | fi 72 | fi 73 | 74 | DEREFERENCED_CLASSPATH=`ls -1 -L $PATH_TO_ME/$CLASSPATH_RELATIVE | grep -v ontologyrelease` 75 | 76 | 77 | 78 | export OWLTOOLS_JAR_PATH=$DEREFERENCED_CLASSPATH 79 | 80 | #BOOT="-b $PATH_TO_ME/pachyowl.js -b $PATH_TO_ME/owlrunner.js" 81 | ##ringo -J-Xmx8G -J-XX:MaxPermSize=256M -DentityExpansionLimit=2048000 "$@" 82 | ringo -J-Xmx8G -DentityExpansionLimit=2048000 "$@" 83 | #ringo $BOOT -e "addToClasspath('$DEREFERENCED_CLASSPATH')" "$@" 84 | 85 | -------------------------------------------------------------------------------- /bin/svn-owl-diff: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | svn diff --diff-cmd owljs-svn-diffwrap "$@" 3 | -------------------------------------------------------------------------------- /bin/svn-owl-htmldiff: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | svn diff --diff-cmd owljs-svn-diffwrap "$@" > diff.md && pandoc diff.md -o diff.html && open diff.html 3 | -------------------------------------------------------------------------------- /conf/cl/cl-cjm-conf.js: -------------------------------------------------------------------------------- 1 | // To use this conf: 2 | // 3 | // cd cell-ontology/src/ontology 4 | // owljs-repl -i cl-cjm-conf.js cl-edit.owl 5 | // 6 | // Make sure file is copied to same dir, or add a symlink. 7 | // You can clone this for your own setup 8 | 9 | owl.config.idspace = 'CL'; 10 | owl.config.lastId = 10000; // CJM 11 | owl.defaultSlotMap = { created_by : "GOC:cjm" }; // todo - dates 12 | owl.config.defaultFormat = new org.semanticweb.owlapi.io.OWLFunctionalSyntaxOntologyFormat(); // todo - introspect this 13 | 14 | print("Welcome, CJM"); 15 | -------------------------------------------------------------------------------- /conf/learner/class.conf: -------------------------------------------------------------------------------- 1 | ks.type = "OWL File" 2 | 3 | ks.fileName = "mptest.ofn" 4 | 5 | reasoner.type = "fast instance checker" 6 | 7 | reasoner.sources = { ks } 8 | 9 | lp.type = "classLearningProblem" 10 | 11 | lp.classToDescribe = "http://purl.obolibrary.org/obo/MP_0000807" 12 | 13 | alg1.type = "celoe" 14 | alg2.type = "pceloe" 15 | 16 | -------------------------------------------------------------------------------- /conf/learner/mptest.conf: -------------------------------------------------------------------------------- 1 | ks.type = "OWL File" 2 | 3 | ks.fileName = "mptest.ofn" 4 | 5 | reasoner.type = "fast instance checker" 6 | 7 | reasoner.sources = { ks } 8 | 9 | lp.type = "posOnlyLP" 10 | 11 | lp.positiveExamples = { 12 | 13 | "http://purl.obolibrary.org/obo/MGI_fake", 14 | "http://purl.obolibrary.org/obo/MGI_101765", 15 | "http://purl.obolibrary.org/obo/MGI_101764" 16 | } 17 | 18 | alg1.type = "celoe" 19 | alg2.type = "pceloe" 20 | 21 | -------------------------------------------------------------------------------- /conf/uberon/uberon-cjm-conf.js: -------------------------------------------------------------------------------- 1 | // To use this conf: 2 | // 3 | // cd uberon 4 | // owljs-repl -i load-uberon-edit.js uberon.owl 5 | 6 | owl.config.idspace = 'UBERON'; 7 | owl.config.lastId = 10000; // CJM 8 | owl.defaultSlotMap = { created_by : "GOC:cjm" }; // todo - dates 9 | owl.config.defaultFormat = new org.semanticweb.owlapi.io.OWLFunctionalSyntaxOntologyFormat(); // todo - introspect this 10 | 11 | print("Welcome, CJM"); 12 | -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/javascript/main.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cmungall/owljs/b2a6db28e1b214049b5b7686fb28c09a68806410/docs/javascript/main.js -------------------------------------------------------------------------------- /docs/javascript/prettify.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cmungall/owljs/b2a6db28e1b214049b5b7686fb28c09a68806410/docs/javascript/prettify.js -------------------------------------------------------------------------------- /docs/javascript/searchdata.js: -------------------------------------------------------------------------------- 1 | var indexSectionsWithContent = { 2 | "General": { 3 | "Symbols": false, 4 | "Numbers": false, 5 | "A": true, 6 | "B": true, 7 | "C": false, 8 | "D": true, 9 | "E": true, 10 | "F": true, 11 | "G": true, 12 | "H": true, 13 | "I": true, 14 | "J": false, 15 | "K": false, 16 | "L": true, 17 | "M": false, 18 | "N": false, 19 | "O": true, 20 | "P": false, 21 | "Q": false, 22 | "R": true, 23 | "S": true, 24 | "T": true, 25 | "U": true, 26 | "V": true, 27 | "W": false, 28 | "X": true, 29 | "Y": false, 30 | "Z": false 31 | }, 32 | "Variables": { 33 | "Symbols": false, 34 | "Numbers": false, 35 | "A": false, 36 | "B": false, 37 | "C": false, 38 | "D": false, 39 | "E": false, 40 | "F": false, 41 | "G": false, 42 | "H": false, 43 | "I": false, 44 | "J": false, 45 | "K": false, 46 | "L": true, 47 | "M": false, 48 | "N": false, 49 | "O": true, 50 | "P": false, 51 | "Q": false, 52 | "R": false, 53 | "S": false, 54 | "T": false, 55 | "U": false, 56 | "V": false, 57 | "W": false, 58 | "X": false, 59 | "Y": false, 60 | "Z": false 61 | }, 62 | "Functions": { 63 | "Symbols": false, 64 | "Numbers": false, 65 | "A": true, 66 | "B": false, 67 | "C": true, 68 | "D": true, 69 | "E": true, 70 | "F": true, 71 | "G": true, 72 | "H": true, 73 | "I": true, 74 | "J": true, 75 | "K": false, 76 | "L": true, 77 | "M": true, 78 | "N": true, 79 | "O": true, 80 | "P": true, 81 | "Q": false, 82 | "R": true, 83 | "S": true, 84 | "T": true, 85 | "U": true, 86 | "V": false, 87 | "W": true, 88 | "X": false, 89 | "Y": false, 90 | "Z": false 91 | }, 92 | "Classes": { 93 | "Symbols": false, 94 | "Numbers": false, 95 | "A": false, 96 | "B": false, 97 | "C": false, 98 | "D": true, 99 | "E": false, 100 | "F": false, 101 | "G": false, 102 | "H": false, 103 | "I": false, 104 | "J": true, 105 | "K": false, 106 | "L": true, 107 | "M": false, 108 | "N": false, 109 | "O": true, 110 | "P": false, 111 | "Q": false, 112 | "R": true, 113 | "S": false, 114 | "T": false, 115 | "U": false, 116 | "V": true, 117 | "W": false, 118 | "X": false, 119 | "Y": false, 120 | "Z": false 121 | } 122 | } -------------------------------------------------------------------------------- /docs/search/ClassesD.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Loading...
Searching...
No Matches
-------------------------------------------------------------------------------- /docs/search/ClassesJ.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Loading...
Searching...
No Matches
-------------------------------------------------------------------------------- /docs/search/ClassesO.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Loading...
Searching...
No Matches
-------------------------------------------------------------------------------- /docs/search/ClassesR.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Loading...
Searching...
No Matches
-------------------------------------------------------------------------------- /docs/search/ClassesV.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Loading...
Searching...
No Matches
-------------------------------------------------------------------------------- /docs/search/FunctionsA.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Loading...
addSynonym, vocab.obo
Searching...
No Matches
-------------------------------------------------------------------------------- /docs/search/FunctionsC.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Loading...
class, OWL
Searching...
No Matches
-------------------------------------------------------------------------------- /docs/search/FunctionsD.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Loading...
declare, OWL
definition, vocab.obo
df, repl
Differ, Differ
DLMatch, DLMatch
Searching...
No Matches
-------------------------------------------------------------------------------- /docs/search/FunctionsE.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Loading...
Searching...
No Matches
-------------------------------------------------------------------------------- /docs/search/FunctionsF.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Loading...
findAndExtend, DLMatch
flatten, OWLFrame
frame, repl
Searching...
No Matches
-------------------------------------------------------------------------------- /docs/search/FunctionsH.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Loading...
hasBroadSynonym, vocab.obo
hasDbXref, vocab.obo
hasExactSynonym, vocab.obo
hasNarrowSynonym, vocab.obo
Searching...
No Matches
-------------------------------------------------------------------------------- /docs/search/FunctionsI.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Loading...
info, OWL
inSubset, vocab.obo
Searching...
No Matches
-------------------------------------------------------------------------------- /docs/search/FunctionsJ.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Loading...
jsArrayToSet, javautil
Searching...
No Matches
-------------------------------------------------------------------------------- /docs/search/FunctionsL.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Loading...
Linky, Linky
literal, OWL
Searching...
No Matches
-------------------------------------------------------------------------------- /docs/search/FunctionsM.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Loading...
merge, OWLFrame
mfind, OWL
mgr, repl
mkClass, repl
Searching...
No Matches
-------------------------------------------------------------------------------- /docs/search/FunctionsN.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Loading...
Searching...
No Matches
-------------------------------------------------------------------------------- /docs/search/FunctionsO.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Loading...
Obol, obol
ont, repl
OWL, OWL
OWLFrame, OWLFrame
Searching...
No Matches
-------------------------------------------------------------------------------- /docs/search/FunctionsP.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Loading...
parse, obol
pp, repl
Searching...
No Matches
-------------------------------------------------------------------------------- /docs/search/FunctionsR.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Loading...
reasoner, repl
Searching...
No Matches
-------------------------------------------------------------------------------- /docs/search/FunctionsS.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Loading...
set, OWLFrame
stamp, OWLFrame
synonym, vocab.nif
synonymAssertion, vocab.obo
Searching...
No Matches
-------------------------------------------------------------------------------- /docs/search/FunctionsT.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Loading...
testIfMatches, DLMatch
toAxioms, OWLFrame
Searching...
No Matches
-------------------------------------------------------------------------------- /docs/search/FunctionsU.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Loading...
unionOf, OWL
Searching...
No Matches
-------------------------------------------------------------------------------- /docs/search/FunctionsW.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Loading...
warn, OWL
Searching...
No Matches
-------------------------------------------------------------------------------- /docs/search/GeneralA.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Loading...
addSynonym, vocab.obo
Searching...
No Matches
-------------------------------------------------------------------------------- /docs/search/GeneralC.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Loading...
class, OWL
Searching...
No Matches
-------------------------------------------------------------------------------- /docs/search/GeneralD.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Loading...
declare, OWL
definition, vocab.obo
df, repl
Searching...
No Matches
-------------------------------------------------------------------------------- /docs/search/GeneralE.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Loading...
Searching...
No Matches
-------------------------------------------------------------------------------- /docs/search/GeneralF.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Loading...
findAndExtend, DLMatch
flatten, OWLFrame
frame, repl
Searching...
No Matches
-------------------------------------------------------------------------------- /docs/search/GeneralH.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Loading...
hasBroadSynonym, vocab.obo
hasDbXref, vocab.obo
hasExactSynonym, vocab.obo
hasNarrowSynonym, vocab.obo
Searching...
No Matches
-------------------------------------------------------------------------------- /docs/search/GeneralI.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Loading...
info, OWL
inSubset, vocab.obo
IRI, owlapi
Searching...
No Matches
-------------------------------------------------------------------------------- /docs/search/GeneralJ.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Loading...
jsArrayToSet, javautil
Searching...
No Matches
-------------------------------------------------------------------------------- /docs/search/GeneralL.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Loading...
literal, OWL
Searching...
No Matches
-------------------------------------------------------------------------------- /docs/search/GeneralM.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Loading...
merge, OWLFrame
mfind, OWL
mgr, repl
mkClass, repl
Searching...
No Matches
-------------------------------------------------------------------------------- /docs/search/GeneralN.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Loading...
Searching...
No Matches
-------------------------------------------------------------------------------- /docs/search/GeneralP.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Loading...
parse, obol
pp, repl
Searching...
No Matches
-------------------------------------------------------------------------------- /docs/search/GeneralR.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Loading...
reasoner, repl
Searching...
No Matches
-------------------------------------------------------------------------------- /docs/search/GeneralS.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Loading...
set, OWLFrame
stamp, OWLFrame
synonym, vocab.nif
synonymAssertion, vocab.obo
Searching...
No Matches
-------------------------------------------------------------------------------- /docs/search/GeneralT.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Loading...
testIfMatches, DLMatch
toAxioms, OWLFrame
Searching...
No Matches
-------------------------------------------------------------------------------- /docs/search/GeneralU.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Loading...
unionOf, OWL
Searching...
No Matches
-------------------------------------------------------------------------------- /docs/search/GeneralV.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Loading...
Variables, repl
Searching...
No Matches
-------------------------------------------------------------------------------- /docs/search/GeneralW.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Loading...
warn, OWL
Searching...
No Matches
-------------------------------------------------------------------------------- /docs/search/NoResults.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
No Matches
-------------------------------------------------------------------------------- /docs/search/VariablesL.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Loading...
Searching...
No Matches
-------------------------------------------------------------------------------- /docs/search/VariablesO.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
Loading...
o, repl
obj, repl
owl, repl
Searching...
No Matches
-------------------------------------------------------------------------------- /docs/styles/main.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cmungall/owljs/b2a6db28e1b214049b5b7686fb28c09a68806410/docs/styles/main.css -------------------------------------------------------------------------------- /jars/owltools-runner-all.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cmungall/owljs/b2a6db28e1b214049b5b7686fb28c09a68806410/jars/owltools-runner-all.jar -------------------------------------------------------------------------------- /lib/.naturaldocs_project/Data/ClassHierarchy.nd: -------------------------------------------------------------------------------- 1 | 2javautil&/Users/cjm/repos/owljs/lib/javautil.jsowlapi!/Users/cjm/repos/owljs/lib/owl.jsDLMatch%/Users/cjm/repos/owljs/lib/dlmatch.jsLinky#/Users/cjm/repos/owljs/lib/linky.jsvocabobo'/Users/cjm/repos/owljs/lib/vocab/obo.jsOWL!/Users/cjm/repos/owljs/lib/owl.jsrepl"/Users/cjm/repos/owljs/lib/repl.jsDiffer$/Users/cjm/repos/owljs/lib/Differ.jsOWLFrame&/Users/cjm/repos/owljs/lib/owlframe.jsvocabnif'/Users/cjm/repos/owljs/lib/vocab/nif.jsobol"/Users/cjm/repos/owljs/lib/obol.js -------------------------------------------------------------------------------- /lib/.naturaldocs_project/Data/ConfigFileInfo.nd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cmungall/owljs/b2a6db28e1b214049b5b7686fb28c09a68806410/lib/.naturaldocs_project/Data/ConfigFileInfo.nd -------------------------------------------------------------------------------- /lib/.naturaldocs_project/Data/FileInfo.nd: -------------------------------------------------------------------------------- 1 | 1.5 2 | JavaScript 3 | /Users/cjm/repos/owljs/lib/obol/anatomy.js 1391579138 0 /Users/cjm/repos/owljs/lib/obol/anatomy.js 4 | /Users/cjm/repos/owljs/lib/owl/owlframe.js 1391579138 0 /Users/cjm/repos/owljs/lib/owl/owlframe.js 5 | /Users/cjm/repos/owljs/lib/owl.js 1397413827 1 OWL 6 | /Users/cjm/repos/owljs/lib/obol/phenotype.js 1392707382 0 /Users/cjm/repos/owljs/lib/obol/phenotype.js 7 | /Users/cjm/repos/owljs/lib/vocab/nif.js 1391579138 1 vocab.nif 8 | /Users/cjm/repos/owljs/lib/owlframe.js 1391579138 1 OWLFrame 9 | /Users/cjm/repos/owljs/lib/io/table.js 1397415266 0 /Users/cjm/repos/owljs/lib/io/table.js 10 | /Users/cjm/repos/owljs/lib/io/dotty.js 1397357787 1 Dotty 11 | /Users/cjm/repos/owljs/lib/vocab.js 1391579138 0 /Users/cjm/repos/owljs/lib/vocab.js 12 | /Users/cjm/repos/owljs/lib/dlmatch.js 1396408063 1 DLMatch 13 | /Users/cjm/repos/owljs/lib/owlfunc/trPartOfToSomaLocation.js 1391579138 0 /Users/cjm/repos/owljs/lib/owlfunc/trPartOfToSomaLocation.js 14 | /Users/cjm/repos/owljs/lib/obol/bp.js 1391579138 0 /Users/cjm/repos/owljs/lib/obol/bp.js 15 | /Users/cjm/repos/owljs/lib/owl/owlserver.js 1391579138 0 /Users/cjm/repos/owljs/lib/owl/owlserver.js 16 | /Users/cjm/repos/owljs/lib/learner.js 1391579138 0 /Users/cjm/repos/owljs/lib/learner.js 17 | /Users/cjm/repos/owljs/lib/linky.js 1397414173 1 Linky 18 | /Users/cjm/repos/owljs/lib/obol/bp/cellDevelopment.js 1392591655 0 /Users/cjm/repos/owljs/lib/obol/bp/cellDevelopment.js 19 | /Users/cjm/repos/owljs/lib/obol/bp/involvedIn.js 1391579138 0 /Users/cjm/repos/owljs/lib/obol/bp/involvedIn.js 20 | /Users/cjm/repos/owljs/lib/owl/addons.js 1391579138 0 /Users/cjm/repos/owljs/lib/owl/addons.js 21 | /Users/cjm/repos/owljs/lib/io/markdown.js 1397413887 0 /Users/cjm/repos/owljs/lib/io/markdown.js 22 | /Users/cjm/repos/owljs/lib/obol/equiv.js 1391579138 0 /Users/cjm/repos/owljs/lib/obol/equiv.js 23 | /Users/cjm/repos/owljs/lib/repl.js 1394757251 1 repl 24 | /Users/cjm/repos/owljs/lib/Stats.js 1391579138 0 /Users/cjm/repos/owljs/lib/Stats.js 25 | /Users/cjm/repos/owljs/lib/owl/attic.js 1391579138 0 /Users/cjm/repos/owljs/lib/owl/attic.js 26 | /Users/cjm/repos/owljs/lib/owl/owlservices.js 1391579138 0 /Users/cjm/repos/owljs/lib/owl/owlservices.js 27 | /Users/cjm/repos/owljs/lib/vocab/obo.js 1397346875 1 vocab.obo 28 | /Users/cjm/repos/owljs/lib/Differ.js 1395383083 1 Differ 29 | /Users/cjm/repos/owljs/lib/javautil.js 1391579138 1 javautil 30 | /Users/cjm/repos/owljs/lib/obol/bp/regulationOfQuality.js 1391579138 0 /Users/cjm/repos/owljs/lib/obol/bp/regulationOfQuality.js 31 | /Users/cjm/repos/owljs/lib/obol.js 1397355877 1 obol 32 | /Users/cjm/repos/owljs/lib/owlfunc/axiomIsLogical.js 1391579138 0 /Users/cjm/repos/owljs/lib/owlfunc/axiomIsLogical.js 33 | -------------------------------------------------------------------------------- /lib/.naturaldocs_project/Data/ImageFileInfo.nd: -------------------------------------------------------------------------------- 1 | 2 -------------------------------------------------------------------------------- /lib/.naturaldocs_project/Data/ImageReferenceTable.nd: -------------------------------------------------------------------------------- 1 | 2 -------------------------------------------------------------------------------- /lib/.naturaldocs_project/Data/IndexInfo.nd: -------------------------------------------------------------------------------- 1 | 2GeneralVariableFunctionClass -------------------------------------------------------------------------------- /lib/.naturaldocs_project/Data/PreviousMenuState.nd: -------------------------------------------------------------------------------- 1 | 2OWL!/Users/cjm/repos/owljs/lib/owl.jsOWLFrame&/Users/cjm/repos/owljs/lib/owlframe.jsDLMatch%/Users/cjm/repos/owljs/lib/dlmatch.jsDiffer$/Users/cjm/repos/owljs/lib/Differ.jsLinky#/Users/cjm/repos/owljs/lib/linky.jsobol"/Users/cjm/repos/owljs/lib/obol.jsrepl"/Users/cjm/repos/owljs/lib/repl.jsjavautil&/Users/cjm/repos/owljs/lib/javautil.js vocab.obo'/Users/cjm/repos/owljs/lib/vocab/obo.js vocab.nif'/Users/cjm/repos/owljs/lib/vocab/nif.jsDotty&/Users/cjm/repos/owljs/lib/io/dotty.jsIndex 2 | EverythinggeneralClassesclass Functionsfunction Variablesvariable -------------------------------------------------------------------------------- /lib/.naturaldocs_project/Data/PreviousSettings.nd: -------------------------------------------------------------------------------- 1 | 2/Users/cjm/repos/owljs/lib1/Users/cjm/repos/owljs/docsHTML -------------------------------------------------------------------------------- /lib/.naturaldocs_project/Data/SymbolTable.nd: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cmungall/owljs/b2a6db28e1b214049b5b7686fb28c09a68806410/lib/.naturaldocs_project/Data/SymbolTable.nd -------------------------------------------------------------------------------- /lib/.naturaldocs_project/Menu.txt: -------------------------------------------------------------------------------- 1 | Format: 1.5 2 | 3 | 4 | Title: owl-js 5 | 6 | # You can also add a sub-title to your menu like this: 7 | # SubTitle: [subtitle] 8 | 9 | Footer: [owl.js on github] 10 | 11 | # You can add a timestamp to your documentation like one of these: 12 | # Timestamp: Generated on month day, year 13 | # Timestamp: Updated mm/dd/yyyy 14 | # Timestamp: Last updated mon day 15 | # 16 | # m - One or two digit month. January is "1" 17 | # mm - Always two digit month. January is "01" 18 | # mon - Short month word. January is "Jan" 19 | # month - Long month word. January is "January" 20 | # d - One or two digit day. 1 is "1" 21 | # dd - Always two digit day. 1 is "01" 22 | # day - Day with letter extension. 1 is "1st" 23 | # yy - Two digit year. 2006 is "06" 24 | # yyyy - Four digit year. 2006 is "2006" 25 | # year - Four digit year. 2006 is "2006" 26 | 27 | 28 | # -------------------------------------------------------------------------- 29 | # 30 | # Cut and paste the lines below to change the order in which your files 31 | # appear on the menu. Don't worry about adding or removing files, Natural 32 | # Docs will take care of that. 33 | # 34 | # You can further organize the menu by grouping the entries. Add a 35 | # "Group: [name] {" line to start a group, and add a "}" to end it. 36 | # 37 | # You can add text and web links to the menu by adding "Text: [text]" and 38 | # "Link: [name] ([URL])" lines, respectively. 39 | # 40 | # The formatting and comments are auto-generated, so don't worry about 41 | # neatness when editing the file. Natural Docs will clean it up the next 42 | # time it is run. When working with groups, just deal with the braces and 43 | # forget about the indentation and comments. 44 | # 45 | # -------------------------------------------------------------------------- 46 | 47 | 48 | File: OWL (no auto-title, owl.js) 49 | File: OWLFrame (owlframe.js) 50 | File: DLMatch (dlmatch.js) 51 | File: Differ (Differ.js) 52 | File: Linky (linky.js) 53 | File: obol (obol.js) 54 | File: repl (repl.js) 55 | File: javautil (javautil.js) 56 | File: vocab.obo (vocab/obo.js) 57 | File: vocab.nif (vocab/nif.js) 58 | File: Dotty (io/dotty.js) 59 | 60 | Group: Index { 61 | 62 | Index: Everything 63 | Class Index: Classes 64 | Function Index: Functions 65 | Variable Index: Variables 66 | } # Group: Index 67 | 68 | -------------------------------------------------------------------------------- /lib/.naturaldocs_project/Menu_Backup.txt: -------------------------------------------------------------------------------- 1 | Format: 1.5 2 | 3 | 4 | # You can add a title and sub-title to your menu like this: 5 | # Title: [project name] 6 | # SubTitle: [subtitle] 7 | 8 | # You can add a footer to your documentation like this: 9 | # Footer: [text] 10 | # If you want to add a copyright notice, this would be the place to do it. 11 | 12 | # You can add a timestamp to your documentation like one of these: 13 | # Timestamp: Generated on month day, year 14 | # Timestamp: Updated mm/dd/yyyy 15 | # Timestamp: Last updated mon day 16 | # 17 | # m - One or two digit month. January is "1" 18 | # mm - Always two digit month. January is "01" 19 | # mon - Short month word. January is "Jan" 20 | # month - Long month word. January is "January" 21 | # d - One or two digit day. 1 is "1" 22 | # dd - Always two digit day. 1 is "01" 23 | # day - Day with letter extension. 1 is "1st" 24 | # yy - Two digit year. 2006 is "06" 25 | # yyyy - Four digit year. 2006 is "2006" 26 | # year - Four digit year. 2006 is "2006" 27 | 28 | 29 | # -------------------------------------------------------------------------- 30 | # 31 | # Cut and paste the lines below to change the order in which your files 32 | # appear on the menu. Don't worry about adding or removing files, Natural 33 | # Docs will take care of that. 34 | # 35 | # You can further organize the menu by grouping the entries. Add a 36 | # "Group: [name] {" line to start a group, and add a "}" to end it. 37 | # 38 | # You can add text and web links to the menu by adding "Text: [text]" and 39 | # "Link: [name] ([URL])" lines, respectively. 40 | # 41 | # The formatting and comments are auto-generated, so don't worry about 42 | # neatness when editing the file. Natural Docs will clean it up the next 43 | # time it is run. When working with groups, just deal with the braces and 44 | # forget about the indentation and comments. 45 | # 46 | # -------------------------------------------------------------------------- 47 | 48 | 49 | Group: Data { 50 | 51 | File: dispatch.js (data/dispatch.js) 52 | File: golr.js (data/golr.js) 53 | File: server.js (data/server.js) 54 | File: statistics.js (data/statistics.js) 55 | File: xrefs.js (data/xrefs.js) 56 | } # Group: Data 57 | 58 | File: api.js (api.js) 59 | File: echo.js (handlers/echo.js) 60 | File: handler.js (handler.js) 61 | File: linker.js (linker.js) 62 | File: owl_class_expression.js (handlers/owl_class_expression.js) 63 | File: rollup.js (ui/rollup.js) 64 | File: version.js (version.js) 65 | 66 | Group: Index { 67 | 68 | Index: Everything 69 | Class Index: Classes 70 | Function Index: Functions 71 | Variable Index: Variables 72 | } # Group: Index 73 | 74 | -------------------------------------------------------------------------------- /lib/.naturaldocs_project/Topics.txt: -------------------------------------------------------------------------------- 1 | Format: 1.5 2 | 3 | # This is the Natural Docs topics file for this project. If you change anything 4 | # here, it will apply to THIS PROJECT ONLY. If you'd like to change something 5 | # for all your projects, edit the Topics.txt in Natural Docs' Config directory 6 | # instead. 7 | 8 | 9 | # If you'd like to prevent keywords from being recognized by Natural Docs, you 10 | # can do it like this: 11 | # Ignore Keywords: [keyword], [keyword], ... 12 | # 13 | # Or you can use the list syntax like how they are defined: 14 | # Ignore Keywords: 15 | # [keyword] 16 | # [keyword], [plural keyword] 17 | # ... 18 | 19 | 20 | #------------------------------------------------------------------------------- 21 | # SYNTAX: 22 | # 23 | # Topic Type: [name] 24 | # Alter Topic Type: [name] 25 | # Creates a new topic type or alters one from the main file. Each type gets 26 | # its own index and behavior settings. Its name can have letters, numbers, 27 | # spaces, and these charaters: - / . ' 28 | # 29 | # Plural: [name] 30 | # Sets the plural name of the topic type, if different. 31 | # 32 | # Keywords: 33 | # [keyword] 34 | # [keyword], [plural keyword] 35 | # ... 36 | # Defines or adds to the list of keywords for the topic type. They may only 37 | # contain letters, numbers, and spaces and are not case sensitive. Plural 38 | # keywords are used for list topics. You can redefine keywords found in the 39 | # main topics file. 40 | # 41 | # Index: [yes|no] 42 | # Whether the topics get their own index. Defaults to yes. Everything is 43 | # included in the general index regardless of this setting. 44 | # 45 | # Scope: [normal|start|end|always global] 46 | # How the topics affects scope. Defaults to normal. 47 | # normal - Topics stay within the current scope. 48 | # start - Topics start a new scope for all the topics beneath it, 49 | # like class topics. 50 | # end - Topics reset the scope back to global for all the topics 51 | # beneath it. 52 | # always global - Topics are defined as global, but do not change the scope 53 | # for any other topics. 54 | # 55 | # Class Hierarchy: [yes|no] 56 | # Whether the topics are part of the class hierarchy. Defaults to no. 57 | # 58 | # Page Title If First: [yes|no] 59 | # Whether the topic's title becomes the page title if it's the first one in 60 | # a file. Defaults to no. 61 | # 62 | # Break Lists: [yes|no] 63 | # Whether list topics should be broken into individual topics in the output. 64 | # Defaults to no. 65 | # 66 | # Can Group With: [type], [type], ... 67 | # Defines a list of topic types that this one can possibly be grouped with. 68 | # Defaults to none. 69 | #------------------------------------------------------------------------------- 70 | 71 | # The following topics are defined in the main file, if you'd like to alter 72 | # their behavior or add keywords: 73 | # 74 | # Generic, Class, Interface, Section, File, Group, Function, Variable, 75 | # Property, Type, Constant, Enumeration, Event, Delegate, Macro, 76 | # Database, Database Table, Database View, Database Index, Database 77 | # Cursor, Database Trigger, Cookie, Build Target 78 | 79 | # If you add something that you think would be useful to other developers 80 | # and should be included in Natural Docs by default, please e-mail it to 81 | # topics [at] naturaldocs [dot] org. 82 | -------------------------------------------------------------------------------- /lib/Stats.js: -------------------------------------------------------------------------------- 1 | var obovocab = require("owljs/vocab/obo"); 2 | 3 | var getOntologyStats = exports.getOntologyStats = function(owl, objs, gf) { 4 | return { 5 | avgAncestors : avgInferredSuperClassesPerClass(owl, objs, gf, false ), 6 | avgParents : avgInferredSuperClassesPerClass(owl, objs, gf, true ), 7 | } 8 | } 9 | 10 | var avgPerObj = function(owl, objs, nFunc, gf) { 11 | if (gf == null) { 12 | gf = function() { return obovocab.getOboIdentifierPrefix(owl, obj) }; 13 | } 14 | if (objs == null) { 15 | objs = owl.getClasses().filter(function(c) { return !owl.isDeprecated(c)} ); 16 | } 17 | var countsByGroup = {}; 18 | for (var k in objs) { 19 | var obj = objs[k]; 20 | var n = nFunc.call(this, obj); 21 | var g = gf.call(this, obj); 22 | if (g == null) { 23 | g = "null"; 24 | } 25 | if (countsByGroup[g] == null) { 26 | countsByGroup[g] = []; 27 | } 28 | countsByGroup[g].push(n); 29 | } 30 | var am = {}; 31 | for (var k in countsByGroup) { 32 | var tot = countsByGroup[k].reduce( function(a,b) { return a+b } ); 33 | am[k] = tot / countsByGroup[k].length; 34 | } 35 | return am; 36 | } 37 | 38 | var avgInferredSuperClassesPerClass = exports.avgInferredSuperClassesPerClass = function(owl,objs,gf,isDirect) { 39 | if (isDirect == null) { 40 | isDirect = true; 41 | } 42 | return avgPerObj(owl, 43 | objs, 44 | function(c) { 45 | return owl.getInferredSuperClasses(c, isDirect, false).length; 46 | }, 47 | gf); 48 | } 49 | -------------------------------------------------------------------------------- /lib/io/dotty.js: -------------------------------------------------------------------------------- 1 | 2 | export('Dotty'); 3 | 4 | var javautil = require("owljs/javautil"); 5 | var md = require("owljs/io/markdown"); 6 | 7 | 8 | /* Function: Dotty 9 | * 10 | * Constructor 11 | * 12 | */ 13 | function Dotty(owl) { 14 | this.owl = owl; 15 | this.nodes = []; 16 | this.edge = []; 17 | return this; 18 | } 19 | 20 | Dotty.prototype.addNode = function(node) { 21 | this.nodes.push(node); 22 | } 23 | 24 | Dotty.prototype.addEdge = function(edge) { 25 | this.edges.push(edge); 26 | 27 | } 28 | 29 | 30 | Dotty.prototype.render = function() { 31 | this.w("digraph g {"); 32 | var rsg = this.renderSubGraph; 33 | this.subgraphs.forEach(rsg); 34 | this.w("}"); 35 | 36 | } 37 | 38 | 39 | -------------------------------------------------------------------------------- /lib/io/markdown.js: -------------------------------------------------------------------------------- 1 | 2 | var infixMap = 3 | { 4 | SubClassOf : "SubClassOf", 5 | EquivalentClasses: "EquivalentTo", 6 | ObjectIntersectionOf: "and", 7 | ObjectUnionOf: "or", 8 | ObjectComplementOf: "or", 9 | } 10 | 11 | var render = exports.renderOWLObject = function(obj, owl, opts) { 12 | return render(owl.toAxiomaticJSON(obj), owl, opts); 13 | } 14 | 15 | var render = exports.render = function(obj, owl, opts) { 16 | var cx = this; 17 | if (typeof obj == 'object') { 18 | var md; 19 | var type = obj.type; 20 | var xargs = obj.args.map( function(a) { return cx.render(a, owl, opts) }); 21 | if (infixMap[type] != null) { 22 | md = xargs.join(" **"+infixMap[type]+"** "); 23 | } 24 | else { 25 | if (type == 'AnnotationAssertion') { 26 | md = xargs[1] + " *" + xargs[0] +"* " + xargs[2]; 27 | } 28 | else if (type == 'ObjectSomeValuesFrom') { 29 | md = xargs[0] + " **some** " + xargs[1]; 30 | } 31 | else { 32 | md = type + "( " + xargs.join(" ")+" ) "; 33 | } 34 | } 35 | if (obj.annotations != null) { 36 | md += ' { ' + obj.annotations.map( function(a) { return cx.render(a.property, owl, opts)+"="+cx.render(a.value, owl, opts) }).join(" , ") + ' } '; 37 | } 38 | return md; 39 | } 40 | else { 41 | var label = owl.getLabel(obj); 42 | if (label == null) { 43 | // TODO - href is URI 44 | var hpos = obj.indexOf("#"); 45 | if (hpos > -1) { 46 | label = obj.slice(hpos + 1); 47 | } 48 | } 49 | 50 | if (label == null) { 51 | if (obj.indexOf("http") == 0) { 52 | return "["+obj+"](" + obj + ")"; 53 | } 54 | else { 55 | return obj; 56 | } 57 | } 58 | else { 59 | label = label.replace(/_/g,' '); 60 | if (opts != null && opts.isLabelOnly) { 61 | return label; 62 | } 63 | return "[" + label+"]("+obj+")"; 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /lib/io/table.js: -------------------------------------------------------------------------------- 1 | var obovocab = require("owljs/vocab/obo"); 2 | 3 | exports simpleOboTable = function(owl, obj) { 4 | 5 | 6 | } 7 | -------------------------------------------------------------------------------- /lib/javautil.js: -------------------------------------------------------------------------------- 1 | /* Namespace: javautil 2 | * 3 | * handy functions for interacting with java 4 | * 5 | */ 6 | 7 | export('collectionToJsArray', 8 | 'javaArrayToJsArray', 9 | 'jsArrayToSet', 10 | 'toJava'); 11 | 12 | /* Function: collectionToJsArray 13 | * Arguments: 14 | * - col : a java Collection 15 | * 16 | * Returns: 17 | * a javascript list 18 | */ 19 | function collectionToJsArray(col) { 20 | return javaArrayToJsArray(col.toArray()); 21 | } 22 | 23 | 24 | /* Function: javaArrayToJsArray 25 | * Arguments: 26 | * - a : a java Array 27 | * 28 | * Returns: 29 | * a javascript list 30 | */ 31 | function javaArrayToJsArray(a) { 32 | var l = []; 33 | for (var k=0; k 19 | */ 20 | var synonym = exports.synonym = function(owl) { 21 | return owl.annotationProperty(this.getUrlPrefix() + "Backend/OBO_annotation_properties.owl#synonym"); 22 | }; 23 | 24 | var cell_ontology_ID = exports.cell_ontology_ID = function(owl) { 25 | return owl.annotationProperty(this.getUrlPrefix() + "Backend/BIRNLex_annotation_properties.owl#cell_ontology_ID"); 26 | }; 27 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "owljs", 3 | "version": "0.0.1", 4 | "description": "A toolkit for using OWL ontologies via the java OWLAPI", 5 | "homepage": "http://github.com/cmungall/owl.js", 6 | "keywords": [ 7 | "commonjs", 8 | "owl", 9 | "semantic web", 10 | "ringo", 11 | "bio-ontology" 12 | ], 13 | "author": "Chris Mungall ", 14 | "contributors": [ 15 | ], 16 | "repositories": [ 17 | { 18 | "type": "git", 19 | "url": "git://github.com/cmungall/owl.js.git" 20 | } 21 | ], 22 | "licenses": [ 23 | { 24 | "type": "MIT", 25 | "url": "https://github.com/ringo/stick/blob/master/LICENSE" 26 | } 27 | ], 28 | "bugs": "http://github.com/cmungall/owl.js/issues", 29 | "engines": { 30 | "ringojs": ">= 0.9" 31 | }, 32 | "directories": { 33 | "lib": "lib" 34 | }, 35 | "bin": { 36 | "owljs" : "bin/owljs", 37 | "owljs-repl.js" : "bin/owljs-repl.js" 38 | }, 39 | "main": "lib/owl.js" 40 | } 41 | -------------------------------------------------------------------------------- /server.js: -------------------------------------------------------------------------------- 1 | // We include server.js in the top level to simplify deployment on heroku 2 | 3 | var system = require('system'); 4 | addToClasspath('./jars/owltools-runner-all.jar'); 5 | var OWL = require('./lib/owl.js').OWL; 6 | 7 | var stick = require('stick'); 8 | var fs = require('fs'); 9 | var response = require('ringo/jsgi/response'); 10 | var httpclient = require('ringo/httpclient'); 11 | 12 | var owl = new OWL(); 13 | 14 | var session = { 15 | foo: 1, 16 | owl: owl 17 | } 18 | 19 | owl.loadFile("test/caro.owl"); 20 | 21 | var app = exports.app = new stick.Application(); 22 | 23 | app.configure('route'); 24 | app.configure('params'); 25 | app.configure('static'); 26 | 27 | var owlservices = require('./lib/owljs/owlservices.js'); 28 | var addons = require('./lib/owljs/addons.js'); 29 | 30 | print("owl is :"+session.owl); 31 | var myOwlservices = new owlservices.OWLServices(app,session); 32 | new addons.AddOns(app,session); 33 | //myOwlservices.install(); 34 | 35 | function main(args) { 36 | print("args="+args); 37 | if (false) { 38 | while(args.length > 0) { 39 | var arg = args.shift(); 40 | if (arg == "--") { 41 | break; 42 | } 43 | print("Arg="+arg); 44 | } 45 | } 46 | require('ringo/httpserver').main(module.id); 47 | } 48 | 49 | // INITIALIZATION 50 | // Can set port from command line. E.g. --port 8080 51 | if (require.main == module) { 52 | main(system.args); 53 | } 54 | -------------------------------------------------------------------------------- /tests/alltests.js: -------------------------------------------------------------------------------- 1 | var tests = 2 | [ 3 | "owl/owl_test", 4 | 5 | "dlmatch/dlmatch_test", 6 | 7 | "obol/obol_test", 8 | 9 | "repl/author_test", 10 | "repl/instancequery_test", 11 | 12 | "vocab/obo_test" 13 | ]; 14 | 15 | var failed = []; 16 | 17 | if (require.main == module) { 18 | var probs = 0; 19 | 20 | tests.forEach( function(n) { 21 | var code = require("test").run("./tests/"+n); 22 | if (code != 0) { 23 | probs++; 24 | failed.push(n); 25 | } 26 | //probs += code; 27 | }); 28 | 29 | 30 | print("Problems: "+probs); 31 | if (probs > 0) { 32 | print("Failed: "+failed); 33 | } 34 | require("system").exit(probs); 35 | 36 | } 37 | -------------------------------------------------------------------------------- /tests/data/catalog-v001.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /tests/data/ceph-import.owl: -------------------------------------------------------------------------------- 1 | Prefix: owl: 2 | Prefix: rdf: 3 | Prefix: xml: 4 | Prefix: xsd: 5 | Prefix: rdfs: 6 | 7 | 8 | 9 | Ontology: 10 | Import: 11 | -------------------------------------------------------------------------------- /tests/data/linkytest.owl: -------------------------------------------------------------------------------- 1 | Ontology: 2 | Prefix: obo: 3 | 4 | Class: obo:X_1 5 | 6 | Class: obo:X_11 7 | SubClassOf: obo:X_1 8 | 9 | Class: obo:X_12 10 | SubClassOf: obo:X_1 11 | 12 | Class: obo:X_111 13 | SubClassOf: obo:X_11 14 | 15 | Class: obo:X_112 16 | SubClassOf: obo:X_11 17 | 18 | Class: obo:X_113 19 | SubClassOf: obo:X_11 20 | 21 | Class: obo:X_121 22 | SubClassOf: obo:X_12 23 | 24 | Class: obo:X_122 25 | SubClassOf: obo:X_12 26 | 27 | Class: obo:X_123 28 | SubClassOf: obo:X_12 29 | 30 | Class: obo:X_1111 31 | SubClassOf: obo:X_111 32 | 33 | Class: obo:X_1231 34 | SubClassOf: obo:X_123 35 | 36 | 37 | 38 | Class: obo:Y_1 39 | 40 | Class: obo:Y_11 41 | SubClassOf: obo:Y_1 42 | EquivalentTo: obo:X_1231 43 | 44 | Class: obo:Y_12 45 | SubClassOf: obo:Y_1 46 | 47 | Class: obo:Y_111 48 | SubClassOf: obo:Y_11 49 | 50 | Class: obo:Y_112 51 | SubClassOf: obo:Y_11 52 | 53 | Class: obo:Y_113 54 | SubClassOf: obo:Y_11 55 | 56 | Class: obo:Y_121 57 | SubClassOf: obo:Y_12 58 | 59 | Class: obo:Y_122 60 | SubClassOf: obo:Y_12 61 | EquivalentTo: obo:X_12 62 | 63 | Class: obo:Y_123 64 | SubClassOf: obo:Y_12 65 | EquivalentTo: obo:X_12 66 | 67 | Class: obo:Y_1111 68 | SubClassOf: obo:Y_111 69 | EquivalentTo: obo:X_1111 70 | 71 | Class: obo:Y_1231 72 | SubClassOf: obo:Y_123 73 | EquivalentTo: obo:X_1231 74 | -------------------------------------------------------------------------------- /tests/differ/differ_test.js: -------------------------------------------------------------------------------- 1 | var {OWL} = require("owljs"); 2 | var {Differ} = require("owljs/differ"); 3 | var assert = require("assert"); 4 | 5 | var differ; 6 | var owl; 7 | 8 | importPackage(Packages.org.semanticweb.owlapi.model); 9 | 10 | function init() { 11 | if (owl == null) { 12 | owl = new OWL(); 13 | //repl.owlinit(owl); 14 | owl.loadOntology("tests/data/ceph.owl"); 15 | } 16 | } 17 | 18 | exports.testDiffs = function() { 19 | init(); 20 | var ov = require("owljs/vocab/obo"); 21 | var repl = require("owljs/repl"); 22 | var owlB = new OWL(); 23 | repl.owlinit(owlB); 24 | owlB.loadOntology("tests/data/ceph.owl"); 25 | 26 | // simulate creating a class in new ontology 27 | var c = repl.mkClass( "test" ); 28 | var tentacle = owl.find("tentacle"); 29 | var beak = owl.find("beak"); 30 | owlB.add( owl.declaration(c) ); 31 | owlB.add( ov.definitionAssertion(owl, c, "this is a test", ["FOO:BAR"]) ); 32 | var axs = owlB.getAllAxioms(c); 33 | assert.equal( axs.length, 2); 34 | 35 | // adding an axiom to existing class in new 36 | owlB.add( owl.subClassOf(tentacle, c) ); 37 | 38 | // simulate removing axioms from original ontology by 39 | // adding them in prior to diff; in this case 40 | // we assume the ontology originally had a nonsense 41 | // axiom, 42 | owl.add( owl.subClassOf(beak, tentacle) ); 43 | 44 | //var ncA = owl.getClasses(); 45 | //var ncB = owlB.getClasses(); 46 | //assert.equal(ncA.length, ncB.length-1); 47 | 48 | //var tA = owl.find("tentacle"); 49 | //var tB = owlB.find("tentacle"); 50 | //assert.isTrue(tA.equals(tB)); 51 | //assert.isTrue(tA == tB); 52 | 53 | differ = new Differ(); 54 | var md = differ.getDiffsAsMarkdown(owl, owlB, false, false); 55 | print(md); 56 | 57 | }; 58 | 59 | if (require.main == module) { 60 | require("test").run(exports); 61 | } 62 | -------------------------------------------------------------------------------- /tests/dlmatch/dlmatch_nested_test.js: -------------------------------------------------------------------------------- 1 | var {OWL} = require("owljs"); 2 | var {DLMatch} = require("owljs/dlmatch"); 3 | var assert = require("assert"); 4 | var repl = require("owljs/repl"); 5 | 6 | var matcher; 7 | var owl; 8 | 9 | importPackage(Packages.org.semanticweb.owlapi.model); 10 | 11 | function init() { 12 | if (owl == null) { 13 | owl = new OWL(); 14 | repl.owlinit(owl); 15 | owl.loadOntology("tests/data/ceph.owl"); 16 | matcher = new DLMatch(owl); 17 | } 18 | } 19 | 20 | exports.testNested = function() { 21 | init(); 22 | 23 | var o = repl.o; 24 | repl.owlinit(owl); 25 | var nc = repl.mkClass("cell of tentacle of beak"); 26 | // tentacle of beak 27 | var tob = owl.intersectionOf(o.tentacle, 28 | owl.someValuesFrom(o.part_of, 29 | owl.intersectionOf(o.beak, 30 | owl.someValuesFrom(o.part_of, 31 | o.head)))); 32 | // cell of TOB 33 | var tobcell = owl.intersectionOf(o.cell, 34 | owl.someValuesFrom(o.part_of, 35 | tob)); 36 | owl.add( owl.equivalentClasses(nc, tobcell) ); 37 | 38 | // test for matches of the form: nc == ?genus and ?svf 39 | find( 40 | matcher.equivalentClassesMatch( 41 | nc, 42 | matcher.intersectionOfMatch("?genus", 43 | "?svf") 44 | ), 45 | 1, 46 | { 47 | genus: "cell" // expect nc == cell and ... 48 | }); 49 | 50 | // ?nc = ?c and part_of some ?t and ?rel some ?z 51 | find( 52 | matcher.equivalentClassesMatch( 53 | "?nc", 54 | matcher.intersectionOfMatch("?c", 55 | matcher.someValuesFromMatch(o.part_of, 56 | matcher.intersectionOfMatch("?t", 57 | matcher.someValuesFromMatch("?rel","?z")))) 58 | ), 59 | 1, 60 | // expect tobcell == c and part_of some tentacle and ? some ? 61 | { 62 | nc: "cell of tentacle of beak", 63 | c: "cell", 64 | t: "tentacle", 65 | }); 66 | 67 | }; 68 | 69 | 70 | // Arguments: 71 | // - q : queryTemplate 72 | // - numExpected: if present, number of results must match this 73 | // - mustContain: if present, the result set must contain at least one binding object to match this 74 | function find(q, numExpected, mustContain) { 75 | //print("QUERY:"); 76 | repl.pp(q); 77 | var matches = matcher.find(q); 78 | print("#match = "+matches.length); 79 | if (numExpected != null) { 80 | assert.equal(matches.length, numExpected) 81 | } 82 | matches.forEach(repl.pp); 83 | if (mustContain != null) { 84 | for (var j in mustContain) { 85 | var v = mustContain[j]; 86 | if (!(v instanceof OWLObject)) { 87 | mustContain[j] = owl.find(v); 88 | console.log("Mapped "+v+" ==> "+mustContain[j]); 89 | } 90 | if (mustContain[j] == null) { 91 | console.error("No such entity: "+v); 92 | assert.isTrue(false); 93 | } 94 | } 95 | var ok = false; 96 | for (var k in matches) { 97 | var m = matches[k]; 98 | var ok2 = true; 99 | for (var j in mustContain) { 100 | if (m[j] != mustContain[j]) { 101 | ok2 = false; 102 | break; 103 | } 104 | } 105 | if (ok2) { 106 | ok = true; 107 | break; 108 | } 109 | } 110 | assert.isTrue(ok); 111 | } 112 | } 113 | 114 | 115 | if (require.main == module) { 116 | require("test").run(exports); 117 | } 118 | -------------------------------------------------------------------------------- /tests/learner/catalog-v001.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /tests/learner/mp_test.js: -------------------------------------------------------------------------------- 1 | var {OWL} = require("owljs"); 2 | var {Learner} = require("owljs/learner"); 3 | var assert = require("assert"); 4 | var repl = require("owljs/repl"); 5 | 6 | var learner; 7 | var owl; 8 | 9 | importPackage(Packages.org.semanticweb.owlapi.model); 10 | 11 | function init() { 12 | if (owl == null) { 13 | owl = new OWL(); 14 | repl.owlinit(owl); 15 | var owlFile = "tests/learner/mptest.ofn"; 16 | owl.loadOntology(owlFile); 17 | learner = new Learner(owl); 18 | learner.owlFile = "mptest.ofn"; 19 | } 20 | } 21 | 22 | exports.testLCS = function() { 23 | init(); 24 | var c = owl.find("weakness"); 25 | var d = owl.find("abnormal striatum morphology"); 26 | print("C="+c); 27 | print("D="+d); 28 | learner.prepLCS(c,d); 29 | print(learner.renderConfig()); 30 | 31 | learner.dir = "tests/learner"; 32 | var out = learner.learn(); 33 | print(out); 34 | }; 35 | 36 | 37 | 38 | if (require.main == module) { 39 | require("test").run(exports); 40 | } 41 | -------------------------------------------------------------------------------- /tests/linky/linky_test.js: -------------------------------------------------------------------------------- 1 | var {OWL} = require("owljs"); 2 | var {Linky} = require("owljs/linky"); 3 | var assert = require("assert"); 4 | 5 | var linky; 6 | var owl; 7 | 8 | importPackage(Packages.org.semanticweb.owlapi.model); 9 | 10 | function init() { 11 | if (owl == null) { 12 | owl = new OWL(); 13 | //repl.owlinit(owl); 14 | owl.loadOntology("tests/data/linkytest.owl"); 15 | } 16 | linky = new Linky(owl); 17 | } 18 | 19 | exports.testCollapse = function() { 20 | init(); 21 | 22 | //print("X="+linky.getSource); 23 | linky.decluster(); 24 | }; 25 | 26 | if (require.main == module) { 27 | require("test").run(exports); 28 | } 29 | -------------------------------------------------------------------------------- /tests/obol/obol_test.js: -------------------------------------------------------------------------------- 1 | var {OWL} = require("owljs"); 2 | var {Obol} = require("owljs/obol"); 3 | var repl = require("owljs/repl"); 4 | var assert = require("assert"); 5 | 6 | var owl; 7 | var obol 8 | 9 | importPackage(Packages.org.semanticweb.owlapi.model); 10 | 11 | function init() { 12 | if (owl == null) { 13 | owl = new OWL(); 14 | //repl.owlinit(owl); 15 | owl.loadOntology("tests/data/clmin.ofn"); 16 | } 17 | } 18 | 19 | exports.testOps = function() { 20 | init(); 21 | repl.owlinit(owl); 22 | var o = repl.o; 23 | obol = new Obol(owl, repl.o); 24 | owl.config.isCompareClasses = true; 25 | require("owljs/obol/anatomy"); 26 | var str = "cell of brain"; 27 | var results = obol.parse(str, null); 28 | repl.pp(results); 29 | assert.equal(results.length, 1); 30 | //var x = results[0]; 31 | 32 | var c = o.epithelial_cell_of_nephron; 33 | var results = obol.parseClass(c); 34 | repl.pp(results); 35 | assert.equal(results.length, 1); 36 | 37 | //obol.setIgnoreDefinedClasses(true); 38 | results = obol.parseSubClasses(o.epithelial_cell, null); 39 | repl.pp(results); 40 | assert.equal(results.length, 127); 41 | 42 | }; 43 | 44 | 45 | 46 | if (require.main == module) { 47 | require("test").run(exports); 48 | } 49 | -------------------------------------------------------------------------------- /tests/obol_test_mp.obo: -------------------------------------------------------------------------------- 1 | 2 | [Term] 3 | id: PATO:0000051 4 | name: morphology 5 | 6 | [Term] 7 | id: PHENO:1234567 8 | name: abnormal epithelium morphology 9 | is_a: PHENO:0000001 10 | 11 | 12 | [Term] 13 | id: PHENO:0000001 14 | name: phenotype 15 | -------------------------------------------------------------------------------- /tests/owl/addimport_test.js: -------------------------------------------------------------------------------- 1 | var {OWL} = require("owljs"); 2 | var assert = require("assert"); 3 | 4 | var owl; 5 | 6 | importPackage(Packages.org.semanticweb.owlapi.model); 7 | importPackage(Packages.org.semanticweb.owlapi.io); 8 | importPackage(Packages.org.semanticweb.owlapi.util); 9 | importPackage(Packages.org.coode.owlapi.manchesterowlsyntax); 10 | importPackage(Packages.org.coode.owlapi.obo.parser); 11 | importPackage(org.semanticweb.owlapi.apibinding); 12 | importPackage(org.semanticweb.elk.owlapi); 13 | 14 | 15 | 16 | exports.testAdd = function() { 17 | owl = new OWL(); 18 | owl.loadOntology("tests/data/ceph.owl"); 19 | var src = owl.getOntology(); 20 | owl.createOntology("http://x.org", [src] ); 21 | assert.equal(owl.getOntology().getImportsClosure().size(), 2); 22 | }; 23 | 24 | exports.testAddToExisting = function() { 25 | owl = new OWL(); 26 | owl.createOntology("http://x.org"); 27 | owl.loadOntology("tests/data/ceph.owl", {addToImport:true}); 28 | assert.equal(owl.getOntology().getImportsClosure().size(), 2); 29 | }; 30 | 31 | 32 | if (require.main == module) { 33 | require("test").run(exports); 34 | } 35 | -------------------------------------------------------------------------------- /tests/owl/anc_test.js: -------------------------------------------------------------------------------- 1 | var {OWL} = require("owljs"); 2 | var assert = require("assert"); 3 | 4 | var matcher; 5 | var owl; 6 | 7 | importPackage(Packages.org.semanticweb.owlapi.model); 8 | 9 | function init() { 10 | owl = new OWL(); 11 | //repl.owlinit(owl); 12 | owl.loadOntology("tests/data/ceph.owl"); 13 | } 14 | 15 | function render(c) { 16 | return c + '"' + owl.getLabel(c) + '"'; 17 | } 18 | 19 | 20 | exports.testIndirect = function() { 21 | init(); 22 | var organ = owl.find("organ"); 23 | var part_of = owl.find("part of"); 24 | var tentacle = owl.find("tentacle"); 25 | var cartilage = owl.find("cartilage"); 26 | var mco = owl.find("multi-cellular organism"); 27 | 28 | var tps = 29 | owl.getInferredSubClasses( owl.someValuesFrom(part_of, tentacle) ); 30 | assert.equal(tps.length, 13); 31 | 32 | var nFails = 0; 33 | for (var i in tps) { 34 | console.log(render(tp)); 35 | var tp = tps[i]; 36 | ancs = owl.getAncestorsOver(tp, part_of, false, true); 37 | ancs.forEach(function(c) { 38 | //console.log(" A="+render(c)); 39 | }); 40 | if (ancs.indexOf(tentacle) == -1) { 41 | nFails++; 42 | console.warn("NO TENTACLE FOR "+tp); 43 | } 44 | if (ancs.indexOf(mco) == -1) { 45 | console.warn("NO "+mco+" FOR "+tp); 46 | nFails++; 47 | } 48 | } 49 | assert.equal(nFails, 0); 50 | }; 51 | 52 | 53 | exports.testDidirect = function() { 54 | init(); 55 | var organ = owl.find("organ"); 56 | var part_of = owl.find("part of"); 57 | var tentacle = owl.find("tentacle"); 58 | var cartilage = owl.find("cartilage"); 59 | var mco = owl.find("multi-cellular organism"); 60 | 61 | var tps = 62 | owl.getInferredSubClasses( owl.someValuesFrom(part_of, tentacle), true ); 63 | assert.equal(tps.length, 13); 64 | 65 | var nFails = 0; 66 | var n2 = 0; 67 | for (var i in tps) { 68 | console.log(render(tp)); 69 | var tp = tps[i]; 70 | ancs = owl.getAncestorsOver(tp, part_of, true, false); 71 | console.log("|Ancs|="+ancs.length); 72 | ancs.forEach(function(c) { 73 | console.log(" A="+render(c)); 74 | }); 75 | if (ancs.indexOf(tentacle) == -1) { 76 | n2++; 77 | console.warn("NO TENTACLE FOR "+tp); 78 | } 79 | if (ancs.indexOf(mco) > -1) { 80 | console.warn("UNEXPECTED "+mco+" FOR "+tp); 81 | nFails++; 82 | } 83 | } 84 | assert.equal(nFails, 0); 85 | assert.equal(n2, 8); 86 | }; 87 | 88 | 89 | 90 | 91 | if (require.main == module) { 92 | require("test").run(exports); 93 | } 94 | -------------------------------------------------------------------------------- /tests/owl/import_test.js: -------------------------------------------------------------------------------- 1 | var {OWL} = require("owljs"); 2 | var assert = require("assert"); 3 | 4 | var owl; 5 | 6 | importPackage(Packages.org.semanticweb.owlapi.model); 7 | 8 | function init() { 9 | if (owl == null) { 10 | owl = new OWL(); 11 | owl.addCatalog("tests/data/catalog-v001.xml"); 12 | //repl.owlinit(owl); 13 | owl.loadOntology("tests/data/ceph-import.owl"); 14 | } 15 | } 16 | 17 | exports.testOps = function() { 18 | init(); 19 | var objs = owl.grepObjects( 20 | function(x,owl) { 21 | return /tentacle/.test(owl.getLabel(x)); 22 | } 23 | ); 24 | console.log("#objs = "+objs.length); 25 | print(objs); 26 | assert.equal(6, objs.length); 27 | 28 | 29 | var axs = owl.grepAxioms( 30 | function(x,owl) { 31 | return !x.isLogicalAxiom() 32 | } 33 | ); 34 | console.log("#annotation ax = "+axs.length); 35 | assert.equal(axs.length, 7370); 36 | 37 | var ap = owl.find("has_exact_synonym"); 38 | console.log("AP: "+ap); 39 | assert.isTrue(ap != null); 40 | }; 41 | 42 | 43 | exports.testReasoning = function() { 44 | init(); 45 | var organ = owl.find("organ"); 46 | var part_of = owl.find("part of"); 47 | var tentacle = owl.find("tentacle"); 48 | var cartilage = owl.find("cartilage"); 49 | 50 | var supsDirect = 51 | owl.getInferredSuperClasses( tentacle, true ); 52 | assert.equal(supsDirect.length, 1); 53 | 54 | var supsDirectReflexive = 55 | owl.getInferredSuperClasses( tentacle, true, true ); 56 | assert.equal(supsDirectReflexive.length, 2); 57 | 58 | var sups = 59 | owl.getInferredSuperClasses( tentacle, false ); 60 | assert.equal(sups.length, 7); 61 | 62 | var tps = 63 | owl.getInferredSubClasses( owl.someValuesFrom(part_of, tentacle) ); 64 | assert.equal(tps.length, 13); 65 | 66 | var xs = 67 | owl.getInferredSubClasses( 68 | owl.intersectionOf( organ, 69 | owl.someValuesFrom(part_of, cartilage) ) 70 | ); 71 | assert.equal(xs.length, 2); 72 | }; 73 | 74 | 75 | 76 | if (require.main == module) { 77 | require("test").run(exports); 78 | } 79 | -------------------------------------------------------------------------------- /tests/owl/owl_test.js: -------------------------------------------------------------------------------- 1 | var {OWL} = require("owljs"); 2 | var assert = require("assert"); 3 | 4 | var matcher; 5 | var owl; 6 | 7 | importPackage(Packages.org.semanticweb.owlapi.model); 8 | 9 | function init() { 10 | if (owl == null) { 11 | owl = new OWL(); 12 | //repl.owlinit(owl); 13 | owl.loadOntology("tests/data/ceph.owl"); 14 | } 15 | } 16 | 17 | exports.testOps = function() { 18 | init(); 19 | var objs = owl.grepObjects( 20 | function(x,owl) { 21 | return /tentacle/.test(owl.getLabel(x)); 22 | } 23 | ); 24 | console.log("#objs = "+objs.length); 25 | print(objs); 26 | assert.equal(6, objs.length); 27 | 28 | 29 | var axs = owl.grepAxioms( 30 | function(x,owl) { 31 | return !x.isLogicalAxiom() 32 | } 33 | ); 34 | console.log("#annotation ax = "+axs.length); 35 | assert.equal(axs.length, 7370); 36 | 37 | var ap = owl.find("has_exact_synonym"); 38 | console.log("AP: "+ap); 39 | assert.isTrue(ap != null); 40 | }; 41 | 42 | 43 | exports.testReasoning = function() { 44 | init(); 45 | var organ = owl.find("organ"); 46 | var part_of = owl.find("part of"); 47 | var tentacle = owl.find("tentacle"); 48 | var cartilage = owl.find("cartilage"); 49 | 50 | var supsDirect = 51 | owl.getInferredSuperClasses( tentacle, true ); 52 | assert.equal(supsDirect.length, 1); 53 | 54 | var supsDirectReflexive = 55 | owl.getInferredSuperClasses( tentacle, true, true ); 56 | assert.equal(supsDirectReflexive.length, 2); 57 | 58 | var sups = 59 | owl.getInferredSuperClasses( tentacle, false ); 60 | assert.equal(sups.length, 7); 61 | 62 | var tps = 63 | owl.getInferredSubClasses( owl.someValuesFrom(part_of, tentacle) ); 64 | assert.equal(tps.length, 13); 65 | 66 | var xs = 67 | owl.getInferredSubClasses( 68 | owl.intersectionOf( organ, 69 | owl.someValuesFrom(part_of, cartilage) ) 70 | ); 71 | assert.equal(xs.length, 2); 72 | }; 73 | 74 | 75 | 76 | if (require.main == module) { 77 | require("test").run(exports); 78 | } 79 | -------------------------------------------------------------------------------- /tests/owl/owljson_test.js: -------------------------------------------------------------------------------- 1 | var {OWL} = require("owljs"); 2 | var assert = require("assert"); 3 | 4 | importPackage(java.io); 5 | importPackage(Packages.org.semanticweb.owlapi.model); 6 | importPackage(Packages.org.semanticweb.owlapi.io); 7 | 8 | exports.testJSON = function() { 9 | var owl = new OWL(); 10 | owl.loadOntology("tests/data/ceph.owl"); 11 | 12 | var json = owl.ontologyToAxiomaticJSON(); 13 | print(JSON.stringify(json, null, ' ')); 14 | }; 15 | 16 | if (require.main == module) { 17 | require("test").run(exports); 18 | } 19 | -------------------------------------------------------------------------------- /tests/owlfun_test.js: -------------------------------------------------------------------------------- 1 | var fun = include("../lib/repl"); 2 | var assert = require("assert"); 3 | 4 | 5 | exports.testLoad = function() { 6 | 7 | var owl = loadowl("test/caro.owl"); 8 | 9 | owl.log(ont()); 10 | 11 | owl.config.defaultFormat = new org.semanticweb.owlapi.io.OWLFunctionalSyntaxOntologyFormat(); // todo - introspect this 12 | owl.config.lastId = 1000; 13 | owl.config.idspace = 'CL'; 14 | 15 | // basic operations 16 | var c1 = owl.find("epithelium"); 17 | var c2 = owl.find("anatomical structure"); 18 | var ax = subClassOf(c1,c2); 19 | add(ax); 20 | expandMacros(); 21 | 22 | 23 | console.log(ax); 24 | 25 | setClassVars(); 26 | console.log("EP="+o.epithelium); 27 | console.log("PO="+o.part_of); 28 | console.log("ORG="+o.compound_organ); 29 | ax = subClassOf(o.epithelium, o.anatomical_structure); 30 | 31 | var fr = owl.generateXP(o.epithelium,o.part_of,o.compound_organ); 32 | //console.log(fr.render()); 33 | console.log(fr.toAxioms()); 34 | owl.add(fr.toAxioms()); 35 | 36 | owl.save('test/foo.owl'); 37 | 38 | console.log(omn("'epithelium' and part_of some 'anatomical structure'")); 39 | console.log(omn("CARO_0000066 and part_of some 'anatomical structure'")); 40 | console.log(omn(" and part_of some 'anatomical structure'")); 41 | console.log(omn(o.epithelium + And + o.part_of + Some + o.anatomical_structure)); 42 | 43 | x("-a epithelium"); 44 | 45 | cdef({ 46 | label : "unilaminar cell", 47 | subClassOf: intersectionOf(o.cell, someValuesFrom(o.part_of, o.unilaminar_epithelium)) 48 | }); 49 | var obj = getObj(); 50 | console.log(obj); 51 | print(obj); 52 | log("Rendering..."); 53 | pp(obj); 54 | obj.stamp(); 55 | obj.toAxioms().forEach(pp); 56 | 57 | }; 58 | 59 | if (require.main == module) { 60 | require("test").run(exports); 61 | } 62 | -------------------------------------------------------------------------------- /tests/repl/author_test.js: -------------------------------------------------------------------------------- 1 | include("owljs/repl"); 2 | var {OWL} = require("owljs"); 3 | var {DLMatch} = require("owljs/dlmatch"); 4 | var assert = require("assert"); 5 | var fs = require('fs'); 6 | 7 | var matcher; 8 | var owl; 9 | 10 | importPackage(Packages.org.semanticweb.owlapi.model); 11 | 12 | exports.testMakeOntology = function() { 13 | owl = new OWL(); 14 | owlinit(owl); 15 | //eval(fs.read("test/repl/mkont.js")); 16 | load("tests/repl/mkont.js"); 17 | }; 18 | 19 | 20 | if (require.main == module) { 21 | require("test").run(exports); 22 | } 23 | -------------------------------------------------------------------------------- /tests/repl/catalog-v001.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /tests/repl/instancequery_test.js: -------------------------------------------------------------------------------- 1 | include("owljs/repl"); 2 | var {OWL} = require("owljs"); 3 | var assert = require("assert"); 4 | var fs = require('fs'); 5 | 6 | var matcher; 7 | var owl; 8 | 9 | importPackage(Packages.org.semanticweb.owlapi.model); 10 | 11 | exports.testMakeOntology = function() { 12 | owl = new OWL(); 13 | owlinit(owl); 14 | load("tests/repl/instont.js"); 15 | }; 16 | 17 | 18 | if (require.main == module) { 19 | require("test").run(exports); 20 | } 21 | -------------------------------------------------------------------------------- /tests/repl/instont.js: -------------------------------------------------------------------------------- 1 | var assert = require("assert") 2 | createOntology() 3 | addMode(true) 4 | mkObjectProperty("part of", { transitive: true }) 5 | mkClass("kinase") 6 | mkClass("pathway") 7 | mkClass("cascade") 8 | addMembers(o.kinase, ["i1", "i2", "i3"]) 9 | addMembers(o.cascade, ["c1"]) 10 | addMembers(o.pathway, ["p1"]) 11 | propertyAssertion(o.part_of, o.i1, o.c1) 12 | propertyAssertion(o.part_of, o.c1, o.p1) 13 | owl.setReasonerType("hermit") 14 | x = someValuesFrom(o.part_of, o.pathway) 15 | inds = owl.getInferredInstances(x, false); 16 | print("#inds = "+inds.length); 17 | inds.forEach(pp) 18 | 19 | // TODO - check why this works individually but not in "make test" 20 | //assert.equal(inds.length, 2) 21 | assert.isTrue(inds.length > 0) 22 | 23 | x = hasValue(o.part_of, o.p1) 24 | inds = owl.getInferredInstances(x, false); 25 | print("#inds (hasValue) = "+inds.length); 26 | inds.forEach(pp) 27 | //assert.equal(inds.length, 2) 28 | assert.isTrue(inds.length > 0) 29 | 30 | save("foo.owl") 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /tests/repl/mkont.js: -------------------------------------------------------------------------------- 1 | addMode(true) 2 | createOntology("test") 3 | 4 | // create upper ontology 5 | mkDisjointUnion( 6 | { 7 | entity : 8 | { 9 | "continuant" : 10 | { 11 | "independent continaunt" : 12 | ["material entity", "immaterial entity"], 13 | "dependent continuant" : 14 | {"quality" : [], 15 | "realizable" : [ 16 | "role", 17 | "function", 18 | "disposition" 19 | ]} 20 | }, 21 | "occurrent" : 22 | ["process", "history"] 23 | } 24 | }) 25 | 26 | // annotation vocabulary 27 | mkAnnotationProperty("source") 28 | srcAnn = ann(o.source, "my test") 29 | 30 | // make an annotated axiom 31 | mkClass("cell") 32 | subClassOf(o.cell, o.material_entity, [srcAnn]) 33 | 34 | // cell types 35 | // use a different style of DU 36 | mkDisjointUnionSimple( 37 | o.cell, 38 | ["neuron", "hepatocyte", "muscle cell", "epithelial cell"] 39 | ) 40 | // for reasoners like Elk, we want to supplement the DU 41 | // axioms with weaker subclass and disjointFrom axioms 42 | expandDisjointUnions() 43 | 44 | // instances, example 1: add two hepatocyte instances: 45 | addMembers(o.hepatocyte, ["hepatocyte1", "hepatocyte2"]); 46 | 47 | // example 2: add 10 neuron instances 48 | for (var i=1; i<=10; i++) { 49 | classAssertion(o.neuron, mkIndividual("n"+i)); 50 | } 51 | 52 | // save the ontology 53 | save("target/repl/foo.owl") 54 | 55 | -------------------------------------------------------------------------------- /tests/vocab/obo_test.js: -------------------------------------------------------------------------------- 1 | var {OWL} = require("owljs"); 2 | var obovocab = require("owljs/vocab/obo"); 3 | var assert = require("assert"); 4 | 5 | var owl; 6 | 7 | exports.testOps = function() { 8 | owl = new OWL(); 9 | 10 | owl.createOntology(obovocab.OBO + "test.owl"); 11 | var c = owl.class(obovocab.OBO + "TEST_1"); 12 | var d = owl.class(obovocab.OBO + "TEST_2"); 13 | owl.add(owl.subClassOf(c, owl.someValuesFrom(obovocab.part_of(owl), d))); 14 | owl.add(owl.labelAssertion(c, "test1")); 15 | owl.add(obovocab.definitionAssertion(owl, c, "a test class.", ["PMID:1234567"])); 16 | obovocab.addSynonym(owl, c, null, "syn1"); 17 | obovocab.addSynonym(owl, c, obovocab.hasBroadSynonym, "syn2"); 18 | owl.save("target/vocab/syntest.owl"); 19 | 20 | var svs = obovocab.getSynonymAnnotationValues(owl, c); 21 | print(svs); 22 | assert.equal(svs.length, 2); 23 | assert.isTrue(svs.indexOf("syn1") > -1); 24 | assert.isTrue(svs.indexOf("syn2") > -1); 25 | var svm = obovocab.getSynonymAnnotationMap(owl, c); 26 | print(JSON.stringify(svm)); 27 | assert.equal(svm.hasRelatedSynonym.length, 1); 28 | assert.equal(svm.hasBroadSynonym.length, 1); 29 | }; 30 | 31 | 32 | 33 | if (require.main == module) { 34 | require("test").run(exports); 35 | } 36 | --------------------------------------------------------------------------------