You can subscribe to this list here.
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(120) |
Sep
(36) |
Oct
(116) |
Nov
(17) |
Dec
(44) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(143) |
Feb
(192) |
Mar
(74) |
Apr
(84) |
May
(105) |
Jun
(64) |
Jul
(49) |
Aug
(120) |
Sep
(159) |
Oct
(156) |
Nov
(51) |
Dec
(28) |
2009 |
Jan
(17) |
Feb
(55) |
Mar
(33) |
Apr
(57) |
May
(54) |
Jun
(28) |
Jul
(6) |
Aug
(16) |
Sep
(38) |
Oct
(30) |
Nov
(26) |
Dec
(52) |
2010 |
Jan
(7) |
Feb
(91) |
Mar
(65) |
Apr
(2) |
May
(14) |
Jun
(25) |
Jul
(38) |
Aug
(48) |
Sep
(80) |
Oct
(70) |
Nov
(75) |
Dec
(77) |
2011 |
Jan
(68) |
Feb
(53) |
Mar
(51) |
Apr
(35) |
May
(65) |
Jun
(101) |
Jul
(29) |
Aug
(230) |
Sep
(95) |
Oct
(49) |
Nov
(110) |
Dec
(63) |
2012 |
Jan
(41) |
Feb
(42) |
Mar
(25) |
Apr
(46) |
May
(51) |
Jun
(44) |
Jul
(45) |
Aug
(29) |
Sep
(12) |
Oct
(9) |
Nov
(17) |
Dec
(2) |
2013 |
Jan
(12) |
Feb
(14) |
Mar
(7) |
Apr
(16) |
May
(54) |
Jun
(27) |
Jul
(11) |
Aug
(5) |
Sep
(85) |
Oct
(27) |
Nov
(37) |
Dec
(32) |
2014 |
Jan
(8) |
Feb
(29) |
Mar
(5) |
Apr
(3) |
May
(22) |
Jun
(3) |
Jul
(4) |
Aug
(3) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <neb...@us...> - 2009-09-01 13:44:11
|
Revision: 1833 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1833&view=rev Author: nebelschwade Date: 2009-09-01 13:44:00 +0000 (Tue, 01 Sep 2009) Log Message: ----------- Changed Layout and Playlist Handling Added new JS-Classes A Simple Examples for testing learn-Case Modified Paths: -------------- trunk/src/moosique.net/css/style.css trunk/src/moosique.net/img/controls.png trunk/src/moosique.net/img/loading.gif trunk/src/moosique.net/index.php trunk/src/moosique.net/js/interface.js trunk/src/moosique.net/js/player.js trunk/src/moosique.net/moosique/classes/Config.php trunk/src/moosique.net/moosique/classes/Debugger.php trunk/src/moosique.net/moosique/classes/DllearnerConnection.php trunk/src/moosique.net/moosique/classes/RequestHandler.php trunk/src/moosique.net/moosique/classes/SparqlQueryBuilder.php trunk/src/moosique.net/moosique/classes/View.php trunk/src/moosique.net/moosique/config.ini trunk/src/moosique.net/moosique/index.php trunk/src/moosique.net/moosique/main.wsdl Added Paths: ----------- trunk/src/moosique.net/css/index.php trunk/src/moosique.net/css/reset.css trunk/src/moosique.net/img/bg.png trunk/src/moosique.net/js/index.php trunk/src/moosique.net/js/jsmin-1.1.1.php trunk/src/moosique.net/js/mootools-1.2.3-core-yc.js trunk/src/moosique.net/js/request.js trunk/src/moosique.net/moosique/classes/FirePHP.class.php trunk/src/moosique.net/moosique/data/ trunk/src/moosique.net/moosique/data/allRecords.txt trunk/src/moosique.net/moosique/data/allRecordsWithTags.txt trunk/src/moosique.net/moosique/data/allTags.txt trunk/src/moosique.net/moosique/data/allTagsByPopularity.txt trunk/src/moosique.net/moosique/data/dontUse.txt trunk/src/moosique.net/moosique/data/tagsWeUse.txt trunk/src/moosique.net/moosique/getAllTags.php trunk/src/moosique.net/moosique/jamendo.owl trunk/src/moosique.net/moosique/learnTest.php trunk/src/moosique.net/moosique/stonerTest.owl trunk/src/moosique.net/moosique/tagsToOwl.php Removed Paths: ------------- trunk/src/moosique.net/css/default.css trunk/src/moosique.net/js/ajax.js trunk/src/moosique.net/js/mootools-core.js trunk/src/moosique.net/js/mootools-more.js trunk/src/moosique.net/moosique/classes/FirePHP.php trunk/src/moosique.net/moosique/xml2json/ Deleted: trunk/src/moosique.net/css/default.css =================================================================== --- trunk/src/moosique.net/css/default.css 2009-08-29 14:08:33 UTC (rev 1832) +++ trunk/src/moosique.net/css/default.css 2009-09-01 13:44:00 UTC (rev 1833) @@ -1,44 +0,0 @@ -@media all { /* Yes we want to reset this for print-Styles too */ -/* Based on various Reset-Styles, included own stuff and added mediabox-Style */ -/* Reset all elements except form stuff */ -html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, -a, abbr, acronym, address, big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp, -small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, -table, caption, tbody, tfoot, thead, tr, th, td { - margin: 0; padding: 0; border: 0; outline: 0; font-weight: inherit; font-style: inherit; vertical-align: baseline; -} - -html { height: 100%; } -body { height: 101%; background-color: #fff; color: #000; line-height: 1; } -ol, ul { list-style: none; } -table { border-collapse: collapse; border-spacing: 0; } -caption, th, td { text-align: left; font-weight: normal; } -blockquote:before, blockquote:after, q:before, q:after { content: ""; } -blockquote, q { quotes: "" ""; } -strong, b { font-weight: bold; } -em, i { font-style: italic; } -label, input[type=button], input[type=submit], button { cursor: pointer; } -abbr[title] { border-bottom: 1px dotted #888 !important; cursor: help; } -a abbr { cursor: pointer !important; } - -/* General purpose-Classes */ -.hidden { position: absolute; left: -9999999em; top: -9999999em;} - -/* Clearfix hack */ -.clearfix:after { clear: both; content: "."; display: block; height: 0; visibility: hidden; } -.clearfix { display: inline-block; } -* html .clearfix { height: 1%; } -.clearfix { display: block; } - -/* Special Stuff */ -:focus { outline: 0; } -a { text-decoration: none; } -a:hover { text-decoration: underline; } -a:active { position: relative; top: 1px; } -.ie6 a:active, .ie7 a:active { position: static; top: auto; } -input:focus, textarea:focus, select:focus { background: #eee; } -fieldset { border: 1px solid #333; padding: 9px; } -fieldset legend { padding: 0 9px; } -h1, h2, h3, h4, h5, h6 { clear: both; font-weight: normal; } - -} /* End @media all */ Added: trunk/src/moosique.net/css/index.php =================================================================== --- trunk/src/moosique.net/css/index.php (rev 0) +++ trunk/src/moosique.net/css/index.php 2009-09-01 13:44:00 UTC (rev 1833) @@ -0,0 +1,27 @@ +<?php +/* This little Script takes all included css-files and + * compresses them by removing comments, line-breaks and + * useless space-characters + */ +header('Content-type: text/css'); +// set offset to 365 days = 1 year +$offset = 60 * 60 * 24 * 365; +header('Expires: ' . gmdate("D, d M Y H:i:s", time() + $offset) . ' GMT'); + +ob_start('compress'); /* uncomment for deployment, smaller css-files */ +// ob_start(); + +function compress($buffer) { + // remove comments + $buffer = preg_replace('!/\*[^*]*\*+([^/][^*]*\*+)*/!', '', $buffer); + // remove tabs, spaces, newlines, etc. + $buffer = str_replace(array("\r\n", "\r", "\n", "\t", ' ', ' ', ' '), '', $buffer); + return $buffer; +} + +/* the css-files to include and compress */ +include('reset.css'); +include('style.css'); + +ob_end_flush(); +?> \ No newline at end of file Added: trunk/src/moosique.net/css/reset.css =================================================================== --- trunk/src/moosique.net/css/reset.css (rev 0) +++ trunk/src/moosique.net/css/reset.css 2009-09-01 13:44:00 UTC (rev 1833) @@ -0,0 +1,25 @@ +/* basic reset */ +/* =================================================================== */ +@media all { +html, body, div, h1, h2, h3, +h4, h5, h6, ul, ol, dl, li, +dt, dd, p, img, blockquote, +pre, form, fieldset, table, +th, td { margin: 0; padding: 0; font: inherit; color: inherit; + text-decoration: none; border: none; outline: none; } +ol, ul { list-style: none; } +table { border-collapse: collapse; border-spacing: 0; } +caption, th, td { text-align: left; font-weight: normal; } +label, input[type=button], +input[type=submit], button { cursor: pointer; } +:focus { outline: 0; } +input, textarea, +select, option { font: inherit; color: inherit; } +a { color: inherit; font: inherit; text-decoration: none; } +a:hover { text-decoration: underline; } +a:active { position: relative; top: 1px; } +.hidden { position: absolute; left: -9999px; top: -9999px; } +.clearfix:after { clear: both; content: ' '; display: block; font-size: 0; line-height: 0; + visibility: hidden; width: 0; height: 0; } +.clearfix { display: inline-block; } +} /* end @media all */ \ No newline at end of file Modified: trunk/src/moosique.net/css/style.css =================================================================== --- trunk/src/moosique.net/css/style.css 2009-08-29 14:08:33 UTC (rev 1832) +++ trunk/src/moosique.net/css/style.css 2009-09-01 13:44:00 UTC (rev 1833) @@ -1,372 +1,135 @@ -/* moosique.net - * - * Semiblack: #131313 - * Light Grey: #545454 - * White: #f8faf7 - * Yellowish: #ffbc00 - * - */ - +/* moosique.net - a jamendo radio with recommendations! */ @media screen { - -/* Default Element Styling --- Start Editing below this line */ -/* =================================================================== */ -* { - font-family: Verdana, Arial, Helvetica, sans-serif; - font-size: 12px; - line-height: 16px; - color: #131313; -} +/*=============== Default Styling ===============*/ +body { font: normal 12px/16px Verdana, Arial, sans-serif; color: #f1f7e4; + background: url('../img/bg.png') top left repeat #3a3a3a; border-top: 5px solid #1fd611; } +input, textarea, select { background: #292929; border: 1px solid #5a5a5a; outline: none; padding: 5px; } +input[type=submit] { padding: 5px 10px; } +textarea:focus, input:focus, +select:focus { border: 1px solid #1fd611; } +a:hover { color: #1fd611; } +h1 { font: 32px/32px Georgia, Times, serif; } +h2 { font: 28px/28px Georgia, Times, serif; } +h3 { font: 20px/20px Georgia, Times, serif; } +h4 { font: 16px/16px Georgia, Times, serif; } +h5 { font: 12px/12px Georgia, Times, serif; } +h6 { font: 10px/10px Georgia, Times, serif; } +pre { font: normal 10px/14px Monaco, Courier, monospace; } +p, h1, h2, h3, h4, h5, h6, +table, ul, ol, blockquote, +pre, form { margin-bottom: 16px; } -body { - background: #f8faf7; -} - -a:hover { - color: #ffbc00; -} - -/* Abstand Zeilenhoehe nach unten bei manchen Elementen */ -p, h1, h2, h3, h4, h5, h6, table, ul, ol, blockquote, pre, form { - margin-bottom: 16px; -} - -/* Default Container Positioning */ -/* =================================================================== */ -#container, #header, #mainContainer, #content { - position: relative; -} - -#headerContainer { - height: 95px; - background: #333; - border-bottom: 5px solid #ffbc00; - padding: 20px 0 0 0; -} - -#header { - width: 760px; - margin: 0 auto; -} - -#container { - border-top: 1px solid #ccc; -} - -#mainContainer { - width: 700px; - margin: 0 auto; - padding: 30px; - border: 1px solid #ccc; - border-top: none; -} - -#footer { - padding: 20px; - text-align: center; -} - -/* header Area */ -/* =================================================================== */ -#header h1 a { - font-size: 32px; - line-height: 32px; - font-family: Georgia, Times, "Times New Roman", serif; - text-decoration: none; - color: #f8faf7; -} - -#status, #header .currentlyPlaying { - position: absolute; - top: 0; - right: 0; - width: 380px; - background: #545454; - padding: 10px; - -moz-border-radius: 10px; - -webkit-border-radius: 10px; -} - -#status { - background: #545454; - color: #f8faf7; - z-index: 1000000; - height: 32px; - line-height: 32px; - text-align: center; -} - -.currentlyPlaying h2, .currentlyPlaying h3, .currentlyPlaying h4 { - margin-bottom: 0; -} - -#header .currentlyPlaying h2 { - font-size: 10px; -} - -#header .currentlyPlaying h4 { - position: absolute; - bottom: 10px; - right: 10px; - font-size: 10px; -} - -#searchForm input#searchValue { - margin: 0 5px; - width: 100px; -} - -#loadingImg { - display: none; -} - -/* mainMenu & status */ -/* =================================================================== */ - -#mainMenu ul { - position: absolute; - top: 70px; - right: 0; -} - -#mainMenu ul li { - float: left; - -moz-border-radius-topleft: 10px; - -moz-border-radius-topright: 10px; - -webkit-border-top-left-radius: 10px; - -webkit-border-top-right-radius: 10px; - padding: 0 15px; - background: #545454; - margin: 5px 0 0 5px; - height: 20px; - line-height: 20px; -} - -#mainMenu ul li a { - color: #131313; -} - -#mainMenu ul li.active { - height: 25px; - line-height: 25px; - margin-top: 0; - background: #ffbc00; -} - -#mainMenu ul li.active a { - font-weight: bold; -} - -#mainMenu ul li a:hover { - text-decoration: none; -} - - -/* Content Area Default Styles */ -/* =================================================================== */ -#content h2, #content h3 { - font-size: 16px; - line-height: 24px; - font-weight: bold; -} - -/* for debugging */ -#content pre { - font-family: "Courier New", Courier, monospace; - font-size: 10px; -} - /* Initial hiding */ -#recommendations, #player, #information, #help { - display: none; /* Initial Hide */ -} +#recommendations, #player, +#information, #help, +#loadingImg, #header h1 { display: none; } -#footer * { - font-size: 10px; -} +/* Rounded Corners */ +input, textarea, select { -moz-border-radius: 5px; -webkit-border-radius: 5px; } +#content, #status, #playing, +#playerControls, #results li { -moz-border-radius: 10px; -webkit-border-radius: 10px; } +#mainMenu a { -moz-border-radius-bottomleft: 10px; -moz-border-radius-bottomright: 10px; + -webkit-border-bottom-left-radius: 10px; -webkit-border-bottom-right-radius: 10px; } + +/* button-click-feeling for links, by offsetting top position */ +#prev:active, #next:active, +#stop:active, #mute:active +#playPause:active, { position: relative; top: 2px; } +#playlist .delete:active, +#playlist .moveUp:active, +#playlist .moveDown:active { top: 6px; } -/* home -- search results */ -/* =================================================================== */ -#results h3 em { - font-size: 16px; -} +/*=============== Default Containers ===============*/ +#container, #header, +#headerContainer, +#mainContainer, #content, +#playlist li { position: relative; } +#container { width: 760px; margin: 0 auto; } +#header { height: 150px; padding-top: 20px; } +#content { background: #292929; padding: 20px; } +#footer { font: normal 10px/14px Verdana, Arial, sans-serif; padding: 20px; text-align: center; } -#results ul li h3 a { - font-weight: normal; -} -#results ul li img { - border: 2px solid #545454; - margin-bottom: 16px; -} +/*=============== header Area, Player Controls, Status, Playing and Search Form ===============*/ +#status, #playing { position: absolute; top: 70px; left: 0; width: 490px; height: 60px; + background: #292929; padding: 10px 20px; } +#playerControls { position: absolute; top: 70px; right: 0; width: 170px; height: 60px; + padding: 10px 20px; background: #292929; } +#status { background: #393939; height: 60px; line-height: 60px; text-align: center; + font-weight: bold; border: 1px solid #1fd611; z-index: 1000; } +#playing span { display: block; margin-bottom: 0; font-size: 10px; } +#playing .track { font: bold 12px/32px Verdana, Arial, sans-serif; } +#playing .time { position: absolute; bottom: 10px; right: 20px; } -#results ul li { - display: block; - border: 1px dotted #545454; - padding: 16px; - margin: 0 16px 16px 0; - float: left; - width: 300px; -} +#prev, #next, #stop, +#playPause, #mute { display: block; width: 20px; height: 40px; text-indent: -10000px; + float: left; margin: 10px 0 0 10px; } +/* Sprites */ +#prev { background: url(../img/controls.png) 0px -160px no-repeat; } +#next { background: url(../img/controls.png) 0px -120px no-repeat; } +#stop { background: url(../img/controls.png) 0px -80px no-repeat; } +#mute { background: url(../img/controls.png) 0px -280px no-repeat; margin-right: 0; width: 23px; } +#playPause { background: url(../img/controls.png) 0px 0px no-repeat; width: 26px; } -#results .artistSearch ul li { - height: 450px; -} +/* Search form */ +#searchValue { margin: 0 5px; width: 100px; } +#loadingImg { cursor: wait; } -#results ul ul { - list-style: square; -} -#results ul li ul li, -#results .artistSearch ul li ul li, -#results .tagSearch ul li ul li { - border: none; - display: list-item; - padding: 0; - margin: 0 0 0 32px; - width: auto; - height: auto; - float: none; -} +/*=============== Menu ===============*/ +#mainMenu ul { position: absolute; top: 0; right: 0; } +#mainMenu li { float: left; } +#mainMenu a { display: block; margin-left: 10px; line-height: 30px; height: 30px; + padding: 10px 12px; color: #fafafa; background: #4a4a4a; } +#mainMenu .active a, +#mainMenu .active a:hover { background: #1fd611; } +#mainMenu a:hover { text-decoration: none; background: #5a5a5a; } -#results .tagSearch ul li ul { - clear: both; -} - +/*=============== Search Results ===============*/ +#results li h3 a { font-weight: normal; } +#results li img { border: 2px solid #545454; margin-bottom: 16px; } +#results li { display: block; border: 1px solid #545454; padding: 16px; margin-bottom: 16px; + float: left; width: 318px; } +#results li.odd { margin-right: 16px; clear: both; } +#results ul ul { list-style: disc; } -#results .artistSearch ul li div.artistImage { - text-align: center; -} +/* This is for the list of found albums etc */ +#results li li, +#results .artistSearch li li, +#results .tagSearch li li { border: none; display: list-item; padding: 0; margin: 0 0 0 32px; + width: auto; height: auto; float: none; } +#results .tagSearch ul ul { clear: both; } +#results .artistImage { text-align: center; } +#results .cover { margin-right: 16px; width: 110px; float: left; } +#results .tagSearch h4 { display: inline; } -#results .tagSearch ul li div.cover { - margin-right: 16px; - width: 110px; - float: left; -} -#results .tagSearch ul li h4 { - display: inline; - font-weight: bold; -} +/*=============== Recommendations and playlist ===============*/ +#recommended a:hover { cursor: pointer; text-decoration: none; font-weight: bold; color: #131313; } +#playlist, #recommended, +#recently { margin-left: 36px; list-style: decimal; } +#playlist li, #recently li, +#recommended li { line-height: 24px; } +#playlist .ymp-btn-page-pause { font-weight: bold; } +/* Playlist buttons */ +#playlist .delete, +#playlist .moveUp, +#playlist .moveDown { position: absolute; display: block; top: 5px; right: 20px; width: 14px; height: 14px; + line-height: 14px; text-indent: -10000px; + background: url(../img/controls.png) 0px -200px no-repeat;} +#playlist .moveUp { background: url(../img/controls.png) 0px -360px no-repeat; right: 40px; } +#playlist .moveDown { background: url(../img/controls.png) 0px -320px no-repeat; right: 60px; } +/*=============== Information / Help ===============*/ -/* Recommendations */ -/* =================================================================== */ -#recommended { - list-style: decimal; - margin-left: 24px; -} -#recommended li { - line-height: 24px; -} -#recommended a:hover { - cursor: pointer; - text-decoration: none; - font-weight: bold; - color: #131313; -} -/* information */ -/* =================================================================== */ - - - - -/* player */ -/* =================================================================== */ - -#playerControls { - position: absolute; - width: 149px; - height: 37px; - top: 0; - right: 0; - padding: 10px 20px; - background: #545454; - -moz-border-radius: 10px; - -webkit-border-radius: 10px; -} - -#prev, #next, #stop, #playPause, #mute { - display: block; - width: 20px; - height: 37px; - text-decoration: none; - text-indent: -1000000px; - float: left; - margin-right: 10px; -} - -/* clicky feel */ -#prev:active, #next:active, #stop:active, -#playPause:active, #mute:active { - position: relative; - top: 2px; -} - -/* Sprites */ -#prev { background: url(../img/controls.png) 0px -160px no-repeat; } -#next { background: url(../img/controls.png) 0px -120px no-repeat; } -#stop { background: url(../img/controls.png) 0px -80px no-repeat; } - -#playPause { - background: url(../img/controls.png) 0px 0px no-repeat; - width: 26px; -} - -#mute { - background: url(../img/controls.png) 0px -280px no-repeat; - margin-right: 0; - width: 23px; -} -/* End Sprites */ - -#playlist li { - position: relative; /* Delete Buttons */ - list-style: decimal; - list-style-position: inside; - cursor: move; - padding: 3px; -} - -#playlist li a.ymp-btn-page-pause { - font-weight: bold; -} - -/* Delete buttons */ -#playlist li a.del { - position: absolute; - display: block; - top: 5px; - right: 20px; - width: 14px; - height: 14px; - line-height: 14px; - margin-right: -19px; - z-index: 1000; - text-indent: -99999999px; - background: url(../img/controls.png) 0px -200px no-repeat; -} - -/* Draggable li-Items */ -#playlist li.moving { - background: #666; - border: 3px solid #ffbc00; - font-weight: bold; -} - - - - - - } /* end @media screen */ \ No newline at end of file Added: trunk/src/moosique.net/img/bg.png =================================================================== (Binary files differ) Property changes on: trunk/src/moosique.net/img/bg.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: trunk/src/moosique.net/img/controls.png =================================================================== (Binary files differ) Modified: trunk/src/moosique.net/img/loading.gif =================================================================== (Binary files differ) Modified: trunk/src/moosique.net/index.php =================================================================== --- trunk/src/moosique.net/index.php 2009-08-29 14:08:33 UTC (rev 1832) +++ trunk/src/moosique.net/index.php 2009-09-01 13:44:00 UTC (rev 1833) @@ -1,153 +1,133 @@ -<?php session_start(); ?><!DOCTYPE html +<?php session_start(); ?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> - <head> - <title>moosique.net</title> - <link href="css/default.css" rel="stylesheet" type="text/css" /> - <link href="css/style.css" rel="stylesheet" type="text/css" /> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> + <link href="css/" rel="stylesheet" type="text/css" /> + <title>moosique.net</title> </head> - -<!--[if IE 7]><body class="ie7"><![endif]--> -<!--[if lte IE 6]><body class="ie6"><![endif]--> -<!--[if !IE]><!--><body><!-- <![endif]--> - - <div id="headerContainer"> - <div id="header"> - <h1><a href="index.php">moosique.net</a></h1> - - <div id="mainMenu"> - <ul class="clearfix"> - <li class="active"><a href="#" class="home">Home</a></li> - <li><a href="#" class="player">Player</a></li> - <li><a href="#" class="recommendations">Recommendations</a></li> - <li><a href="#" class="information">Information</a></li> - <li><a href="#" class="help">Help</a></li> - </ul> - </div> - - <form id="searchForm" method="get" action="moosique/"> - <div class="clearfix"> - <select name="typeOfSearch" id="typeOfSearch"> +<body> +<div id="container"> + <div id="header"> + <h1>moosique.net</h1> + <div id="mainMenu"> + <ul class="clearfix"> + <li class="active"><a href="#" class="home">Search</a></li> + <li><a href="#" class="player">Playlist</a></li> + <li><a href="#" class="recommendations">Recommendations</a></li> + <li><a href="#" class="information">Info</a></li> + <li><a href="#" class="help">?</a></li> + </ul> + </div> + <form id="searchForm" method="get" action="moosique/"> + <ol> + <li> + <select name="searchType" id="searchType"> + <?php /* <option value="allSearch">Everything</option> */ ?> <option value="artistSearch">Artist</option> <option value="tagSearch">Tag</option> - <?php /* <option value="songSearch">Song</option> - <option value="lastfm">Last.fm-User</option> - */ ?> + <?php /* <option value="lastfm">Last.fm-User</option> */ ?> </select> <input id="searchValue" name="searchValue" type="text" /> - <input id="searchSubmit" name="searchSubmit" value="Search" title="Search" type="submit" disabled="disabled" /> + <input id="searchSubmit" name="searchSubmit" value="Search" title="Search" type="submit" /> <img id="loadingImg" src="img/loading.gif" alt="Loading..." /> - </div> - </form> - - <div id="status"> </div> - - <div class="currentlyPlaying"> - <h2>Player stopped</h2> - <h3>...</h3> - <h4>0:00 / 0:00</h4> - </div> - + </li> + </ol> + </form> + <div id="playerControls"> + <a href="#" id="playPause" title="Play/Pause">Play / Pause</a> + <a href="#" id="stop" title="Stop playing">Stop</a> + <a href="#" id="prev" title="Play previous Track in Playlist">Previous Tack</a> + <a href="#" id="next" title="Play next Track in Playlist">Next Track</a> + <a href="#" id="mute" title="Sound on/off">Mute</a> </div> + <h4 id="status"> </h4> + <div id="playing"> + <span class="info">Player stopped</span> + <span class="track">...</span> + <span class="time">0:00 / 0:00</span> + </div> </div> - <div id="container"> - <div id="mainContainer"> - <div id="content" class="clearfix"> + <div id="content"> + <div id="home"> + <div id="welcome"> + <h2>Welcome to moosique.net!</h2> + <p> + Want to listen to some good free music? Just enter an artist or song + name or search for music using tags <!-- or enter your last.fm username --> and let the moogic + happen. By listening to songs you like, the system will automatically learn about + your musical taste and generate recommendations. You can find them in the tab »Recommendations«. + </p> + <p> + You can find information about the song currently playing in the tab »Information« and view + your Playlist and control the Player in the Tab »Player«. + </p> + <p> + Now get started and add something to the Playlist! + </p> + </div> + <div id="results"> - <div id="home"> - <div id="welcome"> - <h2>Welcome to moosique.net!</h2> - <p> - Want to listen to some good free music? Just enter an artist or song - name or search for music using tags <!-- or enter your last.fm username --> and let the moogic - happen. By listening to songs you like, the system will automatically learn about - your musical taste and generate recommendations. You can find them in the tab »Recommendations«. - </p> - <p> - You can find information about the song currently playing in the tab »Information« and view - your Playlist and control the Player in the Tab »Player«. - </p> - <p> - Now get started and add something to the Playlist! - </p> - </div> - <div id="results"> - - </div> - </div> + </div> + </div> - <div id="recommendations"> - <h2>Recommended Songs</h2> - <p>Click a song to add it to your playlist.</p> - <ol id="recommended"> - <li></li> - </ol> - - </div> + <div id="recommendations"> + <h2>Recommended Songs</h2> + <p>These are the automatically generated recommendations. Click on a song to add it to your playlist.</p> + <ol id="recommended"> + <li></li> + </ol> + <h2>Recently Listened to</h2> + <p>These are the songs you recently listened to. Click on a song to re-enqueue it to your current playlist. (NOT WORKING YET!)</p> + <ol id="recently"> + <li></li> + </ol> + </div> - <div id="information"> - <div id="moreInfo"> - <h2>About the Artist</h2> - <img src="http://imgjam.com/albums/8654/covers/1.200.jpg" alt="Cover" /> - <p> - Iusto odio dignissim qui blandit praesent. Nisl ut aliquip ex ea commodo, consequat - duis autem vel eum. Nam liber tempor cum soluta nobis eleifend option congue nihil - imperdiet doming id. In hendrerit eu feugiat nulla luptatum zzril delenit augue duis - dolore te feugait. Quod ii legunt saepius claritas est etiam processus dynamicus - qui nobis videntur parum. - </p> - </div> - </div> - - <div id="player"> - <h3>Playlist</h3> - <p> - You can delete entries from the playlist by clicking the small x on the left. <br /> - You also can move the playlist-entries around to change their order. - </p> + <div id="information"> + <div id="moreInfo"> + <h2>About the Artist</h2> + <img src="http://imgjam.com/albums/8654/covers/1.200.jpg" alt="Cover" /> + <p> + Iusto odio dignissim qui blandit praesent. Nisl ut aliquip ex ea commodo, consequat + duis autem vel eum. Nam liber tempor cum soluta nobis eleifend option congue nihil + imperdiet doming id. In hendrerit eu feugiat nulla luptatum zzril delenit augue duis + dolore te feugait. Quod ii legunt saepius claritas est etiam processus dynamicus + qui nobis videntur parum. + </p> + </div> + </div> + + <div id="player"> + <h3>Playlist</h3> + <p> + You can delete entries from the playlist by clicking the small x on the left and change their order by clicking on the small up- and down-arrows.<br /> + </p> + <ol id="playlist"> + <li></li> + </ol> + + </div> - <ol id="playlist"> - <li></li> - </ol> + <div id="help"> + + </div> - <div id="playerControls"> - <a href="#" id="playPause" title="Play/Pause">Play / Pause</a> - <a href="#" id="stop" title="Stop playing">Stop</a> - <a href="#" id="prev" title="Play previous Track in Playlist">Previous Tack</a> - <a href="#" id="next" title="Play next Track in Playlist">Next Track</a> - <a href="#" id="mute" title="Sound on/off">Mute</a> - </div> - - </div> + </div> <!-- end content --> - <div id="help"> - - </div> - - </div> <!-- end content --> - </div> <!-- end mainContainer --> - <div id="footer"> - <a href="http://jamendo.com">Jamendo</a> | - <a href="http://mediaplayer.yahoo.com/">Yahoo! Media Player</a> | - <a href="http://aksw.org/Projects/DLLearner">Powered by DL-Learner</a> - </div> - </div> <!-- end container --> + <div id="footer"> + <a href="http://jamendo.com">Jamendo</a> | + <a href="http://mediaplayer.yahoo.com/">Yahoo! Media Player</a> | + <a href="http://aksw.org/Projects/DLLearner">DL-Learner</a> + </div> +</div> <!-- end container --> - - <!-- JS at the bottom, faster loading pages --> - <script type="text/javascript" src="http://mediaplayer.yahoo.com/js"></script> - - <script type="text/javascript" src="js/mootools-core.js"></script> - <script type="text/javascript" src="js/mootools-more.js"></script> - - <script type="text/javascript" src="js/player.js"></script> - <script type="text/javascript" src="js/interface.js"></script> - <script type="text/javascript" src="js/ajax.js"></script> +<script type="text/javascript" src="http://mediaplayer.yahoo.com/js"></script> +<script type="text/javascript" src="js/"></script> </body> </html> \ No newline at end of file Deleted: trunk/src/moosique.net/js/ajax.js =================================================================== --- trunk/src/moosique.net/js/ajax.js 2009-08-29 14:08:33 UTC (rev 1832) +++ trunk/src/moosique.net/js/ajax.js 2009-09-01 13:44:00 UTC (rev 1833) @@ -1,93 +0,0 @@ -window.addEvent('domready', function() { - -// handle search requests -$('searchForm').addEvent('submit', function(e) { - - var results = $('results'); - var submit = $('searchSubmit'); - var loading = $('loadingImg'); - - e.stop(); // prevent form submitting the non-ajax way - this.set('send', { - - onRequest: function() { - submit.set('disabled', 'disabled'); // disable submit button until request complete - // show homescreen for resultdisplaying - showTab('home'); - submit.setStyle('display', 'none'); - loading.setStyle('display', 'inline'); - results.set('html', '<h2>Searching...</h2>'); - }, - - onFailure: function() { - results.set('html', '<h2>Unable to process your search. Try again.</h2>'); - }, - - onSuccess: function(response) { - submit.erase('disabled'); // reenable submitbutton - submit.setStyle('display', 'inline'); - loading.setStyle('display', 'none'); - - // if the welcome-text ist present, cut it to help - if ($('welcome')) { - if ($('welcome').get('html').length > 100) { - $('help').set('html', $('welcome').get('html')); - $('welcome').destroy(); - } - } - - // display results - results.set('html', response); - - // addEvents to result-links - makeAddable(); - } - - }); - - // only send form if value is at least 3 - if ($('searchValue').get('value').length > 2) { - this.send(); - } - -}); - -makeAddable(); - -}); - - -/** - * For Recommendations and Search-Results - */ -function makeAddable() { - $$('a.addToPlaylist').each(function(a) { - a.addEvent('click', function(e) { - e.stop(); // dont follow link - // remove the class from preventing adding again - - a.removeClass('addToPlaylist'); - - // TODO, now using xspfs, later we only will use mp3-links - a.set('type', 'application/xspf+xml'); - - // if the Playlist is empty, remove entries - if ($('playlist').getFirst()) { - if ($('playlist').getFirst().get('text') == '') { - $('playlist').empty(); - } - } - - - a.getParent().inject($('playlist')); - if (a.get('title')) { - a.set('text', a.get('title')); - } - - // - mooPlayer.refreshPlaylist(); - showTab('player'); - - }); - }); -} \ No newline at end of file Added: trunk/src/moosique.net/js/index.php =================================================================== --- trunk/src/moosique.net/js/index.php (rev 0) +++ trunk/src/moosique.net/js/index.php 2009-09-01 13:44:00 UTC (rev 1833) @@ -0,0 +1,30 @@ +<?php +/* This little Script takes all included js-files and + * compresses them with the PHP-Variant of js-min + * found here: http://code.google.com/p/jsmin-php/ + */ +header('Content-type: application/javascript'); +// set offset to 365 days = 1 year +$offset = 60 * 60 * 24 * 365; +header('Expires: ' . gmdate("D, d M Y H:i:s", time() + $offset) . ' GMT'); + +ob_start('compress'); + +function compress($buffer) { + include('jsmin-1.1.1.php'); + $buffer = JSMin::minify($buffer); + return $buffer; +} + +/* the javascript-files to include and compress */ +include('mootools-1.2.3-core-yc.js'); +include('player.js'); +include('interface.js'); +include('request.js'); + + +// Since we include the IE6-Fixes with a CC, we don't +// add and compress them here + +ob_end_flush(); +?> \ No newline at end of file Modified: trunk/src/moosique.net/js/interface.js =================================================================== --- trunk/src/moosique.net/js/interface.js 2009-08-29 14:08:33 UTC (rev 1832) +++ trunk/src/moosique.net/js/interface.js 2009-09-01 13:44:00 UTC (rev 1833) @@ -1,22 +1,30 @@ window.addEvent('domready', function() { // switching between search, recommendation and information - -$$('#mainMenu ul li a').each(function(a) { +$$('#mainMenu a').each(function(a) { a.addEvent('click', function(e) { e.stop(); // dont follow link showTab(a.get('class').toString()); }); - }); -$('searchValue').addEvent('keyup', function() { - if (this.get('value').length > 2) { - $('searchSubmit').erase('disabled'); - } else { - $('searchSubmit').set('disabled', 'disabled'); +// update recently listened song if a cookie is set +// update the #recently ol +var rlc = Cookie.read('recentlyListened'); +var rl = JSON.decode(rlc); + +if (rl) { + if (rl.length > 0) { + var count = rl.length; + var recentlyHTML = ''; + for (var i = 0; i < count; i++ ) { + recentlyHTML += '<li>'; + recentlyHTML += rl[i] + '<br />'; + recentlyHTML += '</li>'; + } + document.id('recently').set('html', recentlyHTML); } -}); +} }); @@ -26,10 +34,10 @@ * @param {String} tabID ID of the Tab to show */ function showTab(tabID) { - $$('#mainMenu ul li').removeClass('active'); - $$('#mainMenu ul li a.' + tabID).getParent().toggleClass('active'); - $('content').getChildren().setStyle('display', 'none') - $(tabID).setStyle('display', 'block'); + $$('#mainMenu li').removeClass('active'); + $$('#mainMenu a.' + tabID).getParent().toggleClass('active'); + document.id('content').getChildren().setStyle('display', 'none'); + document.id(tabID).setStyle('display', 'block'); } Added: trunk/src/moosique.net/js/jsmin-1.1.1.php =================================================================== --- trunk/src/moosique.net/js/jsmin-1.1.1.php (rev 0) +++ trunk/src/moosique.net/js/jsmin-1.1.1.php 2009-09-01 13:44:00 UTC (rev 1833) @@ -0,0 +1,291 @@ +<?php +/** + * jsmin.php - PHP implementation of Douglas Crockford's JSMin. + * + * This is pretty much a direct port of jsmin.c to PHP with just a few + * PHP-specific performance tweaks. Also, whereas jsmin.c reads from stdin and + * outputs to stdout, this library accepts a string as input and returns another + * string as output. + * + * PHP 5 or higher is required. + * + * Permission is hereby granted to use this version of the library under the + * same terms as jsmin.c, which has the following license: + * + * -- + * Copyright (c) 2002 Douglas Crockford (www.crockford.com) + * + * Permission is hereby granted, free of charge, to any person obtaining a copy of + * this software and associated documentation files (the "Software"), to deal in + * the Software without restriction, including without limitation the rights to + * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies + * of the Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * The Software shall be used for Good, not Evil. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * -- + * + * @package JSMin + * @author Ryan Grove <ry...@wo...> + * @copyright 2002 Douglas Crockford <do...@cr...> (jsmin.c) + * @copyright 2008 Ryan Grove <ry...@wo...> (PHP port) + * @license http://opensource.org/licenses/mit-license.php MIT License + * @version 1.1.1 (2008-03-02) + * @link http://code.google.com/p/jsmin-php/ + */ + +class JSMin { + const ORD_LF = 10; + const ORD_SPACE = 32; + + protected $a = ''; + protected $b = ''; + protected $input = ''; + protected $inputIndex = 0; + protected $inputLength = 0; + protected $lookAhead = null; + protected $output = ''; + + // -- Public Static Methods -------------------------------------------------- + + public static function minify($js) { + $jsmin = new JSMin($js); + return $jsmin->min(); + } + + // -- Public Instance Methods ------------------------------------------------ + + public function __construct($input) { + $this->input = str_replace("\r\n", "\n", $input); + $this->inputLength = strlen($this->input); + } + + // -- Protected Instance Methods --------------------------------------------- + + protected function action($d) { + switch($d) { + case 1: + $this->output .= $this->a; + + case 2: + $this->a = $this->b; + + if ($this->a === "'" || $this->a === '"') { + for (;;) { + $this->output .= $this->a; + $this->a = $this->get(); + + if ($this->a === $this->b) { + break; + } + + if (ord($this->a) <= self::ORD_LF) { + throw new JSMinException('Unterminated string literal.'); + } + + if ($this->a === '\\') { + $this->output .= $this->a; + $this->a = $this->get(); + } + } + } + + case 3: + $this->b = $this->next(); + + if ($this->b === '/' && ( + $this->a === '(' || $this->a === ',' || $this->a === '=' || + $this->a === ':' || $this->a === '[' || $this->a === '!' || + $this->a === '&' || $this->a === '|' || $this->a === '?')) { + + $this->output .= $this->a . $this->b; + + for (;;) { + $this->a = $this->get(); + + if ($this->a === '/') { + break; + } elseif ($this->a === '\\') { + $this->output .= $this->a; + $this->a = $this->get(); + } elseif (ord($this->a) <= self::ORD_LF) { + throw new JSMinException('Unterminated regular expression '. + 'literal.'); + } + + $this->output .= $this->a; + } + + $this->b = $this->next(); + } + } + } + + protected function get() { + $c = $this->lookAhead; + $this->lookAhead = null; + + if ($c === null) { + if ($this->inputIndex < $this->inputLength) { + $c = $this->input[$this->inputIndex]; + $this->inputIndex += 1; + } else { + $c = null; + } + } + + if ($c === "\r") { + return "\n"; + } + + if ($c === null || $c === "\n" || ord($c) >= self::ORD_SPACE) { + return $c; + } + + return ' '; + } + + protected function isAlphaNum($c) { + return ord($c) > 126 || $c === '\\' || preg_match('/^[\w\$]$/', $c) === 1; + } + + protected function min() { + $this->a = "\n"; + $this->action(3); + + while ($this->a !== null) { + switch ($this->a) { + case ' ': + if ($this->isAlphaNum($this->b)) { + $this->action(1); + } else { + $this->action(2); + } + break; + + case "\n": + switch ($this->b) { + case '{': + case '[': + case '(': + case '+': + case '-': + $this->action(1); + break; + + case ' ': + $this->action(3); + break; + + default: + if ($this->isAlphaNum($this->b)) { + $this->action(1); + } + else { + $this->action(2); + } + } + break; + + default: + switch ($this->b) { + case ' ': + if ($this->isAlphaNum($this->a)) { + $this->action(1); + break; + } + + $this->action(3); + break; + + case "\n": + switch ($this->a) { + case '}': + case ']': + case ')': + case '+': + case '-': + case '"': + case "'": + $this->action(1); + break; + + default: + if ($this->isAlphaNum($this->a)) { + $this->action(1); + } + else { + $this->action(3); + } + } + break; + + default: + $this->action(1); + break; + } + } + } + + return $this->output; + } + + protected function next() { + $c = $this->get(); + + if ($c === '/') { + switch($this->peek()) { + case '/': + for (;;) { + $c = $this->get(); + + if (ord($c) <= self::ORD_LF) { + return $c; + } + } + + case '*': + $this->get(); + + for (;;) { + switch($this->get()) { + case '*': + if ($this->peek() === '/') { + $this->get(); + return ' '; + } + break; + + case null: + throw new JSMinException('Unterminated comment.'); + } + } + + default: + return $c; + } + } + + return $c; + } + + protected function peek() { + $this->lookAhead = $this->get(); + return $this->lookAhead; + } +} + +// -- Exceptions --------------------------------------------------------------- +class JSMinException extends Exception {} +?> \ No newline at end of file Added: trunk/src/moosique.net/js/mootools-1.2.3-core-yc.js =================================================================== --- trunk/src/moosique.net/js/mootools-1.2.3-core-yc.js (rev 0) +++ trunk/src/moosique.net/js/mootools-1.2.3-core-yc.js 2009-09-01 13:44:00 UTC (rev 1833) @@ -0,0 +1,356 @@ +//MooTools, <http://mootools.net>, My Object Oriented (JavaScript) Tools. Copyright (c) 2006-2009 Valerio Proietti, <http://mad4milk.net>, MIT Style License. + +var MooTools={version:"1.2.3",build:"4980aa0fb74d2f6eb80bcd9f5b8e1fd6fbb8f607"};var Native=function(k){k=k||{};var a=k.name;var i=k.legacy;var b=k.protect; +var c=k.implement;var h=k.generics;var f=k.initialize;var g=k.afterImplement||function(){};var d=f||i;h=h!==false;d.constructor=Native;d.$family={name:"native"}; +if(i&&f){d.prototype=i.prototype;}d.prototype.constructor=d;if(a){var e=a.toLowerCase();d.prototype.$family={name:e};Native.typize(d,e);}var j=function(n,l,o,m){if(!b||m||!n.prototype[l]){n.prototype[l]=o; +}if(h){Native.genericize(n,l,b);}g.call(n,l,o);return n;};d.alias=function(n,l,p){if(typeof n=="string"){var o=this.prototype[n];if((n=o)){return j(this,l,n,p); +}}for(var m in n){this.alias(m,n[m],l);}return this;};d.implement=function(m,l,o){if(typeof m=="string"){return j(this,m,l,o);}for(var n in m){j(this,n,m[n],l); +}return this;};if(c){d.implement(c);}return d;};Native.genericize=function(b,c,a){if((!a||!b[c])&&typeof b.prototype[c]=="function"){b[c]=function(){var d=Array.prototype.slice.call(arguments); +return b.prototype[c].apply(d.shift(),d);};}};Native.implement=function(d,c){for(var b=0,a=d.length;b<a;b++){d[b].implement(c);}};Native.typize=function(a,b){if(!a.type){a.type=function(c){return($type(c)===b); +};}};(function(){var a={Array:Array,Date:Date,Function:Function,Number:Number,RegExp:RegExp,String:String};for(var h in a){new Native({name:h,initialize:a[h],protect:true}); +}var d={"boolean":Boolean,"native":Native,object:Object};for(var c in d){Native.typize(d[c],c);}var f={Array:["concat","indexOf","join","lastIndexOf","pop","push","reverse","shift","slice","sort","splice","toString","unshift","valueOf"],String:["charAt","charCodeAt","concat","indexOf","lastIndexOf","match","replace","search","slice","split","substr","substring","toLowerCase","toUpperCase","valueOf"]}; +for(var e in f){for(var b=f[e].length;b--;){Native.genericize(a[e],f[e][b],true);}}})();var Hash=new Native({name:"Hash",initialize:function(a){if($type(a)=="hash"){a=$unlink(a.getClean()); +}for(var b in a){this[b]=a[b];}return this;}});Hash.implement({forEach:function(b,c){for(var a in this){if(this.hasOwnProperty(a)){b.call(c,this[a],a,this); +}}},getClean:function(){var b={};for(var a in this){if(this.hasOwnProperty(a)){b[a]=this[a];}}return b;},getLength:function(){var b=0;for(var a in this){if(this.hasOwnProperty(a)){b++; +}}return b;}});Hash.alias("forEach","each");Array.implement({forEach:function(c,d){for(var b=0,a=this.length;b<a;b++){c.call(d,this[b],b,this);}}});Array.alias("forEach","each"); +function $A(b){if(b.item){var a=b.length,c=new Array(a);while(a--){c[a]=b[a];}return c;}return Array.prototype.slice.call(b);}function $arguments(a){return function(){return arguments[a]; +};}function $chk(a){return !!(a||a===0);}function $clear(a){clearTimeout(a);clearInterval(a);return null;}function $defined(a){return(a!=undefined);}function $each(c,b,d){var a=$type(c); +((a=="arguments"||a=="collection"||a=="array")?Array:Hash).each(c,b,d);}function $empty(){}function $extend(c,a){for(var b in (a||{})){c[b]=a[b];}return c; +}function $H(a){return new Hash(a);}function $lambda(a){return($type(a)=="function")?a:function(){return a;};}function $merge(){var a=Array.slice(arguments); +a.unshift({});return $mixin.apply(null,a);}function $mixin(e){for(var d=1,a=arguments.length;d<a;d++){var b=arguments[d];if($type(b)!="object"){continue; +}for(var c in b){var g=b[c],f=e[c];e[c]=(f&&$type(g)=="object"&&$type(f)=="object")?$mixin(f,g):$unlink(g);}}return e;}function $pick(){for(var b=0,a=arguments.length; +b<a;b++){if(arguments[b]!=undefined){return arguments[b];}}return null;}function $random(b,a){return Math.floor(Math.random()*(a-b+1)+b);}function $splat(b){var a=$type(b); +return(a)?((a!="array"&&a!="arguments")?[b]:b):[];}var $time=Date.now||function(){return +new Date;};function $try(){for(var b=0,a=arguments.length;b<a; +b++){try{return arguments[b]();}catch(c){}}return null;}function $type(a){if(a==undefined){return false;}if(a.$family){return(a.$family.name=="number"&&!isFinite(a))?false:a.$family.name; +}if(a.nodeName){switch(a.nodeType){case 1:return"element";case 3:return(/\S/).test(a.nodeValue)?"textnode":"whitespace";}}else{if(typeof a.length=="number"){if(a.callee){return"arguments"; +}else{if(a.item){return"collection";}}}}return typeof a;}function $unlink(c){var b;switch($type(c)){case"object":b={};for(var e in c){b[e]=$unlink(c[e]); +}break;case"hash":b=new Hash(c);break;case"array":b=[];for(var d=0,a=c.length;d<a;d++){b[d]=$unlink(c[d]);}break;default:return c;}return b;}var Browser=$merge({Engine:{name:"unknown",version:0},Platform:{name:(window.orientation!=undefined)?"ipod":(navigator.platform.match(/mac|win|linux/i)||["other"])[0].toLowerCase()},Features:{xpath:!!(document.evaluate),air:!!(window.runtime),query:!!(document.querySelector)},Plugins:{},Engines:{presto:function(){return(!window.opera)?false:((arguments.callee.caller)?960:((document.getElementsByClassName)?950:925)); +},trident:function(){return(!window.ActiveXObject)?false:((window.XMLHttpRequest)?5:4);},webkit:function(){return(navigator.taintEnabled)?false:((Browser.Features.xpath)?((Browser.Features.query)?525:420):419); +},gecko:function(){return(document.getBoxObjectFor==undefined)?false:((document.getElementsByClassName)?19:18);}}},Browser||{});Browser.Platform[Browser.Platform.name]=true; +Browser.detect=function(){for(var b in this.Engines){var a=this.Engines[b]();if(a){this.Engine={name:b,version:a};this.Engine[b]=this.Engine[b+a]=true; +break;}}return{name:b,version:a};};Browser.detect();Browser.Request=function(){return $try(function(){return new XMLHttpRequest();},function(){return new ActiveXObject("MSXML2.XMLHTTP"); +});};Browser.Features.xhr=!!(Browser.Request());Browser.Plugins.Flash=(function(){var a=($try(function(){return navigator.plugins["Shockwave Flash"].description; +},function(){return new ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version");})||"0 r0").match(/\d+/g);return{version:parseInt(a[0]||0+"."+a[1],10)||0,build:parseInt(a[2],10)||0}; +})();function $exec(b){if(!b){return b;}if(window.execScript){window.execScript(b);}else{var a=document.createElement("script");a.setAttribute("type","text/javascript"); +a[(Browser.Engine.webkit&&Browser.Engine.version<420)?"innerText":"text"]=b;document.head.appendChild(a);document.head.removeChild(a);}return b;}Native.UID=1; +var $uid=(Browser.Engine.trident)?function(a){return(a.uid||(a.uid=[Native.UID++]))[0];}:function(a){return a.uid||(a.uid=Native.UID++);};var Window=new Native({name:"Window",legacy:(Browser.Engine.trident)?null:window.Window,initialize:function(a){$uid(a); +if(!a.Element){a.Element=$empty;if(Browser.Engine.webkit){a.document.createElement("iframe");}a.Element.prototype=(Browser.Engine.webkit)?window["[[DOMElement.prototype]]"]:{}; +}a.document.window=a;return $extend(a,Window.Prototype);},afterImplement:function(b,a){window[b]=Window.Prototype[b]=a;}});Window.Prototype={$family:{name:"window"}}; +new Window(window);var Document=new Native({name:"Document",legacy:(Browser.Engine.trident)?null:window.Document,initialize:function(a){$uid(a);a.head=a.getElementsByTagName("head")[0]; +a.html=a.getElementsByTagName("html")[0];if(Browser.Engine.trident&&Browser.Engine.version<=4){$try(function(){a.execCommand("BackgroundImageCache",false,true); +});}if(Browser.Engine.trident){a.window.attachEvent("onunload",function(){a.window.detachEvent("onunload",arguments.callee);a.head=a.html=a.window=null; +});}return $extend(a,Document.Prototype);},afterImplement:function(b,a){document[b]=Document.Prototype[b]=a;}});Document.Prototype={$family:{name:"document"}}; +new Document(document);Array.implement({every:function(c,d){for(var b=0,a=this.length;b<a;b++){if(!c.call(d,this[b],b,this)){return false;}}return true; +},filter:function(d,e){var c=[];for(var b=0,a=this.length;b<a;b++){if(d.call(e,this[b],b,this)){c.push(this[b]);}}return c;},clean:function(){return this.filter($defined); +},indexOf:function(c,d){var a=this.length;for(var b=(d<0)?Math.max(0,a+d):d||0;b<a;b++){if(this[b]===c){return b;}}return -1;},map:function(d,e){var c=[]; +for(var b=0,a=this.length;b<a;b++){c[b]=d.call(e,this[b],b,this);}return c;},some:function(c,d){for(var b=0,a=this.length;b<a;b++){if(c.call(d,this[b],b,this)){return true; +}}return false;},associate:function(c){var d={},b=Math.min(this.length,c.length);for(var a=0;a<b;a++){d[c[a]]=this[a];}return d;},link:function(c){var a={}; +for(var e=0,b=this.length;e<b;e++){for(var d in c){if(c[d](this[e])){a[d]=this[e];delete c[d];break;}}}return a;},contains:function(a,b){return this.indexOf(a,b)!=-1; +},extend:function(c){for(var b=0,a=c.length;b<a;b++){this.push(c[b]);}return this;},getLast:function(){return(this.length)?this[this.length-1]:null;},getRandom:function(){return(this.length)?this[$random(0,this.length-1)]:null; +},include:function(a){if(!this.contains(a)){this.push(a);}return this;},combine:function(c){for(var b=0,a=c.length;b<a;b++){this.include(c[b]);}return this; +},erase:function(b){for(var a=this.length;a--;a){if(this[a]===b){this.splice(a,1);}}return this;},empty:function(){this.length=0;return this;},flatten:function(){var d=[]; +for(var b=0,a=this.length;b<a;b++){var c=$type(this[b]);if(!c){continue;}d=d.concat((c=="array"||c=="collection"||c=="arguments")?Array.flatten(this[b]):this[b]); +}return d;},hexToRgb:function(b){if(this.length!=3){return null;}var a=this.map(function(c){if(c.length==1){c+=c;}return c.toInt(16);});return(b)?a:"rgb("+a+")"; +},rgbToHex:function(d){if(this.length<3){return null;}if(this.length==4&&this[3]==0&&!d){return"transparent";}var b=[];for(var a=0;a<3;a++){var c=(this[a]-0).toString(16); +b.push((c.length==1)?"0"+c:c);}return(d)?b:"#"+b.join("");}});Function.implement({extend:function(a){for(var b in a){this[b]=a[b];}return this;},create:function(b){var a=this; +b=b||{};return function(d){var c=b.arguments;c=(c!=undefined)?$splat(c):Array.slice(arguments,(b.event)?1:0);if(b.event){c=[d||window.event].extend(c); +}var e=function(){return a.apply(b.bind||null,c);};if(b.delay){return setTimeout(e,b.delay);}if(b.periodical){return setInterval(e,b.periodical);}if(b.attempt){return $try(e); +}return e();};},run:function(a,b){return this.apply(b,$splat(a));},pass:function(a,b){return this.create({bind:b,arguments:a});},bind:function(b,a){return this.create({bind:b,arguments:a}); +},bindWithEvent:function(b,a){return this.create({bind:b,arguments:a,event:true});},attempt:function(a,b){return this.create({bind:b,arguments:a,attempt:true})(); +},delay:function(b,c,a){return this.create({bind:c,arguments:a,delay:b})();},periodical:function(c,b,a){return this.create({bind:b,arguments:a,periodical:c})(); +}});Number.implement({limit:function(b,a){return Math.min(a,Math.max(b,this));},round:function(a){a=Math.pow(10,a||0);return Math.round(this*a)/a;},times:function(b,c){for(var a=0; +a<this;a++){b.call(c,a,this);}},toFloat:function(){return parseFloat(this);},toInt:function(a){return parseInt(this,a||10);}});Number.alias("times","each"); +(function(b){var a={};b.each(function(c){if(!Number[c]){a[c]=function(){return Math[c].apply(null,[this].concat($A(arguments)));};}});Number.implement(a); +})(["abs","acos","asin","atan","atan2","ceil","cos","exp","floor","log","max","min","pow","sin","sqrt","tan"]);String.implement({test:function(a,b){return((typeof a=="string")?new RegExp(a,b):a).test(this); +},contains:function(a,b){return(b)?(b+this+b).indexOf(b+a+b)>-1:this.indexOf(a)>-1;},trim:function(){return this.replace(/^\s+|\s+$/g,"");},clean:function(){return this.replace(/\s+/g," ").trim(); +},camelCase:function(){return this.replace(/-\D/g,function(a){return a.charAt(1).toUpperCase();});},hyphenate:function(){return this.replace(/[A-Z]/g,function(a){return("-"+a.charAt(0).toLowerCase()); +});},capitalize:function(){return this.replace(/\b[a-z]/g,function(a){return a.toUpperCase();});},escapeRegExp:function(){return this.replace(/([-.*+?^${}()|[\]\/\\])/g,"\\$1"); +},toInt:function(a){return parseInt(this,a||10);},toFloat:function(){return parseFloat(this);},hexToRgb:function(b){var a=this.match(/^#?(\w{1,2})(\w{1,2})(\w{1,2})$/); +return(a)?a.slice(1).hexToRgb(b):null;},rgbToHex:function(b){var a=this.match(/\d{1,3}/g);return(a)?a.rgbToHex(b):null;},stripScripts:function(b){var a=""; +var c=this.replace(/<script[^>]*>([\s\S]*?)<\/script>/gi,function(){a+=arguments[1]+"\n";return"";});if(b===true){$exec(a);}else{if($type(b)=="function"){b(a,c); +}}return c;},substitute:function(a,b){return this.replace(b||(/\\?\{([^{}]+)\}/g),function(d,c){if(d.charAt(0)=="\\"){return d.slice(1);}return(a[c]!=undefined)?a[c]:""; +});}});Hash.implement({has:Object.prototype.hasOwnProperty,keyOf:function(b){for(var a in this){if(this.hasOwnProperty(a)&&this[a]===b){return a;}}return null; +},hasValue:function(a){return(Hash.keyOf(this,a)!==null);},extend:function(a){Hash.each(a||{},function(c,b){Hash.set(this,b,c);},this);return this;},combine:function(a){Hash.each(a||{},function(c,b){Hash.include(this,b,c); +},this);return this;},erase:function(a){if(this.hasOwnProperty(a)){delete this[a];}return this;},get:function(a){return(this.hasOwnProperty(a))?this[a]:null; +},set:function(a,b){if(!this[a]||this.hasOwnProperty(a)){this[a]=b;}return this;},empty:function(){Hash.each(this,function(b,a){delete this[a];},this); +return this;},include:function(a,b){if(this[a]==undefi... [truncated message content] |
From: <lor...@us...> - 2009-08-29 14:08:45
|
Revision: 1832 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1832&view=rev Author: lorenz_b Date: 2009-08-29 14:08:33 +0000 (Sat, 29 Aug 2009) Log Message: ----------- added graphical coverage panel made tool able to handle knowledge source change Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationManager.java trunk/src/dl-learner/org/dllearner/tools/ore/OREManager.java trunk/src/dl-learner/org/dllearner/tools/ore/RepairManager.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/CachedExplanationGenerator.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/LaconicTest.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/RootFinder.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/laconic/LaconicExplanationGenerator.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/laconic/OPlus.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/ClassesTable.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/ClassesTableModel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExplanationTable.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExplanationTableModel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/ManchesterSyntaxRenderer.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/MetricsPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/ResultTable.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/ResultTableModel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/UnsatisfiableClassesTable.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/UnsatisfiableClassesTableModel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/WizardController.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/KnowledgeSourcePanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/LearningPanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/RepairPanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/UnsatisfiableExplanationPanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/KnowledgeSourcePanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/LearningPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/RepairPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/UnsatisfiableExplanationPanel.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/tools/ore/OREManagerListener.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/GraphicalCoveragePanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/IndividualsTable.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/IndividualsTableModel.java Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationManager.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationManager.java 2009-08-25 15:57:36 UTC (rev 1831) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationManager.java 2009-08-29 14:08:33 UTC (rev 1832) @@ -24,33 +24,32 @@ import uk.ac.manchester.cs.owl.explanation.ordering.DefaultExplanationOrderer; import uk.ac.manchester.cs.owl.explanation.ordering.ExplanationTree; -public class ExplanationManager implements OWLOntologyChangeListener, RepairManagerListener{ +public class ExplanationManager implements OWLOntologyChangeListener, RepairManagerListener, OREManagerListener{ private static ExplanationManager instance; private OWLOntologyManager manager; private OWLDataFactory dataFactory; - private PelletReasonerFactory reasonerFactory; private OWLOntology ontology; private Reasoner reasoner; private RootFinder rootFinder; - private Set<OWLClass> unsatClasses; - private Set<OWLClass> rootClasses; - boolean ontologyChanged = true; - boolean isLaconicMode = false; + private boolean ontologyChanged = true; + private boolean isLaconicMode = false; private boolean isComputeAllExplanations = false; private int maxExplantionCount = 1; + private boolean allExplanationWarningChecked = false; + private List<ExplanationManagerListener> listeners; - private boolean allExplanationWarningChecked = false; + private CachedExplanationGenerator gen; private ExplanationManager(OREManager oreMan) { - + OREManager.getInstance().addListener(this); this.reasoner = oreMan.getPelletReasoner().getReasoner(); this.manager = reasoner.getManager(); this.ontology = reasoner.getLoadedOntologies().iterator().next(); @@ -59,13 +58,10 @@ // manager.addOntologyChangeListener(reasoner); dataFactory = manager.getOWLDataFactory(); RepairManager.getRepairManager(oreMan).addListener(this); - reasonerFactory = new PelletReasonerFactory(); + - rootFinder = new RootFinder(manager, reasoner, reasonerFactory); + rootFinder = new RootFinder(); - rootClasses = new HashSet<OWLClass>(); - unsatClasses = new HashSet<OWLClass>(); - listeners = new ArrayList<ExplanationManagerListener>(); gen = new CachedExplanationGenerator(ontology, reasoner); @@ -91,28 +87,14 @@ return instance; } - public Set<OWLClass> getUnsatisfiableClasses(){ - computeRootUnsatisfiableClasses(); - return unsatClasses; + public Set<OWLClass> getDerivedClasses(){ + return rootFinder.getDerivedClasses(); } public Set<OWLClass> getRootUnsatisfiableClasses(){ - computeRootUnsatisfiableClasses(); - return rootClasses; + return rootFinder.getRootClasses(); } - - private void computeRootUnsatisfiableClasses(){ - if(ontologyChanged){ - rootClasses.clear(); - unsatClasses.clear(); - unsatClasses.addAll(reasoner.getInconsistentClasses()); - rootClasses.addAll(rootFinder.getRootClasses()); - ontologyChanged = false; - } - - } - public Set<List<OWLAxiom>> getUnsatisfiableExplanations(OWLClass unsat) { OWLSubClassAxiom entailment = dataFactory.getOWLSubClassAxiom(unsat, @@ -173,7 +155,7 @@ @Override public void ontologiesChanged(List<? extends OWLOntologyChange> changes) throws OWLException { - ontologyChanged = true; + ontologyChanged = true; } public int getArity(OWLClass cl, OWLAxiom ax) { @@ -198,6 +180,10 @@ } + public boolean isLaconicMode(){ + return gen.isLaconicMode(); + } + public void setComputeAllExplanationsMode(boolean value){ isComputeAllExplanations = value; fireExplanationLimitChanged(); @@ -256,5 +242,20 @@ return allExplanationWarningChecked; } + public Set<OWLAxiom> getSourceAxioms(OWLAxiom ax){ + return gen.getSourceAxioms(ax); + } + public Set<OWLAxiom> getRemainingAxioms(OWLAxiom source, OWLAxiom part){ + return gen.getRemainingAxioms(source, part); + } + + @Override + public void activeOntologyChanged() { + ontology = OREManager.getInstance().getPelletReasoner().getOWLAPIOntologies(); + reasoner = OREManager.getInstance().getPelletReasoner().getReasoner(); + gen = new CachedExplanationGenerator(ontology, reasoner); + } + + } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/OREManager.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/OREManager.java 2009-08-25 15:57:36 UTC (rev 1831) +++ trunk/src/dl-learner/org/dllearner/tools/ore/OREManager.java 2009-08-29 14:08:33 UTC (rev 1832) @@ -5,11 +5,14 @@ import java.net.MalformedURLException; import java.net.URI; import java.net.URL; +import java.util.ArrayList; import java.util.Collection; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.SortedSet; +import java.util.TreeSet; import java.util.Vector; import javax.swing.JLabel; @@ -59,17 +62,13 @@ private int maxExecutionTimeInSeconds = 10; private int maxNrOfResults = 10; - + private List<OREManagerListener> listeners; - private OntologyModifier modifier; - - private Thread currentClassificationThread; - - public OREManager(){ cm = ComponentManager.getInstance(); + listeners = new ArrayList<OREManagerListener>(); } public static synchronized OREManager getInstance() { @@ -99,6 +98,10 @@ } + public KnowledgeSource getKnowledgeSource(){ + return ks; + } + public void setLearningProblem(){ lp = cm.learningProblem(ClassLearningProblem.class, pelletReasoner); @@ -150,30 +153,22 @@ baseURI = pelletReasoner.getBaseURI(); prefixes = pelletReasoner.getPrefixes(); modifier = new OntologyModifier(pelletReasoner); + fireActiveOntologyChanged(); } public void loadOntology(){ pelletReasoner.loadOntologies(); + } - public void classifyAsynchronously(){ - currentClassificationThread = new Thread(new Runnable() { - - @Override - public void run() { - pelletReasoner.classify(); - - } - }); + public void addListener(OREManagerListener listener){ + listeners.add(listener); } - public void killCurrentClassificationThread(){ - currentClassificationThread.stop(); - + public void removeListener(OREManagerListener listener){ + listeners.remove(listener); } - - public boolean consistentOntology() throws InconsistentOntologyException{ return pelletReasoner.isConsistent(); } @@ -182,8 +177,14 @@ return pelletReasoner; } + private void fireActiveOntologyChanged(){ + for(OREManagerListener listener : listeners){ + listener.activeOntologyChanged(); + } + } + public String getInconsistencyExplanationsString(){ ManchesterSyntaxExplanationRenderer renderer = new ManchesterSyntaxExplanationRenderer(); StringWriter buffer = new StringWriter(); @@ -239,6 +240,16 @@ } + public SortedSet<Individual> getPositiveFailureExamples(){ + SortedSet<Individual> posNotCovered = pelletReasoner.getIndividuals(currentClass2Learn); + posNotCovered.removeAll(learnedClassDescription.getCoveredInstances()); + return posNotCovered; + } + + public SortedSet<Individual> getNegativeFailureExamples(){ + return new TreeSet<Individual>(learnedClassDescription.getAdditionalInstances()); + } + public void setNoisePercentage(double noisePercentage) { this.noisePercentage = noisePercentage; } @@ -533,7 +544,7 @@ public Set<NamedClass> getComplements(Description desc, Individual ind){ Set<NamedClass> complements = new HashSet<NamedClass>(); - System.out.println(pelletReasoner.getComplementClasses(desc)); + for(NamedClass nc : pelletReasoner.getNamedClasses()){ if(!(nc.toString().endsWith("Thing"))){ if(pelletReasoner.hasType(nc, ind)){ Added: trunk/src/dl-learner/org/dllearner/tools/ore/OREManagerListener.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/OREManagerListener.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/ore/OREManagerListener.java 2009-08-29 14:08:33 UTC (rev 1832) @@ -0,0 +1,6 @@ +package org.dllearner.tools.ore; + +public interface OREManagerListener { + public abstract void activeOntologyChanged(); + +} Modified: trunk/src/dl-learner/org/dllearner/tools/ore/RepairManager.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/RepairManager.java 2009-08-25 15:57:36 UTC (rev 1831) +++ trunk/src/dl-learner/org/dllearner/tools/ore/RepairManager.java 2009-08-29 14:08:33 UTC (rev 1832) @@ -2,6 +2,7 @@ import java.util.ArrayList; import java.util.List; +import java.util.Set; import java.util.Stack; import org.mindswap.pellet.owlapi.Reasoner; @@ -68,21 +69,41 @@ fireRepairPlanChanged(); } + public void addAxioms2Remove(Set<OWLAxiom> axioms){ + axioms2Remove.addAll(axioms); + fireRepairPlanChanged(); + } + public void removeAxiom2Remove(OWLAxiom ax){ axioms2Remove.remove(ax); fireRepairPlanChanged(); } + public void removeAxioms2Remove(Set<OWLAxiom> axioms){ + axioms2Remove.removeAll(axioms); + fireRepairPlanChanged(); + } + public void addAxiom2Keep(OWLAxiom ax){ axioms2Keep.add(ax); fireRepairPlanChanged(); } + public void addAxioms2Keep(Set<OWLAxiom> axioms){ + axioms2Keep.addAll(axioms); + fireRepairPlanChanged(); + } + public void removeAxiom2Keep(OWLAxiom ax){ axioms2Keep.remove(ax); fireRepairPlanChanged(); } + public void removeAxioms2Keep(Set<OWLAxiom> axioms){ + axioms2Keep.removeAll(axioms); + fireRepairPlanChanged(); + } + public boolean isSelected(OWLAxiom ax){ return axioms2Remove.contains(ax); } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/explanation/CachedExplanationGenerator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/explanation/CachedExplanationGenerator.java 2009-08-25 15:57:36 UTC (rev 1831) +++ trunk/src/dl-learner/org/dllearner/tools/ore/explanation/CachedExplanationGenerator.java 2009-08-29 14:08:33 UTC (rev 1832) @@ -58,6 +58,10 @@ public void setComputeLaconicExplanations(boolean laconic){ laconicMode = laconic; } + + public boolean isLaconicMode(){ + return laconicMode; + } @Override public Explanation getExplanation(OWLAxiom entailment){ @@ -169,4 +173,12 @@ } } + + public Set<OWLAxiom> getSourceAxioms(OWLAxiom ax){ + return laconicExpGen.getSourceAxioms(ax); + } + + public Set<OWLAxiom> getRemainingAxioms(OWLAxiom source, OWLAxiom part){ + return laconicExpGen.getRemainingAxioms(source, part); + } } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/explanation/LaconicTest.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/explanation/LaconicTest.java 2009-08-25 15:57:36 UTC (rev 1831) +++ trunk/src/dl-learner/org/dllearner/tools/ore/explanation/LaconicTest.java 2009-08-29 14:08:33 UTC (rev 1832) @@ -170,7 +170,7 @@ Set<Explanation> preciseJusts = expGen.getExplanations(unsatAxiom); // renderer.render(unsatAxiom, preciseJusts); renderer.endRendering(); - expGen.returnSourceAxioms(preciseJusts); + } catch (OWLOntologyCreationException e) { // TODO Auto-generated catch block Modified: trunk/src/dl-learner/org/dllearner/tools/ore/explanation/RootFinder.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/explanation/RootFinder.java 2009-08-25 15:57:36 UTC (rev 1831) +++ trunk/src/dl-learner/org/dllearner/tools/ore/explanation/RootFinder.java 2009-08-29 14:08:33 UTC (rev 1832) @@ -9,6 +9,8 @@ import java.util.Map; import java.util.Set; +import org.dllearner.tools.ore.OREManager; +import org.dllearner.tools.ore.OREManagerListener; import org.mindswap.pellet.owlapi.PelletReasonerFactory; import org.semanticweb.owl.apibinding.OWLManager; import org.semanticweb.owl.inference.OWLReasoner; @@ -26,6 +28,7 @@ import org.semanticweb.owl.model.OWLDescriptionVisitor; import org.semanticweb.owl.model.OWLDisjointClassesAxiom; import org.semanticweb.owl.model.OWLEntity; +import org.semanticweb.owl.model.OWLException; import org.semanticweb.owl.model.OWLObjectAllRestriction; import org.semanticweb.owl.model.OWLObjectComplementOf; import org.semanticweb.owl.model.OWLObjectExactCardinalityRestriction; @@ -41,20 +44,28 @@ import org.semanticweb.owl.model.OWLOntology; import org.semanticweb.owl.model.OWLOntologyChange; import org.semanticweb.owl.model.OWLOntologyChangeException; +import org.semanticweb.owl.model.OWLOntologyChangeListener; import org.semanticweb.owl.model.OWLOntologyCreationException; import org.semanticweb.owl.model.OWLOntologyManager; import org.semanticweb.owl.model.OWLQuantifiedRestriction; import org.semanticweb.owl.model.RemoveAxiom; -public class RootFinder implements OWLDescriptionVisitor{ +public class RootFinder implements OWLDescriptionVisitor, OREManagerListener, OWLOntologyChangeListener{ private OWLOntologyManager manager; private OWLReasoner reasoner; private OWLReasonerFactory reasonerFactory; - private Set<OWLClass> rootClasses; + private Set<OWLClass> depend2Classes; private OWLOntology ontology; + + private Set<OWLClass> rootClasses; + private Set<OWLClass> derivedClasses; + + private boolean ontologyChanged = true; + + int depth; private Map<Integer, Set<OWLObjectAllRestriction>> depth2UniversalRestrictionPropertyMap; private Map<Integer, Set<OWLObjectPropertyExpression>> depth2ExistsRestrictionPropertyMap; @@ -62,10 +73,11 @@ private Map<OWLClass, Set<OWLClass>> child2Parents; private Map<OWLClass, Set<OWLClass>> parent2Children; - public RootFinder(OWLOntologyManager manager, OWLReasoner reasoner, OWLReasonerFactory reasonerFactory){ - this.manager = manager; - this.reasoner = reasoner; - this.reasonerFactory = reasonerFactory; + public RootFinder(){ + + this.manager = OWLManager.createOWLOntologyManager(); + this.reasoner = OREManager.getInstance().getPelletReasoner().getReasoner(); + this.reasonerFactory = new PelletReasonerFactory(); try { this.ontology = manager.createOntology(URI.create("all"), reasoner.getLoadedOntologies()); } catch (OWLOntologyCreationException e) { @@ -74,19 +86,23 @@ e.printStackTrace(); } rootClasses = new HashSet<OWLClass>(); + derivedClasses = new HashSet<OWLClass>(); depend2Classes = new HashSet<OWLClass>(); depth2UniversalRestrictionPropertyMap = new HashMap<Integer, Set<OWLObjectAllRestriction>>(); depth2ExistsRestrictionPropertyMap = new HashMap<Integer, Set<OWLObjectPropertyExpression>>(); child2Parents = new HashMap<OWLClass, Set<OWLClass>>(); parent2Children = new HashMap<OWLClass, Set<OWLClass>>(); + + OREManager.getInstance().addListener(this); + OREManager.getInstance().getPelletReasoner().getOWLOntologyManager().addOntologyChangeListener(this); } public Set<OWLClass> getRootClasses(){ - rootClasses.clear(); - computePossibleRoots(); - pruneRoots(); - rootClasses.remove(manager.getOWLDataFactory().getOWLNothing()); + if(ontologyChanged){ + computeRootDerivedClasses(); + ontologyChanged = false; + } // for(OWLClass child : child2Parents.keySet()){ // for(OWLClass par : get(child, child2Parents)){ // get(par, parent2Childs).add(child); @@ -95,9 +111,27 @@ return Collections.unmodifiableSet(rootClasses); } + public Set<OWLClass> getDerivedClasses(){ + if(ontologyChanged){ + computeRootDerivedClasses(); + ontologyChanged = false; + } + return Collections.unmodifiableSet(derivedClasses); + } + + public void computeRootDerivedClasses(){ + rootClasses.clear(); + derivedClasses.clear(); + computePossibleRoots(); + pruneRoots(); + derivedClasses.removeAll(rootClasses); + + rootClasses.remove(manager.getOWLDataFactory().getOWLNothing()); + } + private void computePossibleRoots(){ - try { - for(OWLClass cls : reasoner.getInconsistentClasses()){ + try {derivedClasses.addAll(reasoner.getInconsistentClasses()); + for(OWLClass cls : derivedClasses){ reset(); for(OWLDescription equi : cls.getEquivalentClasses(ontology)){ equi.accept(this); @@ -327,20 +361,27 @@ public void visit(OWLDataMaxCardinalityRestriction arg0) { } - public static void main(String[] args){ - try { - String file = "file:examples/ore/tambis.owl"; - OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); - OWLOntology ontology = manager.loadOntologyFromPhysicalURI(URI.create(file)); - OWLReasonerFactory factory = new PelletReasonerFactory(); - OWLReasoner reasoner = factory.createReasoner(manager); - reasoner.loadOntologies(Collections.singleton(ontology)); - RootFinder strReasoner = new RootFinder(manager, reasoner, factory); - System.out.println(strReasoner.getRootClasses()); + @Override + public void activeOntologyChanged() { + this.manager = OWLManager.createOWLOntologyManager(); + this.reasoner = OREManager.getInstance().getPelletReasoner().getReasoner(); + this.reasonerFactory = new PelletReasonerFactory(); + try { + this.ontology = manager.createOntology(URI.create("all"), reasoner.getLoadedOntologies()); } catch (OWLOntologyCreationException e) { e.printStackTrace(); - } catch (OWLReasonerException e) { + } catch (OWLOntologyChangeException e) { e.printStackTrace(); } - } + + ontologyChanged = true; + + } + + @Override + public void ontologiesChanged(List<? extends OWLOntologyChange> arg0) + throws OWLException { + ontologyChanged = true; + + } } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/explanation/laconic/LaconicExplanationGenerator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/explanation/laconic/LaconicExplanationGenerator.java 2009-08-25 15:57:36 UTC (rev 1831) +++ trunk/src/dl-learner/org/dllearner/tools/ore/explanation/laconic/LaconicExplanationGenerator.java 2009-08-29 14:08:33 UTC (rev 1832) @@ -10,10 +10,12 @@ import org.dllearner.tools.ore.explanation.Explanation; import org.dllearner.tools.ore.explanation.ExplanationException; import org.dllearner.tools.ore.explanation.PelletExplanationGenerator; +import org.mindswap.pellet.owlapi.PelletReasonerFactory; import org.semanticweb.owl.apibinding.OWLManager; import org.semanticweb.owl.inference.OWLReasonerFactory; import org.semanticweb.owl.model.OWLAxiom; import org.semanticweb.owl.model.OWLClass; +import org.semanticweb.owl.model.OWLDataFactory; import org.semanticweb.owl.model.OWLDescription; import org.semanticweb.owl.model.OWLException; import org.semanticweb.owl.model.OWLLogicalAxiom; @@ -47,7 +49,7 @@ } catch (OWLOntologyChangeException e) { e.printStackTrace(); } - + oPlus = new OPlus(manager.getOWLDataFactory()); pelletExplanation = new PelletExplanationGenerator(manager, ontologies); lastRegularExplanations = new HashSet<Explanation>(); } @@ -59,7 +61,8 @@ * @return splitted axioms */ public Set<OWLAxiom> computeOPlus(Set<OWLAxiom> axioms) { - oPlus = new OPlus(manager.getOWLDataFactory()); +// oPlus = new OPlus(manager.getOWLDataFactory()); + Set<OWLAxiom> oPlusAxioms = new HashSet<OWLAxiom>(); for(OWLAxiom ax : axioms){ @@ -270,48 +273,137 @@ return reconstituedExplanations; } - - - - public Set<Explanation> getExplanations(OWLAxiom entailment) throws ExplanationException { - Set<Explanation> explanations; - try { - explanations = computePreciseJusts(entailment, 2147483647); - } catch (OWLException e) { - throw new ExplanationException(e); + + public Set<Explanation> getExplanations(OWLAxiom entailment) + throws ExplanationException { + Set<Explanation> explanations; + try { + explanations = computePreciseJusts(entailment, 2147483647); + } catch (OWLException e) { + throw new ExplanationException(e); + } + return explanations; } - return explanations; - } - - public Set<Explanation> getExplanations(OWLAxiom entailment, int limit) - throws ExplanationException { - Set<Explanation> explanations; - try { - explanations = computePreciseJusts(entailment, limit); - } catch (OWLException e) { - throw new ExplanationException(e); + + public Set<Explanation> getExplanations(OWLAxiom entailment, int limit) + throws ExplanationException { + Set<Explanation> explanations; + try { + explanations = computePreciseJusts(entailment, limit); + } catch (OWLException e) { + throw new ExplanationException(e); + } + return explanations; } - return explanations; - } public Set<Explanation> getRegularExplanations(OWLAxiom entailment) throws ExplanationException { Set<Explanation> regularJusts; regularJusts = pelletExplanation.getExplanations((OWLAxiom)entailment); lastRegularExplanations.addAll(regularJusts); return regularJusts; - } + } - public void returnSourceAxioms(Set<Explanation> explanations){ - Map<OWLAxiom, Set<OWLAxiom>> sourceMap = oPlus.getAxiomsMap(); - System.out.println(sourceMap); - for(Explanation explanation: explanations){ - for(OWLAxiom ax : explanation.getAxioms()){ - System.out.println(ax + " gehört zu " + sourceMap.get(ax)); - + public Set<OWLAxiom> getSourceAxioms(OWLAxiom axiom){ + Map<OWLAxiom, Set<OWLAxiom>> axioms2SourceMap = oPlus.getAxiomsMap(); + Set<OWLAxiom> sourceAxioms = new HashSet<OWLAxiom>(); + + for(OWLAxiom ax : axioms2SourceMap.get(axiom)){ + if(ontology.containsAxiom(ax)){ + sourceAxioms.add(ax); } } + + return sourceAxioms; } + + public Set<OWLAxiom> getRemainingAxioms(OWLAxiom source, OWLAxiom part){ + Set<OWLAxiom> parts = computeOPlus(Collections.singleton(source));System.out.println("Parts: " + parts); + parts.remove(part);System.out.println("removed part: " + part); + for(OWLAxiom pa : parts){ + System.out.println("Part : " + pa + "has source : " + oPlus.getAxiomsMap().get(pa)); + } + + return rebuildAxioms(parts); + } + + private Set<OWLAxiom> rebuildAxioms(Set<OWLAxiom> axioms){ + Map<OWLAxiom, Set<OWLAxiom>> sourceAxioms2OPlus = new HashMap<OWLAxiom, Set<OWLAxiom>>(); + for (OWLAxiom ax : axioms) { + if (ontology.containsAxiom(ax)) { + sourceAxioms2OPlus.put(ax, computeOPlus(Collections + .singleton(ax))); + } + } + + Map<OWLClass, Map<OWLAxiom, Set<OWLSubClassAxiom>>> lhs2SubClassAxiom = new HashMap<OWLClass, Map<OWLAxiom, Set<OWLSubClassAxiom>>>(); + Set<OWLAxiom> reconstituedAxioms = new HashSet<OWLAxiom>(); + for (OWLAxiom laconicAx : axioms) {System.out.println("Laconic Axiom: "+ laconicAx); + if (laconicAx instanceof OWLSubClassAxiom) { + OWLSubClassAxiom subAx = (OWLSubClassAxiom) laconicAx; + if (subAx.getSubClass().isAnonymous()) {System.out.println(" has anomymous subclass ");System.out.println("has source axioms: " +oPlus.getAxiomsMap().get(subAx)); + reconstituedAxioms.add(subAx);System.out.println("adding to rebuildet axioms"); + } else {System.out.println("has no anonymous subclass"); + Map<OWLAxiom, Set<OWLSubClassAxiom>> source2AxiomMap = lhs2SubClassAxiom.get(subAx.getSubClass().asOWLClass()); + if (source2AxiomMap == null) { + source2AxiomMap = new HashMap<OWLAxiom, Set<OWLSubClassAxiom>>(); + lhs2SubClassAxiom.put(subAx.getSubClass().asOWLClass(), source2AxiomMap); + } + + for (OWLAxiom sourceAxiom : sourceAxioms2OPlus.keySet()) {System.out.println("source axiom: " + sourceAxiom); + if ((sourceAxioms2OPlus.get(sourceAxiom)).contains(subAx)) { + Set<OWLSubClassAxiom> subClassAxioms = source2AxiomMap.get(sourceAxiom); + if (subClassAxioms == null) { + subClassAxioms = new HashSet<OWLSubClassAxiom>(); + source2AxiomMap.put(sourceAxiom, subClassAxioms); + } + subClassAxioms.add(subAx);System.out.println("-->subclass axioms: " + subClassAxioms); + } + } + } + } else { + reconstituedAxioms.add(laconicAx); + } + } + Set<OWLAxiom> consumedAxioms = new HashSet<OWLAxiom>(); + for (OWLClass lhs : lhs2SubClassAxiom.keySet()) { + Map<OWLAxiom, Set<OWLSubClassAxiom>> source2SubClassAxiom = lhs2SubClassAxiom.get(lhs); + for (OWLAxiom source : source2SubClassAxiom.keySet()) { + Set<OWLDescription> rightHandSides = new HashSet<OWLDescription>(); + for (OWLSubClassAxiom sub : source2SubClassAxiom.get(source)) { + if (!consumedAxioms.contains(sub)) { + rightHandSides.add(sub.getSuperClass()); + consumedAxioms.add(sub); + } + } + + if (rightHandSides.size() == 1) + reconstituedAxioms.add(manager.getOWLDataFactory().getOWLSubClassAxiom((OWLDescription) lhs,((OWLDescription) rightHandSides.iterator().next()))); + else if (rightHandSides.size() > 1) { + org.semanticweb.owl.model.OWLObjectIntersectionOf conjunction = manager.getOWLDataFactory().getOWLObjectIntersectionOf(rightHandSides); + reconstituedAxioms.add(manager.getOWLDataFactory().getOWLSubClassAxiom((OWLDescription) lhs,conjunction)); + } + } + } + return reconstituedAxioms; + } + + public static void main(String[] args) throws OWLOntologyCreationException, ExplanationException{ + String baseURI = "http://protege.stanford.edu/plugins/owl/owl-library/koala.owl"; + OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); + OWLOntology ontology = manager.loadOntologyFromPhysicalURI(URI.create("file:examples/ore/koala.owl")); + OWLDataFactory factory = manager.getOWLDataFactory(); + LaconicExplanationGenerator expGen = new LaconicExplanationGenerator(manager, new PelletReasonerFactory(), Collections.singleton(ontology)); + OWLClass koalaWithPhD = factory.getOWLClass(URI.create(baseURI + "#KoalaWithPhD")); + OWLClass koala = factory.getOWLClass(URI.create(baseURI + "#Koala")); + + System.out.println(expGen.getExplanations(factory.getOWLSubClassAxiom(koalaWithPhD, factory.getOWLNothing()), 1)); + OWLAxiom laconicAx = factory.getOWLSubClassAxiom(koalaWithPhD, koala); + Set<OWLAxiom> sourceAxioms = expGen.getSourceAxioms(laconicAx); + System.out.println("Source axioms: " + sourceAxioms); + for(OWLAxiom sourceAx : sourceAxioms){ + System.out.println("Rebuildet: " + expGen.getRemainingAxioms(sourceAx, laconicAx)); + } + } - } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/explanation/laconic/OPlus.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/explanation/laconic/OPlus.java 2009-08-25 15:57:36 UTC (rev 1831) +++ trunk/src/dl-learner/org/dllearner/tools/ore/explanation/laconic/OPlus.java 2009-08-29 14:08:33 UTC (rev 1832) @@ -102,17 +102,23 @@ { for(OWLAxiom axiom : axioms){ - - if(!axiom.equals(source)) + Set<OWLAxiom> existing = (Set<OWLAxiom>)axiomsMap.get(axiom); + if(existing == null) { - Set<OWLAxiom> existing = (Set<OWLAxiom>)axiomsMap.get(axiom); - if(existing == null) - { - existing = new HashSet<OWLAxiom>(); - axiomsMap.put(axiom, existing); - } - existing.add(source); + existing = new HashSet<OWLAxiom>(); + axiomsMap.put(axiom, existing); } + existing.add(source); +// if(!axiom.equals(source)) +// { +// Set<OWLAxiom> existing = (Set<OWLAxiom>)axiomsMap.get(axiom); +// if(existing == null) +// { +// existing = new HashSet<OWLAxiom>(); +// axiomsMap.put(axiom, existing); +// } +// existing.add(source); +// } } return axioms; } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ui/ClassesTable.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ui/ClassesTable.java 2009-08-25 15:57:36 UTC (rev 1831) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/ClassesTable.java 2009-08-29 14:08:33 UTC (rev 1832) @@ -1,6 +1,7 @@ package org.dllearner.tools.ore.ui; import java.awt.Color; +import java.awt.event.MouseEvent; import java.util.Set; import javax.swing.ListSelectionModel; @@ -28,6 +29,20 @@ setGridColor(Color.LIGHT_GRAY); } + @Override + public String getToolTipText(MouseEvent e){ + String tip = null; + java.awt.Point p = e.getPoint(); + int rowIndex = rowAtPoint(p); + if(rowIndex != -1){ + tip = getValueAt(rowIndex, 0).toString(); + + } else { + tip = super.getToolTipText(e); + } + return tip; + } + public void clear(){ ((ClassesTableModel)getModel()).clear(); } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ui/ClassesTableModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ui/ClassesTableModel.java 2009-08-25 15:57:36 UTC (rev 1831) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/ClassesTableModel.java 2009-08-29 14:08:33 UTC (rev 1832) @@ -33,11 +33,7 @@ @Override public Object getValueAt(int rowIndex, int columnIndex) { - if(rowIndex >= 0){ return classes.get(rowIndex); - } else { - return ""; - } } public void clear(){ Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExplanationTable.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExplanationTable.java 2009-08-25 15:57:36 UTC (rev 1831) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExplanationTable.java 2009-08-29 14:08:33 UTC (rev 1832) @@ -53,7 +53,9 @@ column4.setCellEditor(new ButtonCellEditor()); column4.setResizable(false); setRowHeight(getRowHeight() + 4); - setColumnSizes(); + getColumn(1).setMaxWidth(30); + getColumn(2).setMaxWidth(30); + getColumn(3).setMaxWidth(80); getSelectionModel().addListSelectionListener( new ListSelectionListener() { @@ -109,13 +111,6 @@ }); } - - private void setColumnSizes(){ - getColumn(1).setMaxWidth(30); - getColumn(2).setMaxWidth(30); - getColumn(3).setMaxWidth(80); - } - private void changeSelection() { } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExplanationTableModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExplanationTableModel.java 2009-08-25 15:57:36 UTC (rev 1831) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExplanationTableModel.java 2009-08-29 14:08:33 UTC (rev 1832) @@ -68,7 +68,15 @@ impMan.removeAxiomFromImpactList(ax); } else { impMan.addAxiom2ImpactList(ax); - repMan.addAxiom2Remove(ax); + if(expMan.isLaconicMode()){ + for(OWLAxiom source : expMan.getSourceAxioms(ax)){ + repMan.addAxiom2Remove(source); + repMan.addAxioms2Keep(expMan.getRemainingAxioms(source, ax)); + } + } else { + repMan.addAxiom2Remove(ax); + } + } } super.setValueAt(value, rowIndex, columnIndex); Added: trunk/src/dl-learner/org/dllearner/tools/ore/ui/GraphicalCoveragePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ui/GraphicalCoveragePanel.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/GraphicalCoveragePanel.java 2009-08-29 14:08:33 UTC (rev 1832) @@ -0,0 +1,766 @@ +/** + * Copyright (C) 2007-2009, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ +package org.dllearner.tools.ore.ui; + +import java.awt.AlphaComposite; +import java.awt.Color; +import java.awt.Composite; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionListener; +import java.awt.geom.Ellipse2D; +import java.util.Random; +import java.util.Set; +import java.util.Vector; + +import javax.swing.JPanel; + +import org.dllearner.core.EvaluatedDescription; +import org.dllearner.core.owl.Individual; +import org.dllearner.learningproblems.EvaluatedDescriptionClass; +import org.dllearner.tools.ore.OREManager; +import org.dllearner.tools.protege.IndividualPoint; + + +/** + * This class draws the graphical coverage of a learned concept. + * + * @author Christian Koetteritzsch + * + */ +public class GraphicalCoveragePanel extends JPanel implements MouseMotionListener{ + + private static final long serialVersionUID = 855436961912515267L; + private static final int HEIGHT = 200; + private static final int WIDTH = 200; + private static final int ELLIPSE_X_AXIS = 30; + private static final int ELLIPSE_Y_AXIS = 30; + private static final int MAX_NUMBER_OF_INDIVIDUAL_POINTS = 20; + private static final int PLUS_SIZE = 5; + private static final int SUBSTRING_SIZE = 25; + private static final int SPACE_SIZE = 7; + private static final int MAX_RANDOM_NUMBER = 300; + + + private int shiftXAxis; + private int distortionOld; + private Ellipse2D oldConcept; + private Ellipse2D newConcept; + + private EvaluatedDescription eval; + + private String conceptNew; + private final Vector<IndividualPoint> posCovIndVector; + private final Vector<IndividualPoint> posNotCovIndVector; + private final Vector<IndividualPoint> additionalIndividuals; + private final Vector<IndividualPoint> points; + private final Vector<String> conceptVector; + + private int adjustment; + private int shiftOldConcept; + private int shiftNewConcept; + private int shiftNewConceptX; + private int shiftCovered; + private int coveredIndividualSize; + private int additionalIndividualSize; + private int x1; + private int x2; + private int y1; + private int y2; + private int centerX; + private int centerY; + private final Random random; + private final Color darkGreen; + private final Color darkRed; + private int notCoveredInd; + + + /** + * + * This is the constructor for the GraphicalCoveragePanel. + * + * @param desc + * EvaluatedDescription + * @param m + * DLLearnerModel + * @param concept + * String + * @param p + * MoreDetailForSuggestedConceptsPanel + */ + public GraphicalCoveragePanel( String concept) { + + + this.setPreferredSize(new Dimension(540, 260)); + + this.repaint(); + darkGreen = new Color(0, 100, 0); + darkRed = new Color(205, 0, 0); + random = new Random(); + conceptNew = concept; + conceptVector = new Vector<String>(); + posCovIndVector = new Vector<IndividualPoint>(); + posNotCovIndVector = new Vector<IndividualPoint>(); + additionalIndividuals = new Vector<IndividualPoint>(); + points = new Vector<IndividualPoint>(); + + + + oldConcept = new Ellipse2D.Double(ELLIPSE_X_AXIS, + ELLIPSE_Y_AXIS, WIDTH, HEIGHT); + newConcept = new Ellipse2D.Double(0, 0, 0, 0); + addMouseMotionListener(this); +// this.computeIndividualPoints(); + + } + + @Override + protected void paintComponent(Graphics g) { + + Graphics2D g2D; + g2D = (Graphics2D) g; + Composite original = g2D.getComposite(); + AlphaComposite ac = AlphaComposite.getInstance( + AlphaComposite.SRC_OVER, 0.5f); + g2D.setColor(Color.BLACK); + g2D.drawString(OREManager.getInstance().getCurrentClass2Learn() + .toString(), 320, 10); + g2D.setColor(Color.ORANGE); + g2D.fillOval(310, 20, 9, 9); + g2D.setColor(Color.black); + int p = 30; + + g2D.setColor(darkGreen); + Ellipse2D circlePoint = new Ellipse2D.Double(315 - 1, p - 6, 4, 4); + g2D.fill(circlePoint); + g2D.setColor(Color.BLACK); + g2D.drawString("individuals covered by", 320, p); + g2D.setColor(Color.ORANGE); + g2D.fillOval(455, p - 9, 9, 9); + g2D.setColor(Color.BLACK); + g2D.drawString("and", 485, p); + g2D.setColor(Color.YELLOW); + g2D.fillOval(525, p - 9, 9, 9); + g2D.setColor(Color.BLACK); + p = p + 20; + g2D.drawString("(OK)", 320, p); + p = p + 20; + + g2D.setColor(darkRed); + Ellipse2D circlePoint2 = new Ellipse2D.Double(315 - 1, p - 6, 4, 4); + g2D.fill(circlePoint2); + g2D.setColor(Color.BLACK); + g2D.drawString("individuals covered by", 320, p); + g2D.setColor(Color.ORANGE); + g2D.fillOval(455, p - 9, 9, 9); + g2D.setColor(Color.BLACK); + p = p + 20; + g2D.drawString("(potential problem)", 320, p); + p = p + 20; + g2D.setColor(darkRed); + Ellipse2D circlePoint3 = new Ellipse2D.Double(315 - 1, p - 6, 4, 4); + g2D.fill(circlePoint3); + g2D.setColor(Color.BLACK); + g2D.drawString("individuals covered by", 320, p); + g2D.setColor(Color.YELLOW); + g2D.fillOval(455, p - 9, 9, 9); + g2D.setColor(Color.BLACK); + p = p + 20; + g2D.drawString("(potential problem)", 320, p); + + g2D.setColor(Color.YELLOW); + g2D.fill(oldConcept); + g2D.fillOval(310, 0, 9, 9); + g2D.setColor(Color.ORANGE); + g2D.setComposite(ac); + g2D.fill(newConcept); + g2D.setColor(Color.BLACK); + for (int i = 0; i < posCovIndVector.size(); i++) { + g2D.setColor(darkGreen); + g2D.fill(posCovIndVector.get(i).getIndividualPoint()); + } + + for (int i = 0; i < posNotCovIndVector.size(); i++) { + g2D.setColor(darkRed); + g2D.fill(posNotCovIndVector.get(i).getIndividualPoint()); + } + + for (int i = 0; i < additionalIndividuals.size(); i++) { + g2D.setColor(Color.BLACK); + g2D.fill(additionalIndividuals.get(i).getIndividualPoint()); + } + + if(eval != null){ + // Plus 1 + if (coveredIndividualSize != OREManager.getInstance() + .getPelletReasoner().getIndividuals( + OREManager.getInstance().getCurrentClass2Learn()) + .size() + && notCoveredInd != 0) { + g2D.drawLine(x1 - 1 - shiftOldConcept, y1 - 1, x2 + 1 + - shiftOldConcept, y1 - 1); + g2D.drawLine(x1 - shiftOldConcept, centerY - 1, x2 + - shiftOldConcept, centerY - 1); + g2D.drawLine(x1 - shiftOldConcept, centerY, x2 + - shiftOldConcept, centerY); + g2D.drawLine(x1 - shiftOldConcept, centerY + 1, x2 + - shiftOldConcept, centerY + 1); + g2D.drawLine(x1 - 1 - shiftOldConcept, y2 + 1, x2 + 1 + - shiftOldConcept, y2 + 1); + + g2D.drawLine(x1 - 1 - shiftOldConcept, y1 - 1, x1 - 1 + - shiftOldConcept, y2 + 1); + g2D.drawLine(centerX - 1 - shiftOldConcept, y1, centerX - 1 + - shiftOldConcept, y2); + g2D.drawLine(centerX - shiftOldConcept, y1, centerX + - shiftOldConcept, y2); + g2D.drawLine(centerX + 1 - shiftOldConcept, y1, centerX + 1 + - shiftOldConcept, y2); + g2D.drawLine(x2 + 1 - shiftOldConcept, y1 - 1, x2 + 1 + - shiftOldConcept, y2 + 1); + } + // Plus 2 + + g2D.drawLine(x1 - 1 + shiftCovered, y1 - 1, x2 + 1 + shiftCovered, + y1 - 1); + g2D.drawLine(x1 + shiftCovered, centerY - 1, x2 + shiftCovered, + centerY - 1); + g2D + .drawLine(x1 + shiftCovered, centerY, x2 + shiftCovered, + centerY); + g2D.drawLine(x1 + shiftCovered, centerY + 1, x2 + shiftCovered, + centerY + 1); + g2D.drawLine(x1 - 1 + shiftCovered, y2 + 1, x2 + 1 + shiftCovered, + y2 + 1); + + g2D.drawLine(x1 - 1 + shiftCovered, y1 - 1, x1 - 1 + shiftCovered, + y2 + 1); + g2D.drawLine(centerX - 1 + shiftCovered, y1, centerX - 1 + + shiftCovered, y2); + g2D + .drawLine(centerX + shiftCovered, y1, centerX + + shiftCovered, y2); + g2D.drawLine(centerX + 1 + shiftCovered, y1, centerX + 1 + + shiftCovered, y2); + g2D.drawLine(x2 + 1 + shiftCovered, y1 - 1, x2 + 1 + shiftCovered, + y2 + 1); + + // Plus 3 + if (coveredIndividualSize != OREManager.getInstance() + .getPelletReasoner().getIndividuals( + OREManager.getInstance().getCurrentClass2Learn()) + .size() + && ((EvaluatedDescriptionClass) eval) + .getAdditionalInstances().size() != 0) { + g2D.drawLine(x1 - 1 + shiftNewConcept, y1 - 1, x2 + 1 + + shiftNewConcept, y1 - 1); + g2D.drawLine(x1 + shiftNewConcept, centerY - 1, x2 + + shiftNewConcept, centerY - 1); + g2D.drawLine(x1 + shiftNewConcept, centerY, x2 + + shiftNewConcept, centerY); + g2D.drawLine(x1 + shiftNewConcept, centerY + 1, x2 + + shiftNewConcept, centerY + 1); + g2D.drawLine(x1 - 1 + shiftNewConcept, y2 + 1, x2 + 1 + + shiftNewConcept, y2 + 1); + + g2D.drawLine(x1 - 1 + shiftNewConcept, y1 - 1, x1 - 1 + + shiftNewConcept, y2 + 1); + g2D.drawLine(centerX - 1 + shiftNewConcept, y1, centerX - 1 + + shiftNewConcept, y2); + g2D.drawLine(centerX + shiftNewConcept, y1, centerX + + shiftNewConcept, y2); + g2D.drawLine(centerX + 1 + shiftNewConcept, y1, centerX + 1 + + shiftNewConcept, y2); + g2D.drawLine(x2 + 1 + shiftNewConcept, y1 - 1, x2 + 1 + + shiftNewConcept, y2 + 1); + } + // Plus 4 + if (((EvaluatedDescriptionClass) eval).getAddition() != 1.0 + && ((EvaluatedDescriptionClass) eval).getCoverage() == 1.0) { + g2D.drawLine(x1 - 1 + shiftNewConceptX, y1 - 1 + + shiftNewConcept, x2 + 1 + shiftNewConceptX, y1 - 1 + + shiftNewConcept); + g2D.drawLine(x1 + shiftNewConceptX, centerY - 1 + + shiftNewConcept, x2 + shiftNewConceptX, centerY - 1 + + shiftNewConcept); + g2D.drawLine(x1 + shiftNewConceptX, centerY + shiftNewConcept, + x2 + shiftNewConceptX, centerY + shiftNewConcept); + g2D.drawLine(x1 + shiftNewConceptX, centerY + 1 + + shiftNewConcept, x2 + shiftNewConceptX, centerY + 1 + + shiftNewConcept); + g2D.drawLine(x1 - 1 + shiftNewConceptX, y2 + 1 + + shiftNewConcept, x2 + 1 + shiftNewConceptX, y2 + 1 + + shiftNewConcept); + + g2D.drawLine(x1 - 1 + shiftNewConceptX, y1 - 1 + + shiftNewConcept, x1 - 1 + shiftNewConceptX, y2 + 1 + + shiftNewConcept); + g2D.drawLine(centerX - 1 + shiftNewConceptX, y1 + + shiftNewConcept, centerX - 1 + shiftNewConceptX, y2 + + shiftNewConcept); + g2D.drawLine(centerX + shiftNewConceptX, y1 + shiftNewConcept, + centerX + shiftNewConceptX, y2 + shiftNewConcept); + g2D.drawLine(centerX + 1 + shiftNewConceptX, y1 + + shiftNewConcept, centerX + 1 + shiftNewConceptX, y2 + + shiftNewConcept); + g2D.drawLine(x2 + 1 + shiftNewConceptX, y1 - 1 + + shiftNewConcept, x2 + 1 + shiftNewConceptX, y2 + 1 + + shiftNewConcept); + } + } +// +// for (int i = 0; i < posCovIndVector.size(); i++) { +// g2D.setColor(darkGreen); +// g2D.fill(posCovIndVector.get(i).getIndividualPoint()); +// } +// +// for (int i = 0; i < posNotCovIndVector.size(); i++) { +// g2D.setColor(darkRed); +// g2D.fill(posNotCovIndVector.get(i).getIndividualPoint()); +// } +// +// for (int i = 0; i < additionalIndividuals.size(); i++) { +// g2D.setColor(Color.BLACK); +// g2D.fill(additionalIndividuals.get(i).getIndividualPoint()); +// } +// if (!((EvaluatedDescriptionClass) eval).isConsistent()) { +// g2D.setComposite(original); +// g2D.setColor(darkRed); +// g2D +// .drawString( +// "Adding this class expression may lead to an inconsistent ontology.", +// 0, 220); +// } +// if (eval.getAccuracy() == 1.0) { +// g2D.setComposite(original); +// g2D.setColor(Color.ORANGE); +// g2D.fillOval(0, 211, 9, 9); +// g2D.setColor(darkRed); +// g2D.drawString("and", 25, 220); +// g2D.setColor(Color.YELLOW); +// g2D.fillOval(65, 211, 9, 9); +// g2D.setColor(darkRed); +// g2D.drawString("cover the same instances.", 95, 220); +// } + +// } + getParent().repaint(); + } + + private void computeGraphics() { + if (eval != null) { + this.setVisible(true); + getParent().repaint(); + additionalIndividualSize = ((EvaluatedDescriptionClass) eval) + .getAdditionalInstances().size(); + distortionOld = 0; + adjustment = 0; + Ellipse2D old = new Ellipse2D.Double(ELLIPSE_X_AXIS, ELLIPSE_Y_AXIS, + WIDTH, HEIGHT); + x1 = (int) old.getCenterX() - PLUS_SIZE; + x2 = (int) old.getCenterX() + PLUS_SIZE; + y1 = (int) old.getCenterY() - PLUS_SIZE; + y2 = (int) old.getCenterY() + PLUS_SIZE; + centerX = (int) old.getCenterX(); + centerY = (int) old.getCenterY(); + double coverage = ((EvaluatedDescriptionClass) eval).getCoverage(); + shiftXAxis = (int) Math.round((WIDTH) * (1 - coverage)); + + if (additionalIndividualSize != 0 && ((EvaluatedDescriptionClass) eval).getCoverage() == 1.0 && ((EvaluatedDescriptionClass) eval).getAddition() < 1.0) { + distortionOld = (int) Math.round((WIDTH) * 0.3); + Ellipse2D newer = new Ellipse2D.Double(ELLIPSE_X_AXIS + shiftXAxis, + ELLIPSE_Y_AXIS, (WIDTH), HEIGHT); + adjustment = (int) Math.round(newer.getCenterY() / 4); + } + this.renderPlus(); + } + } + + private void renderPlus() { + if (eval != null) { + coveredIndividualSize = ((EvaluatedDescriptionClass) eval) + .getCoveredInstances().size(); + double newConcepts = ((EvaluatedDescriptionClass) eval) + .getAddition(); + double oldConcepts = ((EvaluatedDescriptionClass) eval) + .getCoverage(); + shiftNewConcept = 0; + shiftOldConcept = 0; + shiftNewConceptX = 0; + shiftCovered = 0; + if (coveredIndividualSize == 0) { + shiftNewConcept = (int) Math.round(((WIDTH) / 2.0) * newConcepts); + } else if (additionalIndividualSize != coveredIndividualSize) { + shiftNewConcept = (int) Math.round(((WIDTH) / 2.0) + * (1.0 + (1.0 - oldConcepts))); + shiftOldConcept = (int) Math.round(((WIDTH) / 2.0) * oldConcepts); + shiftCovered = (int) Math.round(((WIDTH) / 2.0) + * (1 - oldConcepts)); + } + if (((EvaluatedDescriptionClass) eval).getAddition() != 1.0 && ((EvaluatedDescriptionClass) eval) + .getCoverage() == 1.0) { + shiftCovered = (int) Math.round(((WIDTH) / 2.0) * 0.625); + shiftNewConceptX = shiftCovered; + shiftNewConcept = 2 * shiftNewConceptX; + } + } + + int i = conceptNew.length(); + while (i > 0) { + int sub = 0; + String subString = ""; + if(conceptNew.contains(" ")) { + sub = conceptNew.indexOf(" "); + subString = conceptNew.substring(0, sub) + " "; + conceptNew = conceptNew.replace(conceptNew.substring(0, sub + 1), + ""); + } else { + subString = conceptNew; + conceptNew = ""; + } + while (sub < SUBSTRING_SIZE) { + if (conceptNew.length() > 0 && conceptNew.contains(" ")) { + sub = conceptNew.indexOf(" "); + if (subString.length() + sub < SUBSTRING_SIZE) { + subString = subString + conceptNew.substring(0, sub) + + " "; + conceptNew = conceptNew.replace(conceptNew.substring(0, + sub + 1), ""); + sub = subString.length(); + } else { + break; + } + } else { + if (subString.length() + conceptNew.length() > SUBSTRING_SIZE + + SPACE_SIZE) { + conceptVector.add(subString); + subString = conceptNew; + conceptNew = ""; + break; + } else { + subString = subString + conceptNew; + conceptNew = ""; + break; + } + } + } + conceptVector.add(subString); + i = conceptNew.length(); + } + } + + public void setNewClassDescription(EvaluatedDescription desc) { + this.eval = desc; + + + boolean hasAdditional = !((EvaluatedDescriptionClass) eval).getAdditionalInstances().isEmpty(); + boolean allPosCovered = ((EvaluatedDescriptionClass) eval).getCoverage() == 1.0; + + if (allPosCovered && hasAdditional) { + newConcept = new Ellipse2D.Double(ELLIPSE_X_AXIS -25 + , ELLIPSE_Y_AXIS -25, WIDTH + 50, + HEIGHT + 50); + + + } else if(!allPosCovered && hasAdditional){ + newConcept = new Ellipse2D.Double(ELLIPSE_X_AXIS + 20 + , ELLIPSE_Y_AXIS, WIDTH, + HEIGHT); + } else if(allPosCovered && !hasAdditional){ + newConcept = new Ellipse2D.Double(ELLIPSE_X_AXIS + , ELLIPSE_Y_AXIS, WIDTH, + HEIGHT); + } else if(!allPosCovered && !hasAdditional){ + newConcept = new Ellipse2D.Double(ELLIPSE_X_AXIS + 20 + , ELLIPSE_Y_AXIS, WIDTH - 20, + HEIGHT); + } +// computeGraphics(); + computeIndividualPoints(); + + getParent().repaint(); + + } + + + + public void computeIndividualPoints() { + posCovIndVector.clear(); + posNotCovIndVector.clear(); + additionalIndividuals.clear(); + points.clear(); + + if (eval != null) { + Set<Individual> posInd = ((EvaluatedDescriptionClass) eval) + .getCoveredInstances(); + int i = 0; + double x = random.nextInt(MAX_RANDOM_NUMBER); + double y = random.nextInt(MAX_RANDOM_NUMBER); + boolean flag = true; + for (Individual ind : posInd) { + flag = true; + if (i < MAX_NUMBER_OF_INDIVIDUAL_POINTS) { + while (flag) { + if (newConcept.contains(x, y) + && oldConcept.contains(x, y) + && !(x >= this.getX1() + this.getShiftCovered() + && x <= this.getX2() + + this.getShiftCovered() + && y >= this.getY1() && y <= this + .getY2())) { + + posCovIndVector.add(new IndividualPoint("*", + (int) x, (int) y, ind.toString())); + + i++; + flag = false; + + x = random.nextInt(MAX_RANDOM_NUMBER); + y = random.nextInt(MAX_RANDOM_NUMBER); + break; + } else { + x = random.nextInt(MAX_RANDOM_NUMBER); + y = random.nextInt(MAX_RANDOM_NUMBER); + } + + } + } + } + + Set<Individual> posNotCovInd = ((EvaluatedDescriptionClass) eval) + .getAdditionalInstances(); + int j = 0; + x = random.nextInt(MAX_RANDOM_NUMBER); + y = random.nextInt(MAX_RANDOM_NUMBER); + for (Individual ind : posNotCovInd) { + flag = true; + if (j < MAX_NUMBER_OF_INDIVIDUAL_POINTS) { + while (flag) { + if (!oldConcept.contains(x, y) + && newConcept.contains(x, y) + && !(x >= this.getX1() + + this.getShiftNewConcept() + && x <= this.getX2() + + this.getShiftNewConcept() + && y >= this.getY1() && y <= this + .getY2()) + && !(x >= this.getX1() + + this.getShiftNewConceptX() + && x <= this.getX2() + + this.getShiftNewConceptX() + && y >= this.getY1() + + this.getShiftNewConcept() && y <= this + .getY2() + + this.getShiftNewConcept())) { + + + posNotCovIndVector.add(new IndividualPoint("*", + (int) x, (int) y, ind.toString())); + + + j++; + flag = false; + x = random.nextInt(MAX_RANDOM_NUMBER); + y = random.nextInt(MAX_RANDOM_NUMBER); + break; + } else { + x = random.nextInt(MAX_RANDOM_NUMBER); + y = random.nextInt(MAX_RANDOM_NUMBER); + } + + } + } + } + + Set<Individual> notCovInd = OREManager.getInstance().getPositiveFailureExamples(); + + notCoveredInd = notCovInd.size(); + int k = 0; + x = random.nextInt(MAX_RANDOM_NUMBER); + y = random.nextInt(MAX_RANDOM_NUMBER); + for (Individual ind : notCovInd) { + flag = true; + if (k < MAX_NUMBER_OF_INDIVIDUAL_POINTS) { + while (flag) { + if (oldConcept.contains(x, y) + && !newConcept.contains(x, y) + && !(x >= this.getX1() + - this.getShiftOldConcept() + && x <= this.getX2() + - this.getShiftOldConcept() + && y >= this.getY1() && y <= this + .getY2())) { + + posNotCovIndVector.add(new IndividualPoint("*", + (int) x, (int) y, ind.toString())); + + k++; + flag = false; + x = random.nextInt(MAX_RANDOM_NUMBER); + y = random.nextInt(MAX_RANDOM_NUMBER); + break; + } else { + x = random.nextInt(MAX_RANDOM_NUMBER); + y = random.nextInt(MAX_RANDOM_NUMBER); + } + + } + } + } + points.addAll(posCovIndVector); + points.addAll(posNotCovIndVector); + points.addAll(additionalIndividuals); + } + } + + /** + * This method returns a Vector of all individuals that are drawn in the + * panel. + * + * @return Vector of Individuals + */ + public Vector<IndividualPoint> getIndividualVector() { + return points; + } + + /** + * This method returns the GraphicalCoveragePanel. + * + * @return GraphicalCoveragePanel + */ + public GraphicalCoveragePanel getGraphicalCoveragePanel() { + return this; + } + + + + /** + * Returns the min. x value of the plus. + * + * @return int min X Value + */ + public int getX1() { + return x1; + } + + /** + * Returns the max. x value of the plus. + * + * @return int max X Value + */ + public int getX2() { + return x2; + } + + /** + * Returns the min. y value of the plus. + * + * @return int min Y Value + */ + public int getY1() { + return y1; + } + + /** + * Returns the max. y value of the plus. + * + * @return int max Y Value + */ + public int getY2() { + return y2; + } + + /** + * This method returns how much the old concept must be shifted. + * @return shift of the old concept + */ + public int getShiftOldConcept() { + return shiftOldConcept; + } + + /** + * This method returns how much the plus in the middle must be shifted. + * @return shift of the middle plus + */ + public int getShiftCovered() { + return shiftCovered; + } + + /** + * This method returns how much the new concept must be shifted. + * @return shift of the new concept + */ + public int getShiftNewConcept() { + return shiftNewConcept; + } + + /** + * This method returns how much the new concept must be shifted. + * @return shift of the new concept + */ + public int getShiftNewConceptX() { + return shiftNewConceptX; + } + + /** + * Unsets the panel after plugin is closed. + */ + public void unsetPanel() { + this.removeAll(); + eval = null; + } + + /** + * Returns the currently selected evaluated description. + * + * @return EvaluatedDescription + */ + public EvaluatedDescription getEvaluateddescription() { + return eval; + } + + @Override + public void mouseDragged(MouseEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void mouseMoved(MouseEvent e) { + double x = e.getPoint().getX(); + double y = e.getPoint().getY(); + String toolTip = null; + for(IndividualPoint point : points){ + if(Math.abs(point.getIndividualPoint().getCenterX() - x) <= 8 + && Math.abs(point.getIndividualPoint().getCenterY() - y) <= 8 ){ + toolTip = point.getIndividualName(); + break; + + } + + } + setToolTipText(toolTip); + + + } + +} Added: trunk/src/dl-learner/org/dllearner/tools/ore/ui/IndividualsTable.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ui/IndividualsTable.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/IndividualsTable.java 2009-08-29 14:08:33 UTC (rev 1832) @@ -0,0 +1,56 @@ +package org.dllearner.tools.ore.ui; + +import java.awt.Color; +import java.awt.event.MouseEvent; +import java.util.Set; + +import javax.swing.ListSelectionModel; + +import org.dllearner.core.owl.Individual; +import org.jdesktop.swingx.JXTable; +import org.jdesktop.swingx.decorator.HighlighterFactory; + +public class IndividualsTable extends JXTable { + + /** + * + */ + private static final long serialVersionUID = 6874941283913237464L; + + public IndividualsTable(){ + super(new IndividualsTableModel()); + setBackground(Color.WHITE); + setHighlighters(HighlighterFactory.createAlternateStriping()); + setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + setEditable(false); + setTableHeader(null); + setGridColor(Color.LIGHT_GRAY); + getColumn(0).setCellRenderer(new ManchesterSyntaxTableCellRenderer()); + } + + @Override + public String getToolTipText(MouseEvent e){ + String tip = null; + java.awt.Point p = e.getPoint(); + int rowIndex = rowAtPoint(p); + if(rowIndex != -1){ + tip = getValueAt(rowIndex, 0).toString(); + + } else { + tip = super.getToolTipText(e); + } + return tip; + } + + public void addIndividuals(Set<Individual> individuals){ + ((IndividualsTableModel)getModel()).addIndividuals(individuals); + } + + public void removeIndividual(Individual ind){ + ((IndividualsTableModel)getModel()).removeIndividual(ind); + } + + public Individual getSelectedIndividual(){ + return ((IndividualsTableModel)getModel()).getSelectedIndividual(getSelectedRow()); + } +} Added: trunk/src/dl-learner/org/dllearner/tools/ore/ui/IndividualsTableModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ui/IndividualsTableModel.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/IndividualsTableModel.java 2009-08-29 14:08:33 UTC (rev 1832) @@ -0... [truncated message content] |
From: <lor...@us...> - 2009-08-25 15:57:54
|
Revision: 1831 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1831&view=rev Author: lorenz_b Date: 2009-08-25 15:57:36 +0000 (Tue, 25 Aug 2009) Log Message: ----------- some changes in UI added option to add axiom in lost entailments list to repair plan Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationManager.java trunk/src/dl-learner/org/dllearner/tools/ore/ImpactManager.java trunk/src/dl-learner/org/dllearner/tools/ore/RepairManager.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/CachedExplanationGenerator.java trunk/src/dl-learner/org/dllearner/tools/ore/recent.txt trunk/src/dl-learner/org/dllearner/tools/ore/ui/DescriptionLabel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExplanationTable.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExplanationTableModel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/ImpactTable.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/ImpactTableModel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/ManchesterSyntaxTableCellRenderer.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/MouseOverHintDemo.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/RepairTable.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/RepairTableModel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/StatusBarSimulator.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/UnsatisfiableClassesTableModel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/InconsistencyExplanationPanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/KnowledgeSourcePanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/UnsatisfiableExplanationPanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/InconsistencyExplanationPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/KnowledgeSourcePanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/RepairPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/RepairPlanPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/UnsatisfiableExplanationPanel.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/tools/ore/MouseOverHintManager.java trunk/src/dl-learner/org/dllearner/tools/ore/RecentManager.java trunk/src/dl-learner/org/dllearner/tools/ore/minus.png trunk/src/dl-learner/org/dllearner/tools/ore/plus.png trunk/src/dl-learner/org/dllearner/tools/ore/ui/ManchesterSyntaxRenderer.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/RepairTableCellRenderer.java Removed Paths: ------------- trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ORE.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/ColorListCellRenderer.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/MouseOverHintManager.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/RecentManager.java Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationManager.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationManager.java 2009-08-24 13:27:45 UTC (rev 1830) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationManager.java 2009-08-25 15:57:36 UTC (rev 1831) @@ -49,16 +49,16 @@ private CachedExplanationGenerator gen; - private ExplanationManager(Reasoner reasoner) { + private ExplanationManager(OREManager oreMan) { - this.reasoner = reasoner; + this.reasoner = oreMan.getPelletReasoner().getReasoner(); this.manager = reasoner.getManager(); this.ontology = reasoner.getLoadedOntologies().iterator().next(); manager.addOntologyChangeListener(this); // manager.addOntologyChangeListener(reasoner); dataFactory = manager.getOWLDataFactory(); - RepairManager.getRepairManager(reasoner).addListener(this); + RepairManager.getRepairManager(oreMan).addListener(this); reasonerFactory = new PelletReasonerFactory(); rootFinder = new RootFinder(manager, reasoner, reasonerFactory); @@ -77,9 +77,9 @@ } public static synchronized ExplanationManager getInstance( - Reasoner reasoner) { + OREManager oreMan) { if (instance == null) { - instance = new ExplanationManager(reasoner); + instance = new ExplanationManager(oreMan); } return instance; } Deleted: trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationPanel.java 2009-08-24 13:27:45 UTC (rev 1830) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationPanel.java 2009-08-25 15:57:36 UTC (rev 1831) @@ -1,427 +0,0 @@ -package org.dllearner.tools.ore; - -import java.awt.BorderLayout; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.GridLayout; -import java.awt.HeadlessException; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import java.net.URI; -import java.util.Collections; -import java.util.List; -import java.util.Set; -import java.util.TreeSet; - -import javax.swing.BorderFactory; -import javax.swing.Box; -import javax.swing.ButtonGroup; -import javax.swing.DefaultListModel; -import javax.swing.JComponent; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JRadioButton; -import javax.swing.JScrollPane; -import javax.swing.JSeparator; -import javax.swing.JSplitPane; -import javax.swing.UIManager; -import javax.swing.UnsupportedLookAndFeelException; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; - -import org.dllearner.tools.ore.ui.ClassificationProgressMonitor; -import org.dllearner.tools.ore.ui.ExplanationTable; -import org.dllearner.tools.ore.ui.ImpactTable; -import org.dllearner.tools.ore.ui.StatusBar; -import org.dllearner.tools.ore.ui.UnsatClassesTableCellRenderer; -import org.dllearner.tools.ore.ui.wizard.panels.ExplanationTablePanel; -import org.dllearner.tools.ore.ui.wizard.panels.RepairPlanPanel; -import org.jdesktop.swingx.JXList; -import org.mindswap.pellet.PelletOptions; -import org.mindswap.pellet.owlapi.PelletReasonerFactory; -import org.mindswap.pellet.owlapi.Reasoner; -import org.mindswap.pellet.utils.progress.SwingProgressMonitor; -import org.semanticweb.owl.apibinding.OWLManager; -import org.semanticweb.owl.model.OWLAxiom; -import org.semanticweb.owl.model.OWLClass; -import org.semanticweb.owl.model.OWLOntology; -import org.semanticweb.owl.model.OWLOntologyChange; -import org.semanticweb.owl.model.OWLOntologyCreationException; -import org.semanticweb.owl.model.OWLOntologyManager; - -public class ExplanationPanel extends JPanel implements ListSelectionListener, - ActionListener,ImpactManagerListener, ExplanationManagerListener, RepairManagerListener{ - - private JXList unsatList; - private JSplitPane splitPane; - private JSplitPane statsSplitPane; - private JScrollPane listScrollPane; - private JScrollPane explanationsScrollPane; - private JComponent explanationsPanel; - private JPanel buttonExplanationsPanel; - private JPanel buttonPanel; - private ButtonGroup explanationType; - private JRadioButton regularButton; - private JRadioButton laconicButton; - - private UnsatClassesTableCellRenderer listRenderer; - - private ExplanationManager expManager; - private ImpactManager impManager; - private RepairManager repManager; - - private StatusBar statusBar; - - - private OWLClass unsatClass; - /** - * - */ - private static final long serialVersionUID = 2213073383532597460L; - - public ExplanationPanel(ExplanationManager expMan, ImpactManager impMan, RepairManager repMan) { - - - this.expManager = expMan; - this.impManager = impMan; - this.repManager = repMan; - - impManager.addListener(this); - setLayout(new BorderLayout()); - - Dimension minimumSize = new Dimension(400, 400); - - listRenderer = new UnsatClassesTableCellRenderer(expManager); - unsatList = new JXList(); - fillUnsatClassesList(); - unsatList.addListSelectionListener(this); -// unsatList.setCellRenderer(listRenderer); - listScrollPane = new JScrollPane(unsatList); - listScrollPane.setPreferredSize(minimumSize); - - explanationsPanel = new Box(1); - - JPanel pan = new JPanel(new BorderLayout()); - pan.add(explanationsPanel, BorderLayout.NORTH); - explanationsScrollPane = new JScrollPane(pan); - explanationsScrollPane.setPreferredSize(minimumSize); - explanationsScrollPane.setBorder(BorderFactory - .createLineBorder(Color.LIGHT_GRAY)); - explanationsScrollPane.getViewport().setOpaque(false); - explanationsScrollPane.getViewport().setBackground(null); - explanationsScrollPane.setOpaque(false); - - regularButton = new JRadioButton("regular", true); - regularButton.setActionCommand("regular"); - regularButton.addActionListener(this); - laconicButton = new JRadioButton("laconic"); - laconicButton.setActionCommand("laconic"); - laconicButton.addActionListener(this); - explanationType = new ButtonGroup(); - explanationType.add(regularButton); - explanationType.add(laconicButton); - buttonPanel = new JPanel(); - buttonPanel.add(regularButton); - buttonPanel.add(laconicButton); - - buttonExplanationsPanel = new JPanel(); - buttonExplanationsPanel.setLayout(new BorderLayout()); - buttonExplanationsPanel - .add(explanationsScrollPane, BorderLayout.CENTER); - buttonExplanationsPanel.add(buttonPanel, BorderLayout.NORTH); - - statsSplitPane = new JSplitPane(0); - statsSplitPane.setResizeWeight(1.0D); - statsSplitPane.setTopComponent(buttonExplanationsPanel); - - //repair panel - JPanel impactRepairPanel = new JPanel(); - impactRepairPanel.setLayout(new BorderLayout()); - impactRepairPanel.add(new JLabel("Repair plan"), BorderLayout.NORTH); - JSplitPane impRepSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); - impRepSplit.setOneTouchExpandable(true); - impRepSplit.setDividerLocation(600); - impRepSplit.setBorder(null); - impactRepairPanel.add(impRepSplit); - - JPanel impactPanel = new JPanel(); - impactPanel.setLayout(new BorderLayout()); - impactPanel.add(new JLabel("Lost entailments"), BorderLayout.NORTH); - JScrollPane impScr = new JScrollPane(new ImpactTable(impManager)); - impactPanel.add(impScr); - impRepSplit.setRightComponent(impactPanel); - - RepairPlanPanel repairPanel = new RepairPlanPanel(repManager); - impRepSplit.setLeftComponent(repairPanel); - - - statsSplitPane.setBottomComponent(impactRepairPanel); - - statsSplitPane.setBorder(null); - statsSplitPane.setDividerLocation(500); - statsSplitPane.setOneTouchExpandable(true); - - splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, listScrollPane, - statsSplitPane); - splitPane.setOneTouchExpandable(true); - splitPane.setDividerLocation(150); - splitPane.setBorder(null); - - add(splitPane); - - statusBar = new StatusBar(); - add(statusBar, BorderLayout.SOUTH); - } - - private void fillUnsatClassesList() { - DefaultListModel model = new DefaultListModel(); - Set<OWLClass> rootClasses = new TreeSet<OWLClass>(expManager - .getRootUnsatisfiableClasses()); - for (OWLClass root : rootClasses) { - model.addElement(root); - } - Set<OWLClass> derivedClasses = new TreeSet<OWLClass>(expManager - .getUnsatisfiableClasses()); - derivedClasses.removeAll(rootClasses); - for (OWLClass unsat : derivedClasses) { - model.addElement(unsat); - - } - unsatList.setModel(model); - } - - private void addExplanationTable(List<OWLAxiom> explanation, int number) { - - // DLSyntaxObjectRenderer r = new DLSyntaxObjectRenderer(); - // Vector<String> t = new Vector<String>(); - // for(OWLAxiom ax : explanation) - // t.add(r.render(ax)); - // model.addColumn("axiom", t); - - ExplanationTable expTable = new ExplanationTable(explanation, repManager, impManager, expManager, unsatClass); - explanationsPanel.add(new ExplanationTablePanel(expTable, number)); - - } - - private void clearExplanationsPanel() { - explanationsPanel.removeAll(); - } - - private void showLaconicExplanations() { - clearExplanationsPanel(); - int counter = 1; - for (List<OWLAxiom> explanation : expManager - .getUnsatisfiableExplanations(unsatClass)) { - addExplanationTable(explanation, counter); - counter++; - } - explanationsPanel.add(Box.createVerticalStrut(10)); - explanationsPanel.add(new JSeparator()); - explanationsPanel.add(Box.createVerticalStrut(10)); - this.updateUI(); - } - - private void showRegularExplanations() { - clearExplanationsPanel(); - int counter = 1; - for (List<OWLAxiom> explanation : expManager - .getUnsatisfiableExplanations(unsatClass)) { - addExplanationTable(explanation, counter); - counter++; - } - explanationsPanel.add(Box.createVerticalStrut(10)); - explanationsPanel.add(new JSeparator()); - explanationsPanel.add(Box.createVerticalStrut(10)); - this.updateUI(); - } - - private void showExplanations(){ - clearExplanationsPanel(); - int counter = 1; - for (List<OWLAxiom> explanation : expManager - .getUnsatisfiableExplanations(unsatClass)) { - addExplanationTable(explanation, counter); - counter++; - } - explanationsPanel.add(Box.createVerticalStrut(10)); - explanationsPanel.add(new JSeparator()); - explanationsPanel.add(Box.createVerticalStrut(10)); - this.updateUI(); - } - - @Override - public void valueChanged(ListSelectionEvent e) { - - unsatClass = (OWLClass) ((JXList) e.getSource()).getSelectedValue(); - -// OWLEditorKitFactory edFac = new OWLEditorKitFactory(); -// edFac.canLoad(URI.create("file:examples/ore/koala.owl")); -// -// try { -// EditorKit kit = edFac.createEditorKit(); -// } catch (Exception e2) { -// // TODO Auto-generated catch block -// e2.printStackTrace(); -// } -// -// OWLModelManager m = new OWLModelManagerImpl(); -// try { -// m.loadOntology(URI.create("file:examples/ore/koala.owl")); -// } catch (OWLOntologyCreationException e1) { -// // TODO Auto-generated catch block -// e1.printStackTrace(); -// } -// -// OWLExpressionCheckerFactory f = new ManchesterOWLExpressionCheckerFactory(m); -// OWLExpressionChecker<OWLDescription> checker = f.getOWLDescriptionChecker(); -// -// ExpressionEditor<OWLDescription> editor2 = new ExpressionEditor<OWLDescription>(); -// editor2.setVisible(true); -// editor.setDescription(unsatClass); - - - if (!unsatList.isSelectionEmpty()) { - showExplanations(); - } - - } - - @Override - public void actionPerformed(ActionEvent e) { - if (e.getActionCommand().equals("regular")) { - expManager.setLaconicMode(false); - } else if (e.getActionCommand().equals("laconic")) { - expManager.setLaconicMode(true); - - } - - } - - @Override - public void impactListChanged() { - // TODO Auto-generated method stub - - } - - @Override - public void repairPlanExecuted(List<OWLOntologyChange> changes) { - explanationsPanel.removeAll(); - - fillUnsatClassesList(); - repaint(); - } - - @Override - public void explanationLimitChanged() { - if(unsatClass != null){ - showExplanations(); - } - - } - - - public static void main(String[] args) { - - try { - String file = "file:examples/ore/tambis.owl"; - PelletOptions.USE_CLASSIFICATION_MONITOR = PelletOptions.MonitorType.SWING; - OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); - OWLOntology ontology = manager.loadOntologyFromPhysicalURI(URI - .create(file)); - - org.mindswap.pellet.utils.progress.ProgressMonitor mon = new SwingProgressMonitor(); - org.mindswap.pellet.utils.progress.ProgressMonitor m = new ClassificationProgressMonitor(); - JFrame fr = new JFrame(); - fr.setSize(new Dimension(400, 400)); - fr.setLayout(new BorderLayout()); - fr.add((JPanel)m); -// fr.setVisible(true); - PelletReasonerFactory reasonerFactory = new PelletReasonerFactory(); - Reasoner reasoner = reasonerFactory.createReasoner(manager); - reasoner.loadOntologies(Collections.singleton(ontology)); - reasoner.getKB().getTaxonomyBuilder().setProgressMonitor(mon); -// mon.taskStarted(); - - - reasoner.classify(); - - - - - -// try { -// String text = "Koala SubclassOf Class: Animal"; -// OWLEntityChecker checker = new EntityChecker(manager); -// ManchesterOWLSyntaxEditorParser parser = new ManchesterOWLSyntaxEditorParser(manager.getOWLDataFactory(),text); -// parser.setOWLEntityChecker(checker); -// parser.parseOntology(manager, ontology); -// parser.setBase(ontology.getURI().toString() + "#"); -// parser.parseDescription(); -// } catch (OWLOntologyChangeException e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } catch (ParserException e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } - - - - - ExplanationManager expManager = ExplanationManager - .getInstance(reasoner); - ImpactManager impManager = ImpactManager.getInstance( - reasoner); - RepairManager repManager= RepairManager.getRepairManager(reasoner); - ExplanationPanel panel = new ExplanationPanel(expManager, - impManager, repManager); - - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - - JFrame test = new JFrame(); - test.setLayout(new GridLayout(0, 1)); - test.setSize(new Dimension(1400, 1000)); - test.add(panel); - test.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); - test.setVisible(true); - } catch (HeadlessException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (OWLOntologyCreationException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (ClassNotFoundException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (InstantiationException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IllegalAccessException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (UnsupportedLookAndFeelException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - - @Override - public void explanationTypeChanged() { - // TODO Auto-generated method stub - - } - - @Override - public void repairPlanChanged() { - // TODO Auto-generated method stub - - } - - - - - - -} Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ImpactManager.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ImpactManager.java 2009-08-24 13:27:45 UTC (rev 1830) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ImpactManager.java 2009-08-25 15:57:36 UTC (rev 1831) @@ -26,15 +26,15 @@ private OWLOntologyManager manager; private Reasoner reasoner; - private ImpactManager(Reasoner reasoner) { - this.reasoner = reasoner; + private ImpactManager(OREManager oreMan) { + this.reasoner = oreMan.getPelletReasoner().getReasoner(); this.ontology = reasoner.getLoadedOntologies().iterator().next(); this.manager = reasoner.getManager(); impact = new HashMap<OWLAxiom, Set<OWLAxiom>>(); selectedAxioms = new ArrayList<OWLAxiom>(); listeners = new ArrayList<ImpactManagerListener>(); ranker = new AxiomRanker(ontology, reasoner, manager); - RepairManager.getRepairManager(reasoner).addListener(this); + RepairManager.getRepairManager(oreMan).addListener(this); } @@ -50,9 +50,9 @@ listeners.remove(listener); } - public static synchronized ImpactManager getInstance(Reasoner reasoner) { + public static synchronized ImpactManager getInstance(OREManager oreMan) { if (instance == null) { - instance = new ImpactManager(reasoner); + instance = new ImpactManager(oreMan); } return instance; } Copied: trunk/src/dl-learner/org/dllearner/tools/ore/MouseOverHintManager.java (from rev 1830, trunk/src/dl-learner/org/dllearner/tools/ore/ui/MouseOverHintManager.java) =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/MouseOverHintManager.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/ore/MouseOverHintManager.java 2009-08-25 15:57:36 UTC (rev 1831) @@ -0,0 +1,132 @@ +package org.dllearner.tools.ore; + +import java.awt.Component; +import java.awt.Container; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.util.Map; +import java.util.WeakHashMap; + +import javax.swing.JLabel; +import javax.swing.MenuElement; +import javax.swing.table.JTableHeader; + + + + + +public class MouseOverHintManager implements MouseListener { + + private Map<Component, String> hintMap; + + private JLabel hintLabel; + + + + public MouseOverHintManager( JLabel hintLabel ) { + + hintMap = new WeakHashMap<Component, String>(); + + this.hintLabel = hintLabel; + + } + + + + public void addHintFor( Component comp, String hintText ) { + + hintMap.put( comp, hintText ); + + } + + + + public void enableHints( Component comp ) { + + comp.addMouseListener( this ); + + if ( comp instanceof Container ) { + + Component[] components = ((Container)comp).getComponents(); + + for ( int i=0; i<components.length; i++ ) + + enableHints( components[i] ); + + } + + if ( comp instanceof MenuElement ) { + + MenuElement[] elements = ((MenuElement)comp).getSubElements(); + + for ( int i=0; i<elements.length; i++ ) + + enableHints( elements[i].getComponent() ); + + } + + } + + + + private String getHintFor( Component comp ) { + + String hint = (String)hintMap.get(comp); + + if ( hint == null ) { + + if ( comp instanceof JLabel ) + + hint = (String)hintMap.get(((JLabel)comp).getLabelFor()); + + else if ( comp instanceof JTableHeader ) + + hint = (String)hintMap.get(((JTableHeader)comp).getTable()); + + } + + return hint; + + } + + + + + + public void mouseEntered( MouseEvent e ) { + + Component comp = (Component)e.getSource(); + + String hint; + + do { + + hint = getHintFor(comp); + + comp = comp.getParent(); + + } while ( (hint == null) && (comp != null) ); + + if ( hint != null ) + + hintLabel.setText( hint ); + + } + + + + public void mouseExited( MouseEvent e ) { + + hintLabel.setText( " " ); + + } + + + + public void mouseClicked( MouseEvent e ) {} + + public void mousePressed( MouseEvent e ) {} + + public void mouseReleased( MouseEvent e ) {} + +} Deleted: trunk/src/dl-learner/org/dllearner/tools/ore/ORE.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ORE.java 2009-08-24 13:27:45 UTC (rev 1830) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ORE.java 2009-08-25 15:57:36 UTC (rev 1831) @@ -1,763 +0,0 @@ -/** - * Copyright (C) 2007-2008, Jens Lehmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -package org.dllearner.tools.ore; - -import java.io.File; -import java.io.IOException; -import java.io.StringWriter; -import java.net.MalformedURLException; -import java.net.URI; -import java.net.URL; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.Vector; - -import javax.swing.JLabel; - -import org.dllearner.algorithms.celoe.CELOE; -import org.dllearner.core.ComponentInitException; -import org.dllearner.core.ComponentManager; -import org.dllearner.core.KnowledgeSource; -import org.dllearner.core.LearningAlgorithm; -import org.dllearner.core.LearningProblem; -import org.dllearner.core.LearningProblemUnsupportedException; -import org.dllearner.core.ReasonerComponent; -import org.dllearner.core.configurators.ComponentFactory; -import org.dllearner.core.owl.Description; -import org.dllearner.core.owl.Individual; -import org.dllearner.core.owl.Intersection; -import org.dllearner.core.owl.NamedClass; -import org.dllearner.core.owl.ObjectQuantorRestriction; -import org.dllearner.core.owl.Union; -import org.dllearner.kb.OWLFile; -import org.dllearner.learningproblems.ClassLearningProblem; -import org.dllearner.learningproblems.EvaluatedDescriptionClass; -import org.dllearner.reasoning.FastInstanceChecker; -import org.dllearner.reasoning.OWLAPIReasoner; -import org.dllearner.reasoning.PelletReasoner; -import org.dllearner.tools.ore.ui.DescriptionLabel; -import org.mindswap.pellet.exceptions.InconsistentOntologyException; -import org.semanticweb.owl.model.OWLAxiom; -import org.semanticweb.owl.model.OWLException; - -import com.clarkparsia.explanation.io.manchester.ManchesterSyntaxExplanationRenderer; - -/** - * This class contains init methods, and is used as broker between wizard and OWL-API. - * @author Lorenz Buehmann - * - */ -public class ORE { - - private LearningAlgorithm la; - - private OWLFile ks; - private LearningProblem lp; - private ComponentManager cm; - - private ReasonerComponent fastReasoner; - - private PelletReasoner pelletReasoner; - - - private NamedClass class2Learn; - private EvaluatedDescriptionClass newClassDescription; - - - private OntologyModifier modifier; - - private String baseURI; - private Map<String, String> prefixes; - - private double noise = 0.0; - - private File owlFile; - - - public ORE() { - - cm = ComponentManager.getInstance(); - - } - - // step 1: detect knowledge sources - - /** - * Applying knowledge source. - */ - public void setKnowledgeSource(File f) { - this.owlFile = f; - - ks = cm.knowledgeSource(OWLFile.class); - try { - ks.getConfigurator().setUrl(f.toURI().toURL()); - } catch (MalformedURLException e2) { - // TODO Auto-generated catch block - e2.printStackTrace(); - } - - try { - ks.init(); - } catch (ComponentInitException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - - public void setKnowledgeSourceFromURI(URI uri){ - ks = cm.knowledgeSource(OWLFile.class); - try { - ks.getConfigurator().setUrl(uri.toURL()); - } catch (MalformedURLException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - try { - ks.init(); - } catch (ComponentInitException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - public void initPelletReasoner(){ - pelletReasoner = cm.reasoner(PelletReasoner.class, ks); - try { - pelletReasoner.init(); - } catch (ComponentInitException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - pelletReasoner.loadOntologies(); - } - - public void loadOntology(){ - pelletReasoner.loadOntologies(); - } - - public boolean consistentOntology() throws InconsistentOntologyException{ - return pelletReasoner.isConsistent(); - } - - public PelletReasoner getPelletReasoner(){ - return pelletReasoner; - } - - - /** - * Initialize the reasoners. - */ - public void initReasoners(){ - - fastReasoner = cm.reasoner(FastInstanceChecker.class, ks); - try { - fastReasoner.init(); - } catch (ComponentInitException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - pelletReasoner.loadOntologies(); - pelletReasoner.classify(); - modifier = new OntologyModifier(pelletReasoner); - baseURI = fastReasoner.getBaseURI(); - prefixes = fastReasoner.getPrefixes(); - - } - - public String getInconsistencyExplanationsString(){ - ManchesterSyntaxExplanationRenderer renderer = new ManchesterSyntaxExplanationRenderer(); - StringWriter buffer = new StringWriter(); - renderer.startRendering(buffer); - try { - renderer.render(getInconsistencyExplanations()); - } catch (UnsupportedOperationException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (OWLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - renderer.endRendering(); - return buffer.toString(); - } - - private Set<Set<OWLAxiom>> getInconsistencyExplanations(){ - return pelletReasoner.getInconsistencyReasons(); - } - - - public OntologyModifier getModifier() { - return modifier; - } - - - public EvaluatedDescriptionClass getNewClassDescription() { - return newClassDescription; - } - - - public String getBaseURI() { - return baseURI; - } - - public Map<String, String> getPrefixes() { - return prefixes; - } - - - public ReasonerComponent getFastReasoner() { - return fastReasoner; - } - - public void setLearningProblem(){ - - lp = ComponentFactory.getClassLearningProblem(fastReasoner, getClass2LearnAsURL()); - - try { - lp.init(); - } catch (ComponentInitException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - private URL getClass2LearnAsURL(){ - URL classURL = null; - try { - classURL = new URL(class2Learn.toString()); - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - return classURL; - - } - - public void setNoise(double noise){ - System.out.println("setze noise auf" + noise); - cm.applyConfigEntry(la, "noisePercentage", noise); - try { - la.init(); - } catch (ComponentInitException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - this.noise = noise; - } - - public void setLearningAlgorithm(){ - - try { - la = ComponentFactory.getCELOE(lp, fastReasoner); - cm.applyConfigEntry(la, "useNegation", false); - } catch (LearningProblemUnsupportedException e1) { - // TODO Auto-generated catch block - e1.printStackTrace(); - } - - - try { - la.init(); - } catch (ComponentInitException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - } - - /** - * Sets the class that has to be learned. - * @param oldClass class that is chosen to be (re)learned - */ - public void setClassToLearn(NamedClass class2Learn){ - this.class2Learn = class2Learn; - } - - public void init(){ - - this.setLearningProblem(); - this.setLearningAlgorithm(); - - } - - /** - * Starts the learning algorithm, setting noise value and ignored concepts. - * - */ - public void start(){ - - try { - la.init(); - } catch (ComponentInitException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - la.start(); - - } - - public void setNewClassDescription(EvaluatedDescriptionClass newClassDescription) { - this.newClassDescription = newClassDescription; - } - - public LearningAlgorithm getLa() { - return la; - } - - public NamedClass getIgnoredConcept() { - return class2Learn; - } - - - - /** - * Retrieves description parts that might cause inconsistency - for negative examples only. - * @param ind - * @param desc - */ - public Set<Description> getNegCriticalDescriptions(Individual ind, Description desc){ - - Set<Description> criticals = new HashSet<Description>(); - List<Description> children = desc.getChildren(); - - if(pelletReasoner.hasType(desc, ind)){ - - if(children.size() >= 2){ - - if(desc instanceof Intersection){ - for(Description d: children){ - criticals.addAll(getNegCriticalDescriptions(ind, d)); - } - } else if(desc instanceof Union){ - for(Description d: children){ - if(pelletReasoner.hasType(d, ind)){ - criticals.addAll(getNegCriticalDescriptions(ind, d)); - } - } - } - } else{ - criticals.add(desc); - } - } - - return criticals; - } - /** - * Retrieves the description parts, that might cause inconsistency - for negative examples. - * @param ind - * @param desc - * @return vector of JLabel - */ - public Collection<JLabel> descriptionToJLabelNeg(Individual ind, Description desc){ - - Collection<JLabel> criticals = new Vector<JLabel>(); - List<Description> children = desc.getChildren(); - -// try { - if(fastReasoner.hasType(desc, ind)){ - - if(children.size() >= 2){ - - if(desc instanceof Intersection){ - criticals.add(new JLabel("(")); - for(int i = 0; i<children.size()-1; i++){ - criticals.addAll(descriptionToJLabelNeg(ind, desc.getChild(i))); - criticals.add(new JLabel("and")); - - } - criticals.addAll(descriptionToJLabelNeg(ind, desc.getChild(children.size()-1))); - criticals.add(new JLabel(")")); - } else if(desc instanceof Union){ - criticals.add(new JLabel("(")); - for(int i = 0; i<children.size()-1; i++){ - if(fastReasoner.hasType(desc.getChild(i), ind)){ - criticals.addAll(descriptionToJLabelNeg(ind, desc.getChild(i))); - } else{ - criticals.add(new JLabel(desc.getChild(i).toManchesterSyntaxString(baseURI, prefixes))); - } - criticals.add(new JLabel("or")); - } - if(fastReasoner.hasType(desc.getChild(children.size()-1), ind)){ - criticals.addAll(descriptionToJLabelNeg(ind, desc.getChild(children.size()-1))); - } else{ - criticals.add(new JLabel(desc.getChild(children.size()-1).toManchesterSyntaxString(baseURI, prefixes))); - } - criticals.add(new JLabel(")")); - - - } - } else{ - - criticals.add(new DescriptionLabel(desc, "neg")); - } - } else{ - criticals.add(new JLabel(desc.toManchesterSyntaxString(baseURI, prefixes))); - } -// } catch (ReasoningMethodUnsupportedException e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } - - return criticals; - } - - /** - * Retrieves the description parts that might cause inconsistency - for positive examples. - * @param ind - * @param desc - * @return vector of JLabel - */ - public Collection<JLabel> descriptionToJLabelPos(Individual ind, Description desc){ - - Collection<JLabel> criticals = new Vector<JLabel>(); - List<Description> children = desc.getChildren(); - -// try { - if(!fastReasoner.hasType(desc, ind)){ - - if(children.size() >= 2){ - - if(desc instanceof Union){ - criticals.add(new JLabel("(")); - for(int i = 0; i<children.size()-1; i++){ - criticals.addAll(descriptionToJLabelPos(ind, desc.getChild(i))); - criticals.add(new JLabel("or")); - } - criticals.addAll(descriptionToJLabelPos(ind, desc.getChild(children.size()-1))); - criticals.add(new JLabel(")")); - } else if(desc instanceof Intersection){ - criticals.add(new JLabel("(")); - for(int i = 0; i<children.size()-1; i++){ - if(!fastReasoner.hasType(desc.getChild(i), ind)){ - criticals.addAll(descriptionToJLabelPos(ind, desc.getChild(i))); - } else{ - criticals.add(new JLabel(desc.getChild(i).toManchesterSyntaxString(baseURI, prefixes))); - } - criticals.add(new JLabel("and")); - } - if(!fastReasoner.hasType(desc.getChild(children.size()-1), ind)){ - criticals.addAll(descriptionToJLabelPos(ind, desc.getChild(children.size()-1))); - } else{ - criticals.add(new JLabel(desc.getChild(children.size()-1).toManchesterSyntaxString(baseURI, prefixes))); - } - criticals.add(new JLabel(")")); - } - } else{ - criticals.add(new DescriptionLabel(desc, "pos")); - } - } else{ - criticals.add(new JLabel(desc.toManchesterSyntaxString(baseURI, prefixes))); - } -// } catch (ReasoningMethodUnsupportedException e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } - - return criticals; - } - - /** - * Returns individuals that are in range of property. - * @param objRestr - * @param ind - */ - public Set<Individual> getIndividualsInPropertyRange(ObjectQuantorRestriction objRestr, Individual ind){ - - Set<Individual> individuals = pelletReasoner.getIndividuals(objRestr.getChild(0)); - individuals.remove(ind); - - return individuals; - } - - /** - * Returns individuals that are not in range of property. - * @param objRestr - * @param ind - */ - public Set<Individual> getIndividualsNotInPropertyRange(ObjectQuantorRestriction objRestr, Individual ind){ - - - Set<Individual> allIndividuals = new HashSet<Individual>(); - - for(Individual i : pelletReasoner.getIndividuals()){ - -// try { - if(!fastReasoner.hasType(objRestr.getChild(0), i)){ - allIndividuals.add(i); - } -// } catch (ReasoningMethodUnsupportedException e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } - } - - - return allIndividuals; - } - - /** - * Returns classes where individual might moved to. - * @param ind the individual - * @return set of classes - */ - public Set<NamedClass> getpossibleClassesMoveTo(Individual ind){ - Set<NamedClass> moveClasses = new HashSet<NamedClass>(); - for(NamedClass nc : pelletReasoner.getNamedClasses()){ - if(!pelletReasoner.hasType(nc, ind)){ - moveClasses.add(nc); - } - } - moveClasses.remove(class2Learn); - - return moveClasses; - } - - /** - * Returns classes where individual might moved from. - * @param ind the individual - * @return set of classes - */ - public Set<NamedClass> getpossibleClassesMoveFrom(Individual ind){ - Set<NamedClass> moveClasses = new HashSet<NamedClass>(); - for(NamedClass nc : pelletReasoner.getNamedClasses()){ - if(pelletReasoner.hasType(nc, ind)){ - moveClasses.add(nc); - } - } - moveClasses.remove(class2Learn); - - return moveClasses; - } - - /** - * Update reasoners ontology. - */ - public void updateReasoner(){ -// fastReasoner = cm.reasoner(FastInstanceChecker.class, new OWLAPIOntology(modifier.getOntology())); -// try { -// fastReasoner.init(); -// } catch (ComponentInitException e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } -// -// -// try { -// pelletReasoner.init(); -// } catch (ComponentInitException e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } - - - setLearningAlgorithm(); - } - - /** - * Get the complement classes where individual is asserted to. - * @param desc - * @param ind - */ - public Set<NamedClass> getComplements(Description desc, Individual ind){ - - Set<NamedClass> complements = new HashSet<NamedClass>(); - System.out.println(pelletReasoner.getComplementClasses(desc)); - for(NamedClass nc : pelletReasoner.getNamedClasses()){ - if(!(nc.toString().endsWith("Thing"))){ - if(pelletReasoner.hasType(nc, ind)){ - if(modifier.isComplement(desc, nc)){ - complements.add(nc); - } - } - } - } - - - return complements; - } - - - - public static void main(String[] args){ - try{ - ComponentManager cm = ComponentManager.getInstance(); - - // create knowledge source - KnowledgeSource source = cm.knowledgeSource(OWLFile.class); - String example = "examples/ore/inconsistent.owl"; - cm.applyConfigEntry(source, "url", new File(example).toURI().toURL()); - source.init(); - - // create OWL API reasoning service with standard settings - ReasonerComponent reasoner = cm.reasoner(OWLAPIReasoner.class, source); - reasoner.init(); - - // create a learning problem and set positive and negative examples - LearningProblem lp = cm.learningProblem(ClassLearningProblem.class, reasoner); -// cm.applyConfigEntry(lp, "type", "superClass"); - cm.applyConfigEntry(lp, "classToDescribe", "http://cohse.semanticweb.org/ontologies/people#mad+cow"); - lp.init(); - - // create the learning algorithm - LearningAlgorithm la = null; - try { - la = cm.learningAlgorithm(CELOE.class, lp, reasoner); - la.init(); - } catch (LearningProblemUnsupportedException e) { - e.printStackTrace(); - } - - // start the algorithm and print the best concept found - la.start(); - - System.out.println(la.getCurrentlyBestEvaluatedDescriptions(10, 0.8, true)); - } catch (MalformedURLException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (ComponentInitException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } -} - - - - - - -} - - - -// public static void main(String[] args){ -// -// final ORE test = new ORE(); -// -// File owlFile = new File("src/dl-learner/org/dllearner/tools/ore/neg_has_all.owl"); -// -// test.setKnowledgeSource(owlFile); -// test.initReasoners(); -// -// Individual subject = new Individual("http://example.com/father#patrick"); -// Description newClass = new Intersection(new NamedClass("http://example.com/father#female"), -// new Negation(new NamedClass("http://example.com/father#bird"))); -// Description desc = new NamedClass("http://example.com/father#bird"); -// -// Description range = new ObjectAllRestriction(new ObjectProperty("http://example.com/father#hasChild"), -// new NamedClass("http://example.com/father#female")); -// ObjectAllRestriction role = new ObjectAllRestriction(new ObjectProperty("http://example.com/father#hasChild"), -// range); -// System.out.println(role.toManchesterSyntaxString(test.getBaseURI(), test.getPrefixes())); -// try { -// System.out.println(test.fastReasoner.instanceCheck(role, subject)); -// } catch (ReasoningMethodUnsupportedException e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } -// test.modifier.addObjectProperty(subject, role, new Individual("http://example.com/father#anna")); -// test.updateReasoner(); -// try { -// System.out.println(test.fastReasoner.instanceCheck(role, subject)); -// } catch (ReasoningMethodUnsupportedException e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } -// test.modifier.saveOntology(); -// -// -// -// - -// System.out.println(test.owlReasoner.getInconsistentClasses()); -// test.getModi().reason(); - -// -// Individual subject = new Individual("http://example.com/father#anton"); -// -// Description range = new ObjectAllRestriction(new ObjectProperty("http://example.com/father#hasChild"), -// new NamedClass("http://example.com/father#female")); -// ObjectAllRestriction role = new ObjectAllRestriction(new ObjectProperty("http://example.com/father#hasChild"), -// range); -// Description d = new Intersection(new NamedClass("http://example.com/father#male"), role); -// try { -// System.out.println(test.fastReasoner.instanceCheck(d, subject)); -// } catch (ReasoningMethodUnsupportedException e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } -// System.out.println("vorher" + test.modi.ontology.getAxioms()); -// Individual object = new Individual("http://example.com/father#markus"); -// test.modi.addObjectProperty(subject, role, object); -// test.updateReasoner(); -// try { -// System.out.println(test.fastReasoner.instanceCheck(d, subject)); -// } catch (ReasoningMethodUnsupportedException e) { -// // TODO Auto-generated catch block -// e.printStackTrace(); -// } - - -// test.modi.reason(); - -// Individual ind = new Individual("http://example.com/father#heinz"); -// Description d1 = new Intersection(new NamedClass("http://example.com/father#male"), new ObjectAllRestriction(new ObjectProperty("http://example.com/father#hasChild"), new NamedClass("http://example.com/father#male"))); -// System.out.println(test.reasoner2.instanceCheck(d, ind)); - - -// test.setConcept(new NamedClass("http://example.com/father#father")); -// test.setPosNegExamples(); -// System.out.println(test.posExamples); -// System.out.println(test.negExamples); -// test.start(); -// Individual ind = new Individual("http://www.test.owl#lorenz"); - -// test.modi.addClassAssertion(ind, new NamedClass("http://www.test.owl#B")); -// System.out.println(test.reasoner2.getInconsistentClasses()); -// Description d = new Intersection(new NamedClass("http://www.test.owl#A"), new Union(new NamedClass("http://www.test.owl#B"), -// new NamedClass("http://www.test.owl#C"))); -// System.out.println(d); -// System.out.println(test.getCriticalDescriptions(ind, d)); -// JFrame testFrame = new JFrame(); -// JPanel j = new JPanel(); -// testFrame.add(j); -// testFrame.setSize(new Dimension(400, 400)); -// for(JLabel jLab : test.DescriptionToJLabel(ind, d)) -// j.add(jLab); -// testFrame.setVisible(true); -//} - - - - - - - - - - Copied: trunk/src/dl-learner/org/dllearner/tools/ore/RecentManager.java (from rev 1830, trunk/src/dl-learner/org/dllearner/tools/ore/ui/RecentManager.java) =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/RecentManager.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/ore/RecentManager.java 2009-08-25 15:57:36 UTC (rev 1831) @@ -0,0 +1,86 @@ +package org.dllearner.tools.ore; + +import java.io.BufferedInputStream; +import java.io.BufferedOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.net.URI; +import java.util.ArrayList; +import java.util.List; + + +public class RecentManager { + + private static RecentManager instance; + private List<URI> uriList; + private File file; + + public RecentManager(){ + uriList = new ArrayList<URI>(); + file = new File("src/dl-learner/org/dllearner/tools/ore/recent.txt"); + } + + public static synchronized RecentManager getInstance() { + if (instance == null) { + instance = new RecentManager(); + } + return instance; + } + + public void addURI(URI uri){ + if(!uriList.contains(uri)){ + uriList.add(uri); + } + + } + + public List<URI> getURIs(){ + uriList.clear(); + deserialize(); + return uriList; + } + + public void serialize() { + try { + FileOutputStream fileStream = new FileOutputStream(file); + ObjectOutputStream outputStream = new ObjectOutputStream( + new BufferedOutputStream(fileStream)); + try { + outputStream.writeObject(uriList); + } finally { + outputStream.close(); + } + + } catch (IOException e) { + e.printStackTrace(); + } + + } + + @SuppressWarnings("unchecked") + private void deserialize() { + try { + FileInputStream fileStream = new FileInputStream(file); + ObjectInputStream inputStream = new ObjectInputStream( + new BufferedInputStream(fileStream)); + + try { + List<URI> list = (List<URI>) inputStream.readObject(); + uriList.addAll(list); + } finally { + inputStream.close(); + } + } catch (IOException e) { + e.printStackTrace(); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + } + + } + + +} Modified: trunk/src/dl-learner/org/dllearner/tools/ore/RepairManager.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/RepairManager.java 2009-08-24 13:27:45 UTC (rev 1830) +++ trunk/src/dl-learner/org/dllearner/tools/ore/RepairManager.java 2009-08-25 15:57:36 UTC (rev 1831) @@ -5,6 +5,7 @@ import java.util.Stack; import org.mindswap.pellet.owlapi.Reasoner; +import org.semanticweb.owl.model.AddAxiom; import org.semanticweb.owl.model.OWLAxiom; import org.semanticweb.owl.model.OWLOntology; import org.semanticweb.owl.model.OWLOntologyChange; @@ -19,6 +20,7 @@ private OWLAxiom actual; private List<OWLAxiom> axioms2Remove; + private List<OWLAxiom> axioms2Keep; private List<RepairManagerListener> listeners; private OWLOntology ontology; private OWLOntologyManager manager; @@ -27,12 +29,14 @@ private Stack<List<OWLOntologyChange>> undoStack; private Stack<List<OWLOntologyChange>> redoStack; - private RepairManager(Reasoner reasoner) { - this.reasoner = reasoner; + private RepairManager(OREManager oreMan) { + this.reasoner = oreMan.getPelletReasoner().getReasoner(); this.ontology = reasoner.getLoadedOntologies().iterator().next(); this.manager = reasoner.getManager(); axioms2Remove = new ArrayList<OWLAxiom>(); + axioms2Keep = new ArrayList<OWLAxiom>(); + listeners = new ArrayList<RepairManagerListener>(); undoStack = new Stack<List<OWLOntologyChange>>(); @@ -52,9 +56,9 @@ listeners.remove(listener); } - public static synchronized RepairManager getRepairManager(Reasoner reasoner) { + public static synchronized RepairManager getRepairManager(OREManager oreMan) { if (instance == null) { - instance = new RepairManager(reasoner); + instance = new RepairManager(oreMan); } return instance; } @@ -69,6 +73,16 @@ fireRepairPlanChanged(); } + public void addAxiom2Keep(OWLAxiom ax){ + axioms2Keep.add(ax); + fireRepairPlanChanged(); + } + + public void removeAxiom2Keep(OWLAxiom ax){ + axioms2Keep.remove(ax); + fireRepairPlanChanged(); + } + public boolean isSelected(OWLAxiom ax){ return axioms2Remove.contains(ax); } @@ -77,11 +91,18 @@ return axioms2Remove; } + public List<OWLAxiom> getAxioms2Keep(){ + return axioms2Keep; + } + public void executeRepairPlan(){ List<OWLOntologyChange> changes = new ArrayList<OWLOntologyChange>(); for(OWLAxiom ax : axioms2Remove){ changes.add(new RemoveAxiom(ontology, ax)); } + for(OWLAxiom ax : axioms2Keep){ + changes.add(new AddAxiom(ontology, ax)); + } try { manager.applyChanges(changes); } catch (OWLOntologyChangeException e) { @@ -90,6 +111,7 @@ } undoStack.push(changes); axioms2Remove.clear(); + axioms2Keep.clear(); fireRepairPlanExecuted(changes); } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/explanation/CachedExplanationGenerator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/explanation/CachedExplanationGenerator.java 2009-08-24 13:27:45 UTC (rev 1830) +++ trunk/src/dl-learner/org/dllearner/tools/ore/explanation/CachedExplanationGenerator.java 2009-08-25 15:57:36 UTC (rev 1831) @@ -8,6 +8,7 @@ import java.util.Set; import java.util.Map.Entry; +import org.dllearner.tools.ore.OREManager; import org.dllearner.tools.ore.RepairManager; import org.dllearner.tools.ore.RepairManagerListener; import org.dllearner.tools.ore.explanation.laconic.LaconicExplanationGenerator; @@ -48,7 +49,7 @@ laconicExplanationCache = new HashMap<OWLAxiom, Set<Explanation>>(); lastRequestedRegularSize = new HashMap<OWLAxiom, Integer>(); lastRequestedLaconicSize = new HashMap<OWLAxiom, Integer>(); - RepairManager.getRepairManager(reasoner).addListener(this); + RepairManager.getRepairManager(OREManager.getInstance()).addListener(this); // regularExpGen = new PelletExplanation(manager, Collections.singleton(ontology)); // laconicExpGen = new LaconicExplanationGenerator(manager, new PelletReasonerFactory(), Collections.singleton(ontology)); @@ -144,18 +145,28 @@ @Override public void repairPlanExecuted(List<OWLOntologyChange> changes) { + Map<OWLAxiom, Set<Explanation>> copy = new HashMap<OWLAxiom, Set<Explanation>>(); for(OWLOntologyChange change : changes){ - if(change instanceof RemoveAxiom){System.out.println(changes); + if(change instanceof RemoveAxiom){ for(Entry<OWLAxiom, Set<Explanation>> entry: regularExplanationCache.entrySet()){ + Set<Explanation> explanationsCopy = new HashSet<Explanation>(); for(Explanation explanation : entry.getValue()){ if(explanation.getAxioms().contains(change.getAxiom())){ - entry.getValue().remove(explanation);System.out.println("test"); + explanationsCopy.add(explanation); } } + if(!explanationsCopy.isEmpty()){ + copy.put(entry.getKey(), explanationsCopy); + } + } } } + for(Entry<OWLAxiom, Set<Explanation>> copyEntry : copy.entrySet()){ + regularExplanationCache.get(copyEntry.getKey()).removeAll(copyEntry.getValue()); + + } } } Added: trunk/src/dl-learner/org/dllearner/tools/ore/minus.png =================================================================== (Binary files differ) Property changes on: trunk/src/dl-learner/org/dllearner/tools/ore/minus.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/src/dl-learner/org/dllearner/tools/ore/plus.png =================================================================== (Binary files differ) Property changes on: trunk/src/dl-learner/org/dllearner/tools/ore/plus.png ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: trunk/src/dl-learner/org/dllearner/tools/ore/recent.txt =================================================================== (Binary files differ) Deleted: trunk/src/dl-learner/org/dllearner/tools/ore/ui/ColorListCellRenderer.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ui/ColorListCellRenderer.java 2009-08-24 13:27:45 UTC (rev 1830) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/ColorListCellRenderer.java 2009-08-25 15:57:36 UTC (rev 1831) @@ -1,79 +0,0 @@ -/** - * Copyright (C) 2007-2008, Jens Lehmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -package org.dllearner.tools.ore.ui; - -import java.awt.Color; -import java.awt.Component; - -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.ListCellRenderer; - -import org.dllearner.core.owl.Individual; -import org.dllearner.core.owl.NamedClass; -import org.dllearner.tools.ore.ORE; - -/** - * List cell renderer for colored lines to provide better view on list values. - * @author Lorenz Buehmann - * - */ -public class ColorListCellRenderer extends JLabel implements ListCellRenderer { - - private static final long serialVersionUID = -7592805113197759247L; - private ORE ore; - - public ColorListCellRenderer(ORE ore) { - setOpaque(true); - this.ore = ore; - } - - public Component getListCellRendererComponent(JList list, Object value, - int index, boolean isSelected, boolean cellHasFocus) { - - if(value instanceof NamedClass){ - setText(((NamedClass) value).toManchesterSyntaxString(ore.getBaseURI(), ore.getPrefixes())); - } else if(value instanceof Individual){ - setText(((Individual) value).toManchesterSyntaxString(ore.getBaseURI(), ore.getPrefixes())); - } - Color background; - Color foreground; - - if (index % 2 == 0 && !isSelected) { - background = new Color(242, 242, 242); - foreground = Color.BLACK; - - } else if(isSelected){ - - background = Color.LIGHT_GRAY; - foreground = Color.BLACK; - }else{ - background = Color.WHITE; - foreground = Color.BLACK; - } - - setForeground(foreground); - setBackground(background); - - return this; - } - -} Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ui/DescriptionLabel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ui/DescriptionLabel.java 2009-08-24 13:27:45 UTC (rev 1830) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/DescriptionLabel.java 2009-08-25 15:57:36 UTC (rev 1831) @@ -42,7 +42,6 @@ import org.dllearner.core.owl.ObjectCardinalityRestriction; import org.dllearner.core.owl.ObjectSomeRestriction; import org.dllearner.core.owl.Thing; -import org.dllearner.tools.ore.ORE; import org.dllearner.tools.ore.OREManager; /** Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExplanationTable.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExplanationTable.java 2009-08-24 13:27:45 UTC (rev 1830) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExplanationTable.java 2009-08-25 15:57:36 UTC (rev 1831) @@ -20,43 +20,39 @@ import javax.swing.table.TableCellRenderer; import javax.swing.table.TableColumn; -import org.dllearner.tools.ore.ExplanationManager; -import org.dllearner.tools.ore.ImpactManager; +import org.dllearner.tools.ore.OREManager; import org.dllearner.tools.ore.RepairManager; import org.dllearner.tools.ore.RepairManagerListener; import org.jdesktop.swingx.JXTable; import org.jdesktop.swingx.decorator.HighlighterFactory; +import org.protege.editor.core.Disposable; import org.semanticweb.owl.model.OWLAxiom; import org.semanticweb.owl.model.OWLClass; import org.semanticweb.owl.model.OWLOntologyChange; -public class ExplanationTable extends JXTable implements RepairManagerListener{ +public class ExplanationTable extends JXTable implements RepairManagerListener, Disposable{ /** * */ private static final long serialVersionUID = 5580730282611559609L; - private List<OWLAxiom> explanation; private RepairManager repMan; - private ImpactManager impMan; - public ExplanationTable(List<OWLAxiom> explanation, RepairManager repMan, - ImpactManager impMan, ExplanationManager expMan, OWLClass cl) { - this.explanation = explanation; - this.repMan = repMan; - this.impMan = impMan; + public ExplanationTable(List<OWLAxiom> explanation, OWLClass cl) { + + repMan = RepairManager.getRepairManager(OREManager.getInstance()); + repMan.addListener(this); setBackground(Color.WHITE); setHighlighters(HighlighterFactory.createAlternateStriping()); setAutoResizeMode(JTable.AUTO_RESIZE_OFF); - setModel(new ExplanationTableModel(explanation, expMan, impMan, repMan, - cl)); - getColumn(0).setCellRenderer(new OWLSyntaxTableCellRenderer(repMan)); + setModel(new ExplanationTableModel(explanation, cl)); TableColumn column4 = getColumn(3); column4.setCellRenderer(new ButtonCellRenderer()); column4.setCellEditor(new ButtonCellEditor()); column4.setResizable(false); + setRowHeight(getRowHeight() + 4); setColumnSizes(); getSelectionModel().addListSelectionListener( new ListSelectionListener() { @@ -113,10 +109,7 @@ }); } - private OWLAxiom getOWLAxiomAtRow(int rowIndex){ - return ((ExplanationTableModel)getModel()).getOWLAxiomAtRow(rowIndex); - } - + private void setColumnSizes(){ getColumn(1).setMaxWidth(30); getColumn(2).setMaxWidth(30); @@ -125,14 +118,6 @@ private void changeSelection() { -// -// if(getSelectedRow() >=0){ -// OWLAxiom rowAxiom = getOWLAxiomAtRow(getSelectedRow()); -// impMan.setActualAxiom(rowAxiom); -// } else { -// impMan.setActualAxiom(null); -// } - } class ButtonCellRenderer extends JButton implements TableCellRenderer{ @@ -211,8 +196,16 @@ repaint(); } + + @Override + public void dispose() throws Exception { + repMan.removeListener(this); + + } + + } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExplanationTableModel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExplanationTableModel.java 2009-08-24 13:27:45 UTC (rev 1830) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExplanationTableModel.java 2009-08-25 15:57:36 UTC (rev 1831) @@ -1,12 +1,12 @@ package org.dllearner.tools.ore.ui; -import java.util.ArrayList; import java.util.List; import javax.swing.table.AbstractTableModel; import org.dllearner.tools.ore.ExplanationManager; import org.dllearner.tools.ore.ImpactManager; +import org.dllearner.... [truncated message content] |
From: <lor...@us...> - 2009-08-24 13:27:55
|
Revision: 1830 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1830&view=rev Author: lorenz_b Date: 2009-08-24 13:27:45 +0000 (Mon, 24 Aug 2009) Log Message: ----------- some changes for simple Sparql progress monitor Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/kb/extraction/Manager.java trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/Manager.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/Manager.java 2009-08-24 09:19:17 UTC (rev 1829) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/Manager.java 2009-08-24 13:27:45 UTC (rev 1830) @@ -27,6 +27,8 @@ import java.util.SortedSet; import java.util.TreeSet; +import javax.swing.ProgressMonitor; + import org.apache.log4j.Logger; import org.dllearner.utilities.JamonMonitorLogger; import org.semanticweb.owl.model.OWLOntology; @@ -46,6 +48,8 @@ private int nrOfExtractedTriples = 0; private List<Node> seedNodes = new ArrayList<Node>(); + private ProgressMonitor mon; + private static Logger logger = Logger .getLogger(Manager.class); @@ -69,9 +73,16 @@ public List<Node> extract(Set<String> instances) { List<Node> allExtractedNodes = new ArrayList<Node>(); logger.info("Start extracting "+instances.size() + " instances "); + if(mon != null){ + mon.setNote("Start extracting "+instances.size() + " instances "); + mon.setMaximum(instances.size()); + } int progress=0; for (String one : instances) { progress++; + if(mon != null){ + mon.setProgress(progress); + } logger.info("Progress: "+progress+" of "+instances.size()+" finished: "+one); try { Node n = extractionAlgorithm.expandNode(one, configuration.getTupelAquisitor()); @@ -144,4 +155,7 @@ return nrOfExtractedTriples; } + public void addProgressMonitor(ProgressMonitor mon){ + this.mon = mon; + } } \ No newline at end of file Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2009-08-24 09:19:17 UTC (rev 1829) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlKnowledgeSource.java 2009-08-24 13:27:45 UTC (rev 1830) @@ -28,6 +28,8 @@ import java.util.List; import java.util.TreeSet; +import javax.swing.ProgressMonitor; + import org.apache.log4j.Logger; import org.dllearner.core.KnowledgeSource; import org.dllearner.core.OntologyFormat; @@ -59,6 +61,7 @@ import org.dllearner.utilities.JamonMonitorLogger; import org.dllearner.utilities.datastructures.StringTuple; import org.dllearner.utilities.statistics.SimpleClock; +import org.mindswap.pellet.utils.progress.SilentProgressMonitor; import org.semanticweb.owl.model.OWLOntology; import com.jamonapi.Monitor; @@ -73,6 +76,7 @@ */ public class SparqlKnowledgeSource extends KnowledgeSource { + private ProgressMonitor mon; private static final boolean debug = false; @@ -236,11 +240,14 @@ logger.info("SparqlModul: Collecting Ontology"); SimpleClock totalTime = new SimpleClock(); //SimpleClock extractionTime = new SimpleClock(); - + if(mon != null){ + mon.setNote("Collecting Ontology"); + } logger.trace(getURL()); logger.trace(getSparqlEndpoint()); logger.trace(configurator.getInstances()); Manager m = new Manager(); + m.addProgressMonitor(mon); // get Options for Manipulator Manipulator manipulator = getManipulator(); @@ -509,6 +516,10 @@ public int getNrOfExtractedAxioms() { return nrOfExtractedAxioms; } + + public void addProgressMonitor(ProgressMonitor mon){ + this.mon = mon; + } /* * public static void main(String[] args) throws MalformedURLException { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lor...@us...> - 2009-08-24 09:19:31
|
Revision: 1829 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1829&view=rev Author: lorenz_b Date: 2009-08-24 09:19:17 +0000 (Mon, 24 Aug 2009) Log Message: ----------- * started simple Sparql extraction panel * made some changes in GUI Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/reasoning/PelletReasoner.java trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationManager.java trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ImpactManager.java trunk/src/dl-learner/org/dllearner/tools/ore/ImpactManagerListener.java trunk/src/dl-learner/org/dllearner/tools/ore/OREApplication.java trunk/src/dl-learner/org/dllearner/tools/ore/OREManager.java trunk/src/dl-learner/org/dllearner/tools/ore/RepairManager.java trunk/src/dl-learner/org/dllearner/tools/ore/RepairManagerListener.java trunk/src/dl-learner/org/dllearner/tools/ore/SPARQLTest.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/CachedExplanationGenerator.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/ExplanationGenerator.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/LaconicTest.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/laconic/LaconicExplanationGenerator.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExplanationTable.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/ImpactTableModel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/OWLSyntaxTableCellRenderer.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/RecentManager.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/RepairDialog.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/RepairTableModel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/StatusBar.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/StatusBarSimulator.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/Wizard.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/WizardController.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/InconsistencyExplanationPanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/KnowledgeSourcePanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/LearningPanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/SavePanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/UnsatisfiableExplanationPanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/KnowledgeSourcePanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/LearningPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/StatsPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/UnsatisfiableExplanationPanel.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/tools/ore/explanation/Explanation.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/PelletExplanationGenerator.java trunk/src/dl-learner/org/dllearner/tools/ore/recent.txt trunk/src/dl-learner/org/dllearner/tools/ore/toggled.gif trunk/src/dl-learner/org/dllearner/tools/ore/ui/ClassesTable.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/ClassesTableModel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExtractFromSparqlPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/ManchesterSyntaxTableCellRenderer.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/ResultTable.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/ResultTableModel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/SparqlExtractOptionsPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/UnsatClassesTableCellRenderer.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/UnsatisfiableClassesTable.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/UnsatisfiableClassesTableModel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/ClassChoosePanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/ClassChoosePanel.java trunk/src/dl-learner/org/dllearner/tools/ore/untoggled.gif Removed Paths: ------------- trunk/src/dl-learner/org/dllearner/tools/ore/ui/ColumnListCellRenderer.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/ReasonerProgressUI.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/UnsatClassesListCellRenderer.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/ClassPanelOWLDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/ClassPanelSparqlDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/ClassPanelOWL.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/ClassPanelSparql.java Modified: trunk/src/dl-learner/org/dllearner/reasoning/PelletReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/PelletReasoner.java 2009-08-18 15:32:20 UTC (rev 1828) +++ trunk/src/dl-learner/org/dllearner/reasoning/PelletReasoner.java 2009-08-24 09:19:17 UTC (rev 1829) @@ -59,6 +59,7 @@ import org.dllearner.kb.OWLAPIOntology; import org.dllearner.kb.OWLFile; import org.dllearner.kb.sparql.SparqlKnowledgeSource; +import org.dllearner.tools.ore.explanation.PelletExplanationGenerator; import org.dllearner.utilities.Helper; import org.dllearner.utilities.owl.ConceptComparator; import org.dllearner.utilities.owl.ConceptTransformation; @@ -394,6 +395,7 @@ factory = manager.getOWLDataFactory(); //set classification output to "none", while default is "console" PelletOptions.USE_CLASSIFICATION_MONITOR = PelletOptions.MonitorType.SWING; + // change log level to WARN for Pellet, because otherwise log // output will be very large Logger pelletLogger = Logger.getLogger("org.mindswap.pellet"); Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationManager.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationManager.java 2009-08-18 15:32:20 UTC (rev 1828) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationManager.java 2009-08-24 09:19:17 UTC (rev 1829) @@ -1,15 +1,13 @@ package org.dllearner.tools.ore; import java.util.ArrayList; -import java.util.HashMap; import java.util.HashSet; import java.util.List; -import java.util.Map; import java.util.Set; import org.dllearner.tools.ore.explanation.CachedExplanationGenerator; +import org.dllearner.tools.ore.explanation.Explanation; import org.dllearner.tools.ore.explanation.RootFinder; -import org.dllearner.tools.ore.explanation.laconic.LaconicExplanationGenerator; import org.mindswap.pellet.owlapi.PelletReasonerFactory; import org.mindswap.pellet.owlapi.Reasoner; import org.semanticweb.owl.model.OWLAxiom; @@ -26,8 +24,6 @@ import uk.ac.manchester.cs.owl.explanation.ordering.DefaultExplanationOrderer; import uk.ac.manchester.cs.owl.explanation.ordering.ExplanationTree; -import com.clarkparsia.explanation.PelletExplanation; - public class ExplanationManager implements OWLOntologyChangeListener, RepairManagerListener{ private static ExplanationManager instance; @@ -37,11 +33,9 @@ private PelletReasonerFactory reasonerFactory; private OWLOntology ontology; private Reasoner reasoner; - private PelletExplanation regularExpGen; - private LaconicExplanationGenerator laconicExpGen; + private RootFinder rootFinder; - private Map<OWLClass, Set<Set<OWLAxiom>>> regularExplanationCache; - private Map<OWLClass, Set<Set<OWLAxiom>>> laconicExplanationCache; + private Set<OWLClass> unsatClasses; private Set<OWLClass> rootClasses; boolean ontologyChanged = true; @@ -56,9 +50,7 @@ private ExplanationManager(Reasoner reasoner) { - regularExplanationCache = new HashMap<OWLClass, Set<Set<OWLAxiom>>>(); - laconicExplanationCache = new HashMap<OWLClass, Set<Set<OWLAxiom>>>(); - + this.reasoner = reasoner; this.manager = reasoner.getManager(); this.ontology = reasoner.getLoadedOntologies().iterator().next(); @@ -71,21 +63,20 @@ rootFinder = new RootFinder(manager, reasoner, reasonerFactory); - regularExpGen = new PelletExplanation(reasoner.getManager(), reasoner.getLoadedOntologies()); - - laconicExpGen = new LaconicExplanationGenerator(manager, - reasonerFactory, manager.getOntologies()); - rootClasses = new HashSet<OWLClass>(); unsatClasses = new HashSet<OWLClass>(); listeners = new ArrayList<ExplanationManagerListener>(); - gen = new CachedExplanationGenerator(ontology); + gen = new CachedExplanationGenerator(ontology, reasoner); } - public static synchronized ExplanationManager getExplanationManager( + public ExplanationManager() { + // TODO Auto-generated constructor stub + } + + public static synchronized ExplanationManager getInstance( Reasoner reasoner) { if (instance == null) { instance = new ExplanationManager(reasoner); @@ -93,8 +84,10 @@ return instance; } - public static synchronized ExplanationManager getExplanationManager(){ - + public static synchronized ExplanationManager getInstance(){ + if (instance == null) { + instance = new ExplanationManager(); + } return instance; } @@ -125,28 +118,28 @@ OWLSubClassAxiom entailment = dataFactory.getOWLSubClassAxiom(unsat, dataFactory.getOWLNothing()); - Set<Set<OWLAxiom>> explanations; + Set<Explanation> explanations; if (isComputeAllExplanations) { explanations = gen.getExplanations(entailment); } else { explanations = gen.getExplanations(entailment, maxExplantionCount); } - return getOrderedExplanations(entailment, explanations); + return getOrderedExplanations(explanations); } public Set<List<OWLAxiom>> getInconsistencyExplanations(){ OWLSubClassAxiom entailment = dataFactory.getOWLSubClassAxiom(dataFactory.getOWLThing(), dataFactory.getOWLNothing()); - Set<Set<OWLAxiom>> explanations; + Set<Explanation> explanations; if (isComputeAllExplanations) { explanations = gen.getExplanations(entailment); } else { explanations = gen.getExplanations(entailment, maxExplantionCount); } - return getOrderedExplanations(entailment, explanations); + return getOrderedExplanations(explanations); } @@ -160,13 +153,13 @@ return ordering; } - private Set<List<OWLAxiom>> getOrderedExplanations(OWLAxiom entailment, Set<Set<OWLAxiom>> explanations){ + private Set<List<OWLAxiom>> getOrderedExplanations(Set<Explanation> explanations){ DefaultExplanationOrderer orderer = new DefaultExplanationOrderer(); Set<List<OWLAxiom>> orderedExplanations = new HashSet<List<OWLAxiom>>(); ArrayList<OWLAxiom> ordering; - for(Set<OWLAxiom> explanation : explanations){ + for(Explanation explanation : explanations){ ordering = new ArrayList<OWLAxiom>(); - ExplanationTree tree = orderer.getOrderedExplanation(entailment, explanation); + ExplanationTree tree = orderer.getOrderedExplanation(explanation.getEntailment(), explanation.getAxioms()); // ordering.add(tree.getUserObject()); for(Tree<OWLAxiom> child : tree.getChildren()){ @@ -186,12 +179,12 @@ public int getArity(OWLClass cl, OWLAxiom ax) { int arity = 0; - Set<Set<OWLAxiom>> explanations = gen.getExplanations(dataFactory.getOWLSubClassAxiom(cl, dataFactory.getOWLNothing())); + Set<Explanation> explanations = gen.getExplanations(dataFactory.getOWLSubClassAxiom(cl, dataFactory.getOWLNothing())); if(explanations != null){ - for (Set<OWLAxiom> explanation : explanations) { - if (explanation.contains(ax)) { + for (Explanation explanation : explanations) { + if (explanation.getAxioms().contains(ax)) { arity++; } } @@ -201,7 +194,7 @@ public void setLaconicMode(boolean laconic){ gen.setComputeLaconicExplanations(laconic); - fireExplanationLimitChanged(); + fireExplanationTypeChanged(); } @@ -224,14 +217,9 @@ } @Override - public void repairPlanExecuted() { + public void repairPlanExecuted(List<OWLOntologyChange> changes) { reasoner.refresh(); ontologyChanged = true; - regularExpGen = new PelletExplanation(reasoner.getManager(), reasoner.getLoadedOntologies()); - laconicExpGen = new LaconicExplanationGenerator(manager, - reasonerFactory, reasoner.getLoadedOntologies()); - regularExplanationCache.clear(); - laconicExplanationCache.clear(); } @Override @@ -254,6 +242,12 @@ } } + public void fireExplanationTypeChanged(){ + for(ExplanationManagerListener listener : listeners){ + listener.explanationTypeChanged(); + } + } + public void setAllExplanationWarningChecked(){ allExplanationWarningChecked = true; } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationPanel.java 2009-08-18 15:32:20 UTC (rev 1828) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationPanel.java 2009-08-24 09:19:17 UTC (rev 1829) @@ -34,7 +34,7 @@ import org.dllearner.tools.ore.ui.ExplanationTable; import org.dllearner.tools.ore.ui.ImpactTable; import org.dllearner.tools.ore.ui.StatusBar; -import org.dllearner.tools.ore.ui.UnsatClassesListCellRenderer; +import org.dllearner.tools.ore.ui.UnsatClassesTableCellRenderer; import org.dllearner.tools.ore.ui.wizard.panels.ExplanationTablePanel; import org.dllearner.tools.ore.ui.wizard.panels.RepairPlanPanel; import org.jdesktop.swingx.JXList; @@ -46,11 +46,12 @@ import org.semanticweb.owl.model.OWLAxiom; import org.semanticweb.owl.model.OWLClass; import org.semanticweb.owl.model.OWLOntology; +import org.semanticweb.owl.model.OWLOntologyChange; import org.semanticweb.owl.model.OWLOntologyCreationException; import org.semanticweb.owl.model.OWLOntologyManager; public class ExplanationPanel extends JPanel implements ListSelectionListener, - ActionListener,ImpactManagerListener, ExplanationManagerListener{ + ActionListener,ImpactManagerListener, ExplanationManagerListener, RepairManagerListener{ private JXList unsatList; private JSplitPane splitPane; @@ -64,7 +65,7 @@ private JRadioButton regularButton; private JRadioButton laconicButton; - private UnsatClassesListCellRenderer listRenderer; + private UnsatClassesTableCellRenderer listRenderer; private ExplanationManager expManager; private ImpactManager impManager; @@ -91,11 +92,11 @@ Dimension minimumSize = new Dimension(400, 400); - listRenderer = new UnsatClassesListCellRenderer(expManager); + listRenderer = new UnsatClassesTableCellRenderer(expManager); unsatList = new JXList(); fillUnsatClassesList(); unsatList.addListSelectionListener(this); - unsatList.setCellRenderer(listRenderer); +// unsatList.setCellRenderer(listRenderer); listScrollPane = new JScrollPane(unsatList); listScrollPane.setPreferredSize(minimumSize); @@ -298,13 +299,13 @@ } @Override - public void axiomForImpactChanged() { + public void impactListChanged() { // TODO Auto-generated method stub } @Override - public void repairPlanExecuted() { + public void repairPlanExecuted(List<OWLOntologyChange> changes) { explanationsPanel.removeAll(); fillUnsatClassesList(); @@ -369,8 +370,8 @@ ExplanationManager expManager = ExplanationManager - .getExplanationManager(reasoner); - ImpactManager impManager = ImpactManager.getImpactManager( + .getInstance(reasoner); + ImpactManager impManager = ImpactManager.getInstance( reasoner); RepairManager repManager= RepairManager.getRepairManager(reasoner); ExplanationPanel panel = new ExplanationPanel(expManager, @@ -412,6 +413,12 @@ } + @Override + public void repairPlanChanged() { + // TODO Auto-generated method stub + + } + Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ImpactManager.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ImpactManager.java 2009-08-18 15:32:20 UTC (rev 1828) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ImpactManager.java 2009-08-24 09:19:17 UTC (rev 1829) @@ -11,9 +11,10 @@ import org.mindswap.pellet.owlapi.Reasoner; import org.semanticweb.owl.model.OWLAxiom; import org.semanticweb.owl.model.OWLOntology; +import org.semanticweb.owl.model.OWLOntologyChange; import org.semanticweb.owl.model.OWLOntologyManager; -public class ImpactManager { +public class ImpactManager implements RepairManagerListener{ private static ImpactManager instance; private Map<OWLAxiom, Set<OWLAxiom>> impact; @@ -33,6 +34,7 @@ selectedAxioms = new ArrayList<OWLAxiom>(); listeners = new ArrayList<ImpactManagerListener>(); ranker = new AxiomRanker(ontology, reasoner, manager); + RepairManager.getRepairManager(reasoner).addListener(this); } @@ -48,7 +50,7 @@ listeners.remove(listener); } - public static synchronized ImpactManager getImpactManager(Reasoner reasoner) { + public static synchronized ImpactManager getInstance(Reasoner reasoner) { if (instance == null) { instance = new ImpactManager(reasoner); } @@ -85,18 +87,18 @@ public void setActualAxiom(OWLAxiom ax){ actual = ax; - fireAxiomForImpactChanged(); + fireImpactListChanged(); } public void addAxiom2ImpactList(OWLAxiom ax){ selectedAxioms.add(ax); - fireAxiomForImpactChanged(); + fireImpactListChanged(); } public void removeAxiomFromImpactList(OWLAxiom ax){ selectedAxioms.remove(ax); - fireAxiomForImpactChanged(); + fireImpactListChanged(); } public boolean isSelected(OWLAxiom ax){ @@ -104,11 +106,25 @@ } - private void fireAxiomForImpactChanged(){ + private void fireImpactListChanged(){ for(ImpactManagerListener listener : listeners){ - listener.axiomForImpactChanged(); + listener.impactListChanged(); } } + + @Override + public void repairPlanChanged() { + // TODO Auto-generated method stub + + } + + @Override + public void repairPlanExecuted(List<OWLOntologyChange> changes) { + selectedAxioms.clear(); + impact.clear(); + fireImpactListChanged(); + + } } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ImpactManagerListener.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ImpactManagerListener.java 2009-08-18 15:32:20 UTC (rev 1828) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ImpactManagerListener.java 2009-08-24 09:19:17 UTC (rev 1829) @@ -1,6 +1,5 @@ package org.dllearner.tools.ore; public interface ImpactManagerListener { - public abstract void axiomForImpactChanged(); - public abstract void repairPlanExecuted(); + public abstract void impactListChanged(); } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/OREApplication.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/OREApplication.java 2009-08-18 15:32:20 UTC (rev 1828) +++ trunk/src/dl-learner/org/dllearner/tools/ore/OREApplication.java 2009-08-24 09:19:17 UTC (rev 1829) @@ -30,8 +30,7 @@ import org.dllearner.tools.ore.ui.wizard.Wizard; import org.dllearner.tools.ore.ui.wizard.WizardPanelDescriptor; -import org.dllearner.tools.ore.ui.wizard.descriptors.ClassPanelOWLDescriptor; -import org.dllearner.tools.ore.ui.wizard.descriptors.ClassPanelSparqlDescriptor; +import org.dllearner.tools.ore.ui.wizard.descriptors.ClassChoosePanelDescriptor; import org.dllearner.tools.ore.ui.wizard.descriptors.IntroductionPanelDescriptor; import org.dllearner.tools.ore.ui.wizard.descriptors.KnowledgeSourcePanelDescriptor; import org.dllearner.tools.ore.ui.wizard.descriptors.LearningPanelDescriptor; @@ -79,21 +78,18 @@ WizardPanelDescriptor descriptor2 = new KnowledgeSourcePanelDescriptor(); wizard.registerWizardPanel(KnowledgeSourcePanelDescriptor.IDENTIFIER, descriptor2); - WizardPanelDescriptor descriptor3 = new ClassPanelOWLDescriptor(); - wizard.registerWizardPanel(ClassPanelOWLDescriptor.IDENTIFIER, descriptor3); + WizardPanelDescriptor descriptor3 = new ClassChoosePanelDescriptor(); + wizard.registerWizardPanel(ClassChoosePanelDescriptor.IDENTIFIER, descriptor3); - WizardPanelDescriptor descriptor4 = new ClassPanelSparqlDescriptor(); - wizard.registerWizardPanel(ClassPanelSparqlDescriptor.IDENTIFIER, descriptor4); + WizardPanelDescriptor descriptor4 = new LearningPanelDescriptor(); + wizard.registerWizardPanel(LearningPanelDescriptor.IDENTIFIER, descriptor4); - WizardPanelDescriptor descriptor5 = new LearningPanelDescriptor(); - wizard.registerWizardPanel(LearningPanelDescriptor.IDENTIFIER, descriptor5); + WizardPanelDescriptor descriptor5 = new RepairPanelDescriptor(); + wizard.registerWizardPanel(RepairPanelDescriptor.IDENTIFIER, descriptor5); - WizardPanelDescriptor descriptor6 = new RepairPanelDescriptor(); - wizard.registerWizardPanel(RepairPanelDescriptor.IDENTIFIER, descriptor6); + WizardPanelDescriptor descriptor6 = new SavePanelDescriptor(); + wizard.registerWizardPanel(SavePanelDescriptor.IDENTIFIER, descriptor6); - WizardPanelDescriptor descriptor7 = new SavePanelDescriptor(); - wizard.registerWizardPanel(SavePanelDescriptor.IDENTIFIER, descriptor7); - if (!(args.length == 1)){ wizard.setCurrentPanel(IntroductionPanelDescriptor.IDENTIFIER); } else{ Modified: trunk/src/dl-learner/org/dllearner/tools/ore/OREManager.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/OREManager.java 2009-08-18 15:32:20 UTC (rev 1828) +++ trunk/src/dl-learner/org/dllearner/tools/ore/OREManager.java 2009-08-24 09:19:17 UTC (rev 1829) @@ -17,7 +17,7 @@ import org.dllearner.algorithms.celoe.CELOE; import org.dllearner.core.ComponentInitException; import org.dllearner.core.ComponentManager; -import org.dllearner.core.LearningAlgorithm; +import org.dllearner.core.KnowledgeSource; import org.dllearner.core.LearningProblemUnsupportedException; import org.dllearner.core.owl.Description; import org.dllearner.core.owl.Individual; @@ -26,6 +26,7 @@ import org.dllearner.core.owl.ObjectQuantorRestriction; import org.dllearner.core.owl.Union; import org.dllearner.kb.OWLFile; +import org.dllearner.kb.sparql.SparqlKnowledgeSource; import org.dllearner.learningproblems.ClassLearningProblem; import org.dllearner.learningproblems.EvaluatedDescriptionClass; import org.dllearner.reasoning.PelletReasoner; @@ -46,7 +47,7 @@ private PelletReasoner pelletReasoner; private ClassLearningProblem lp; private CELOE la; - private OWLFile ks; + private KnowledgeSource ks; private String baseURI; private Map<String, String> prefixes; @@ -81,7 +82,7 @@ public void setCurrentKnowledgeSource(URI uri){ ks = cm.knowledgeSource(OWLFile.class); try { - ks.getConfigurator().setUrl(uri.toURL()); + ((OWLFile)ks).getConfigurator().setUrl(uri.toURL()); ks.init(); } catch (MalformedURLException e) { // TODO Auto-generated catch block @@ -93,6 +94,11 @@ } + public void setCurrentKnowledgeSource(SparqlKnowledgeSource ks){ + this.ks = ks; + + } + public void setLearningProblem(){ lp = cm.learningProblem(ClassLearningProblem.class, pelletReasoner); @@ -245,8 +251,12 @@ this.maxNrOfResults = maxNrOfResults; } + public int getMaxNrOfResults(){ + return maxNrOfResults; + } + /** * Sets the class that has to be learned. * @param oldClass class that is chosen to be (re)learned @@ -288,7 +298,7 @@ } - public LearningAlgorithm getLa() { + public CELOE getLa() { return la; } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/RepairManager.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/RepairManager.java 2009-08-18 15:32:20 UTC (rev 1828) +++ trunk/src/dl-learner/org/dllearner/tools/ore/RepairManager.java 2009-08-24 09:19:17 UTC (rev 1829) @@ -1,13 +1,9 @@ package org.dllearner.tools.ore; import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.Stack; -import org.dllearner.tools.ore.explanation.AxiomRanker; import org.mindswap.pellet.owlapi.Reasoner; import org.semanticweb.owl.model.OWLAxiom; import org.semanticweb.owl.model.OWLOntology; @@ -27,6 +23,9 @@ private OWLOntology ontology; private OWLOntologyManager manager; private Reasoner reasoner; + + private Stack<List<OWLOntologyChange>> undoStack; + private Stack<List<OWLOntologyChange>> redoStack; private RepairManager(Reasoner reasoner) { this.reasoner = reasoner; @@ -36,6 +35,8 @@ axioms2Remove = new ArrayList<OWLAxiom>(); listeners = new ArrayList<RepairManagerListener>(); + undoStack = new Stack<List<OWLOntologyChange>>(); + redoStack = new Stack<List<OWLOntologyChange>>(); } @@ -87,21 +88,36 @@ System.out.println("Error in Repairmanager: Couldn't apply ontology changes"); e.printStackTrace(); } - + undoStack.push(changes); axioms2Remove.clear(); - fireRepairPlanExecuted(); + fireRepairPlanExecuted(changes); } + public void undo(){ + List<OWLOntologyChange> changes = undoStack.pop(); + redoStack.push(changes); + try { + manager.applyChanges(changes); + } catch (OWLOntologyChangeException e) { + System.out.println("Error in Repairmanager: Couldn't apply ontology changes"); + e.printStackTrace(); + } + } + + public void redo(){ + + } + private void fireRepairPlanChanged(){ for(RepairManagerListener listener : listeners){ listener.repairPlanChanged(); } } - private void fireRepairPlanExecuted(){ + private void fireRepairPlanExecuted(List<OWLOntologyChange> changes){ for(RepairManagerListener listener : listeners){ - listener.repairPlanExecuted(); + listener.repairPlanExecuted(changes); } } } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/RepairManagerListener.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/RepairManagerListener.java 2009-08-18 15:32:20 UTC (rev 1828) +++ trunk/src/dl-learner/org/dllearner/tools/ore/RepairManagerListener.java 2009-08-24 09:19:17 UTC (rev 1829) @@ -1,6 +1,10 @@ package org.dllearner.tools.ore; +import java.util.List; + +import org.semanticweb.owl.model.OWLOntologyChange; + public interface RepairManagerListener { - public abstract void repairPlanExecuted(); + public abstract void repairPlanExecuted(List<OWLOntologyChange> changes); public abstract void repairPlanChanged(); } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/SPARQLTest.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/SPARQLTest.java 2009-08-18 15:32:20 UTC (rev 1828) +++ trunk/src/dl-learner/org/dllearner/tools/ore/SPARQLTest.java 2009-08-24 09:19:17 UTC (rev 1829) @@ -21,7 +21,6 @@ import java.net.MalformedURLException; import java.net.URL; -import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; @@ -34,17 +33,11 @@ import org.dllearner.kb.sparql.SPARQLTasks; import org.dllearner.kb.sparql.SparqlEndpoint; import org.dllearner.kb.sparql.SparqlKnowledgeSource; -import org.dllearner.kb.sparql.SparqlQuery; import org.dllearner.learningproblems.ClassLearningProblem; import org.dllearner.reasoning.FastInstanceChecker; -import org.dllearner.reasoning.OWLAPIReasoner; import org.dllearner.utilities.datastructures.SetManipulation; -import org.dllearner.utilities.examples.AutomaticNegativeExampleFinderSPARQL; import org.dllearner.utilities.examples.AutomaticPositiveExampleFinderSPARQL; -import com.hp.hpl.jena.query.ResultSet; -import com.hp.hpl.jena.query.ResultSetFactory; - /** * Test class for SPARQL mode. * @@ -55,7 +48,7 @@ @SuppressWarnings("unused") public static void main(String[] args) throws MalformedURLException { - String exampleClass = "http://dbpedia.org/class/yago/LeadersOfPoliticalParties"; + String exampleClass = "http://dbpedia.org/ontology/HistoricPlace"; String exampleClassKBString = "\"" + exampleClass + "\""; ComponentManager cm = ComponentManager.getInstance(); @@ -104,7 +97,7 @@ cm.applyConfigEntry(ks, "predefinedEndpoint", "DBPEDIA"); ks.getConfigurator().setInstances(instances); ks.getConfigurator().setPredefinedFilter("YAGO"); - ks.getConfigurator().setSaveExtractedFragment(true); +// ks.getConfigurator().setSaveExtractedFragment(true); ks.init(); ReasonerComponent reasoner = cm.reasoner(FastInstanceChecker.class, ks); reasoner.init(); Modified: trunk/src/dl-learner/org/dllearner/tools/ore/explanation/CachedExplanationGenerator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/explanation/CachedExplanationGenerator.java 2009-08-18 15:32:20 UTC (rev 1828) +++ trunk/src/dl-learner/org/dllearner/tools/ore/explanation/CachedExplanationGenerator.java 2009-08-24 09:19:17 UTC (rev 1829) @@ -3,45 +3,52 @@ import java.util.Collections; import java.util.HashMap; import java.util.HashSet; +import java.util.List; import java.util.Map; import java.util.Set; +import java.util.Map.Entry; +import org.dllearner.tools.ore.RepairManager; +import org.dllearner.tools.ore.RepairManagerListener; import org.dllearner.tools.ore.explanation.laconic.LaconicExplanationGenerator; import org.mindswap.pellet.owlapi.PelletReasonerFactory; +import org.mindswap.pellet.owlapi.Reasoner; import org.semanticweb.owl.apibinding.OWLManager; import org.semanticweb.owl.model.OWLAxiom; import org.semanticweb.owl.model.OWLOntology; +import org.semanticweb.owl.model.OWLOntologyChange; import org.semanticweb.owl.model.OWLOntologyManager; +import org.semanticweb.owl.model.RemoveAxiom; import uk.ac.manchester.cs.owl.modularity.ModuleType; -import com.clarkparsia.explanation.PelletExplanation; import com.clarkparsia.modularity.ModularityUtils; import com.clarkparsia.owlapi.OntologyUtils; -public class CachedExplanationGenerator implements ExplanationGenerator{ +public class CachedExplanationGenerator implements ExplanationGenerator, RepairManagerListener{ private Map<OWLAxiom, OWLOntology> axiom2Module; - private Map<OWLAxiom, Set<Set<OWLAxiom>>> regularExplanationCache; - private Map<OWLAxiom, Set<Set<OWLAxiom>>> laconicExplanationCache; + private Map<OWLAxiom, Set<Explanation>> regularExplanationCache; + private Map<OWLAxiom, Set<Explanation>> laconicExplanationCache; private Map<OWLAxiom, Integer> lastRequestedRegularSize; private Map<OWLAxiom, Integer> lastRequestedLaconicSize; private boolean laconicMode = false; - private PelletExplanation regularExpGen; + private PelletExplanationGenerator regularExpGen; private LaconicExplanationGenerator laconicExpGen; private OWLOntology ontology; private OWLOntologyManager manager; - public CachedExplanationGenerator(OWLOntology ontology){ + public CachedExplanationGenerator(OWLOntology ontology, Reasoner reasoner){ this.ontology = ontology; this.manager = OWLManager.createOWLOntologyManager(); axiom2Module = new HashMap<OWLAxiom, OWLOntology>(); - regularExplanationCache = new HashMap<OWLAxiom, Set<Set<OWLAxiom>>>(); - laconicExplanationCache = new HashMap<OWLAxiom, Set<Set<OWLAxiom>>>(); + regularExplanationCache = new HashMap<OWLAxiom, Set<Explanation>>(); + laconicExplanationCache = new HashMap<OWLAxiom, Set<Explanation>>(); lastRequestedRegularSize = new HashMap<OWLAxiom, Integer>(); lastRequestedLaconicSize = new HashMap<OWLAxiom, Integer>(); + RepairManager.getRepairManager(reasoner).addListener(this); // regularExpGen = new PelletExplanation(manager, Collections.singleton(ontology)); // laconicExpGen = new LaconicExplanationGenerator(manager, new PelletReasonerFactory(), Collections.singleton(ontology)); @@ -52,20 +59,20 @@ } @Override - public Set<OWLAxiom> getExplanation(OWLAxiom entailment){ + public Explanation getExplanation(OWLAxiom entailment){ return getExplanations(entailment, 1).iterator().next(); } @Override - public Set<Set<OWLAxiom>> getExplanations(OWLAxiom entailment){ + public Set<Explanation> getExplanations(OWLAxiom entailment){ return getExplanations(entailment, -1); } @Override - public Set<Set<OWLAxiom>> getExplanations(OWLAxiom entailment, int limit){ - Set<Set<OWLAxiom>> explanations = new HashSet<Set<OWLAxiom>>(); + public Set<Explanation> getExplanations(OWLAxiom entailment, int limit){ + Set<Explanation> explanations = new HashSet<Explanation>(); try { if(!laconicMode){ @@ -80,9 +87,9 @@ return explanations; } - private Set<Set<OWLAxiom>> computeLaconicExplanations(OWLAxiom entailment, int limit) throws ExplanationException{ + private Set<Explanation> computeLaconicExplanations(OWLAxiom entailment, int limit) throws ExplanationException{ - Set<Set<OWLAxiom>> explanations = laconicExplanationCache.get(entailment); + Set<Explanation> explanations = laconicExplanationCache.get(entailment); Integer lastRequestedSize = lastRequestedLaconicSize.get(entailment); if(lastRequestedSize == null){ lastRequestedSize = Integer.valueOf(0); @@ -105,8 +112,8 @@ return explanations; } - private Set<Set<OWLAxiom>> computeRegularExplanations(OWLAxiom entailment, int limit) throws ExplanationException{ - Set<Set<OWLAxiom>> explanations = regularExplanationCache.get(entailment); + private Set<Explanation> computeRegularExplanations(OWLAxiom entailment, int limit) throws ExplanationException{ + Set<Explanation> explanations = regularExplanationCache.get(entailment); Integer lastRequestedSize = lastRequestedRegularSize.get(entailment); if(lastRequestedSize == null){ lastRequestedSize = Integer.valueOf(0); @@ -117,15 +124,38 @@ module = OntologyUtils.getOntologyFromAxioms(ModularityUtils.extractModule(Collections.singleton(ontology), entailment.getSignature(), ModuleType.TOP_OF_BOT)); } axiom2Module.put(entailment, module); - regularExpGen = new PelletExplanation(manager, Collections.singleton(module)); + regularExpGen = new PelletExplanationGenerator(manager, Collections.singleton(module)); if(limit == -1){ - explanations = regularExpGen.getEntailmentExplanations(entailment); + explanations = regularExpGen.getExplanations(entailment); } else { - explanations = regularExpGen.getEntailmentExplanations(entailment, limit); + explanations = regularExpGen.getExplanations(entailment, limit); } regularExplanationCache.put(entailment, explanations); lastRequestedRegularSize.put(entailment, Integer.valueOf(limit)); } return explanations; } + + @Override + public void repairPlanChanged() { + // TODO Auto-generated method stub + + } + + @Override + public void repairPlanExecuted(List<OWLOntologyChange> changes) { + for(OWLOntologyChange change : changes){ + if(change instanceof RemoveAxiom){System.out.println(changes); + for(Entry<OWLAxiom, Set<Explanation>> entry: regularExplanationCache.entrySet()){ + for(Explanation explanation : entry.getValue()){ + if(explanation.getAxioms().contains(change.getAxiom())){ + entry.getValue().remove(explanation);System.out.println("test"); + } + } + + } + } + } + + } } Added: trunk/src/dl-learner/org/dllearner/tools/ore/explanation/Explanation.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/explanation/Explanation.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/ore/explanation/Explanation.java 2009-08-24 09:19:17 UTC (rev 1829) @@ -0,0 +1,56 @@ +package org.dllearner.tools.ore.explanation; + +import java.util.Set; +import java.util.TreeSet; + +import org.semanticweb.owl.model.OWLAxiom; + +public class Explanation { + + private Set<OWLAxiom> axioms; + private OWLAxiom entailment; + + + public Explanation(OWLAxiom entailment, Set<OWLAxiom> axioms){ + this.entailment = entailment; + this.axioms = axioms; + } + + public OWLAxiom getEntailment(){ + return entailment; + } + + public Set<OWLAxiom> getAxioms(){ + return axioms; + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + if(axioms.isEmpty()) + return "Explanation: <Empty>\n"; + sb.append("Explanation ["); + sb.append(entailment); + sb.append("]\n"); + for(OWLAxiom ax : (new TreeSet<OWLAxiom>(axioms))){ + sb.append("\t"); + sb.append(ax); + sb.append("\n"); + } + + return sb.toString(); + } + + @Override + public boolean equals(Object obj) { + Explanation exp = (Explanation)obj; + return exp.getEntailment().equals(entailment) && exp.getAxioms().equals(axioms); + } + + @Override + public int hashCode() { + return entailment.hashCode() + axioms.hashCode(); + } + + +} Modified: trunk/src/dl-learner/org/dllearner/tools/ore/explanation/ExplanationGenerator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/explanation/ExplanationGenerator.java 2009-08-18 15:32:20 UTC (rev 1828) +++ trunk/src/dl-learner/org/dllearner/tools/ore/explanation/ExplanationGenerator.java 2009-08-24 09:19:17 UTC (rev 1829) @@ -5,8 +5,8 @@ import org.semanticweb.owl.model.OWLAxiom; public interface ExplanationGenerator { - public abstract Set<OWLAxiom> getExplanation(OWLAxiom enatilment); - public abstract Set<Set<OWLAxiom>> getExplanations(OWLAxiom entailment); - public abstract Set<Set<OWLAxiom>> getExplanations(OWLAxiom entailment, int limit); + public abstract Explanation getExplanation(OWLAxiom enatilment); + public abstract Set<Explanation> getExplanations(OWLAxiom entailment); + public abstract Set<Explanation> getExplanations(OWLAxiom entailment, int limit); } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/explanation/LaconicTest.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/explanation/LaconicTest.java 2009-08-18 15:32:20 UTC (rev 1828) +++ trunk/src/dl-learner/org/dllearner/tools/ore/explanation/LaconicTest.java 2009-08-24 09:19:17 UTC (rev 1829) @@ -1,6 +1,5 @@ package org.dllearner.tools.ore.explanation; -import java.io.IOException; import java.io.PrintWriter; import java.net.URI; import java.util.Collections; @@ -131,8 +130,8 @@ // .getExplanations(unsatAxiom); // renderer.render(unsatAxiom, preciseJusts); // } - Set<Set<OWLAxiom>> preciseJusts = expGen.getExplanations(unsatAxiom); - renderer.render(unsatAxiom, preciseJusts); + Set<Explanation> preciseJusts = expGen.getExplanations(unsatAxiom); +// renderer.render(unsatAxiom, preciseJusts); renderer.endRendering(); } catch (OWLOntologyCreationException e) { @@ -145,10 +144,7 @@ // TODO Auto-generated catch block e.printStackTrace(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } + } } public static void miniTest(){ @@ -171,8 +167,8 @@ OWLSubClassAxiom unsatAxiom = factory.getOWLSubClassAxiom(c, factory.getOWLNothing()); LaconicExplanationGenerator expGen = new LaconicExplanationGenerator(manager, resonerFact, Collections.singleton(ontology)); - Set<Set<OWLAxiom>> preciseJusts = expGen.getExplanations(unsatAxiom); - renderer.render(unsatAxiom, preciseJusts); + Set<Explanation> preciseJusts = expGen.getExplanations(unsatAxiom); +// renderer.render(unsatAxiom, preciseJusts); renderer.endRendering(); expGen.returnSourceAxioms(preciseJusts); @@ -191,9 +187,6 @@ } catch (OWLException e) { // TODO Auto-generated catch block e.printStackTrace(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); } } @@ -230,13 +223,13 @@ - Set<Set<OWLAxiom>> regularJusts = expGen.getRegularExplanations(axiom); + Set<Explanation> regularJusts = expGen.getRegularExplanations(axiom); System.out.println("Regular explanations:"); - renderer.render(axiom, regularJusts); +// renderer.render(axiom, regularJusts); - Set<Set<OWLAxiom>> preciseJusts = expGen.getExplanations(axiom); + Set<Explanation> preciseJusts = expGen.getExplanations(axiom); System.out.println("Precise explanations:"); - renderer.render(axiom, preciseJusts); +// renderer.render(axiom, preciseJusts); renderer.endRendering(); @@ -251,9 +244,6 @@ // TODO Auto-generated catch block e.printStackTrace(); - } catch (IOException e) { - // TODO Auto-generated catch block - e.printStackTrace(); } } } Added: trunk/src/dl-learner/org/dllearner/tools/ore/explanation/PelletExplanationGenerator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/explanation/PelletExplanationGenerator.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/ore/explanation/PelletExplanationGenerator.java 2009-08-24 09:19:17 UTC (rev 1829) @@ -0,0 +1,129 @@ +package org.dllearner.tools.ore.explanation; + +import java.net.URI; +import java.util.HashSet; +import java.util.Set; + +import org.mindswap.pellet.owlapi.Reasoner; +import org.semanticweb.owl.apibinding.OWLManager; +import org.semanticweb.owl.model.OWLAxiom; +import org.semanticweb.owl.model.OWLClass; +import org.semanticweb.owl.model.OWLDataFactory; +import org.semanticweb.owl.model.OWLDescription; +import org.semanticweb.owl.model.OWLOntology; +import org.semanticweb.owl.model.OWLOntologyCreationException; +import org.semanticweb.owl.model.OWLOntologyManager; +import org.semanticweb.reasonerfactory.pellet.PelletReasonerFactory; + +import com.clarkparsia.explanation.BlackBoxExplanation; +import com.clarkparsia.explanation.GlassBoxExplanation; +import com.clarkparsia.explanation.HSTExplanationGenerator; +import com.clarkparsia.explanation.SatisfiabilityConverter; +import com.clarkparsia.explanation.TransactionAwareSingleExpGen; + +public class PelletExplanationGenerator implements ExplanationGenerator{ + static { + setup(); + } + + /** + * Very important initialization step that needs to be called once before a + * reasoner is created. This function will be called automatically when + * GlassBoxExplanation is loaded by the class loader. This function simply + * calls the {@link GlassBoxExplanationGenerator#setup()} function. + */ + public static void setup() { + GlassBoxExplanation.setup(); + } + + + private HSTExplanationGenerator expGen; + + private SatisfiabilityConverter converter; + + public PelletExplanationGenerator(OWLOntologyManager manager, Set<OWLOntology> ontologies) { + this( manager, ontologies, null, true ); + } + + public PelletExplanationGenerator(OWLOntologyManager manager, Set<OWLOntology> ontologies, boolean useGlassBox) { + this( manager, ontologies, null, useGlassBox ); + } + + private PelletExplanationGenerator(OWLOntologyManager manager, Set<OWLOntology> ontologies, Reasoner reasoner, boolean useGlassBox) { + + + // If there is no existing reasoner create a new one and load the ontologies + if( reasoner == null ) { + reasoner = new Reasoner( manager ); + reasoner.loadOntologies( ontologies ); + } + + // Create a single explanation generator + TransactionAwareSingleExpGen singleExp = useGlassBox + ? new GlassBoxExplanation( manager ) + : new BlackBoxExplanation( manager ); + + // Create multiple explanation generator + expGen = new HSTExplanationGenerator( singleExp ); + + // Set the necessary fields + expGen.setReasonerFactory( new PelletReasonerFactory() ); + expGen.setReasoner( reasoner ); + expGen.setOntologies( ontologies ); + + // Create the converter that will translate axioms into class expressions + converter = new SatisfiabilityConverter( manager.getOWLDataFactory() ); + setup(); + } + + public PelletExplanationGenerator(Reasoner reasoner) { + this( reasoner.getManager(), reasoner.getLoadedOntologies(), reasoner, true ); + } + + public PelletExplanationGenerator(Reasoner reasoner, boolean useGlassBox) { + this( reasoner.getManager(), reasoner.getLoadedOntologies(), reasoner, useGlassBox ); + } + + @Override + public Explanation getExplanation(OWLAxiom entailment) { + OWLDescription unsatClass = converter.convert( entailment ); + return new Explanation( entailment, expGen.getExplanation( unsatClass )); + } + + @Override + public Set<Explanation> getExplanations(OWLAxiom entailment) { + OWLDescription unsatClass = converter.convert( entailment ); + Set<Explanation> explanations = new HashSet<Explanation>(); + for(Set<OWLAxiom> axioms : expGen.getExplanations( unsatClass )){ + explanations.add(new Explanation(entailment, axioms)); + } + return explanations; + } + + @Override + public Set<Explanation> getExplanations(OWLAxiom entailment, int limit) { + OWLDescription unsatClass = converter.convert( entailment ); + Set<Explanation> explanations = new HashSet<Explanation>(); + for(Set<OWLAxiom> axioms : expGen.getExplanations( unsatClass, limit)){ + explanations.add(new Explanation(entailment, axioms)); + } + return explanations; + } + + public static void main(String[] args) throws OWLOntologyCreationException{ + OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); + OWLDataFactory factory = manager.getOWLDataFactory(); + OWLOntology ontology = manager.loadOntologyFromPhysicalURI(URI.create("file:examples/ore/tambis.owl")); + Reasoner reasoner = new org.mindswap.pellet.owlapi.PelletReasonerFactory().createReasoner(manager); + reasoner.loadOntology(ontology); + PelletExplanationGenerator expGen = new PelletExplanationGenerator(reasoner); + + + + OWLClass unsat = factory.getOWLClass(URI.create("http://krono.act.uji.es/Links/ontologies/tambis.owl#metal")); + OWLAxiom entailment = factory.getOWLSubClassAxiom(unsat, factory.getOWLNothing()); + System.out.println(expGen.getExplanation(entailment)); + } + + +} Modified: trunk/src/dl-learner/org/dllearner/tools/ore/explanation/laconic/LaconicExplanationGenerator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/explanation/laconic/LaconicExplanationGenerator.java 2009-08-18 15:32:20 UTC (rev 1828) +++ trunk/src/dl-learner/org/dllearner/tools/ore/explanation/laconic/LaconicExplanationGenerator.java 2009-08-24 09:19:17 UTC (rev 1829) @@ -7,7 +7,9 @@ import java.util.Map; import java.util.Set; +import org.dllearner.tools.ore.explanation.Explanation; import org.dllearner.tools.ore.explanation.ExplanationException; +import org.dllearner.tools.ore.explanation.PelletExplanationGenerator; import org.semanticweb.owl.apibinding.OWLManager; import org.semanticweb.owl.inference.OWLReasonerFactory; import org.semanticweb.owl.model.OWLAxiom; @@ -21,16 +23,14 @@ import org.semanticweb.owl.model.OWLOntologyManager; import org.semanticweb.owl.model.OWLSubClassAxiom; -import com.clarkparsia.explanation.PelletExplanation; - public class LaconicExplanationGenerator { - private PelletExplanation pelletExplanation; + private PelletExplanationGenerator pelletExplanation; private OWLOntologyManager manager; private OWLOntology ontology; - private Set<Set<OWLAxiom>> lastRegularJusts; - private Set<Set<OWLAxiom>> allPreviouslyFoundJustifications; + private Set<Explanation> lastRegularExplanations; + private Set<Explanation> allPreviouslyFoundExplanations; private OPlus oPlus; public LaconicExplanationGenerator(OWLOntologyManager manager, @@ -48,8 +48,8 @@ e.printStackTrace(); } - pelletExplanation = new PelletExplanation(manager, ontologies); - lastRegularJusts = new HashSet<Set<OWLAxiom>>(); + pelletExplanation = new PelletExplanationGenerator(manager, ontologies); + lastRegularExplanations = new HashSet<Explanation>(); } /** @@ -70,8 +70,8 @@ } - public Set<Set<OWLAxiom>> getLastRegularJustifications() { - return lastRegularJusts; + public Set<Explanation> getLastRegularJustifications() { + return lastRegularExplanations; } /** @@ -81,39 +81,39 @@ * @return * @throws OWLException */ - public Set<Set<OWLAxiom>> computePreciseJusts(OWLAxiom entailment, int limit) + public Set<Explanation> computePreciseJusts(OWLAxiom entailment, int limit) throws OWLException { - Set<Set<OWLAxiom>> regularJusts = pelletExplanation - .getEntailmentExplanations((OWLAxiom) entailment); + Set<Explanation> regularExplanations = pelletExplanation + .getExplanations((OWLAxiom) entailment); System.out.println(new StringBuilder().append( - "Got regular justifications: ").append(regularJusts.size()) + "Got regular justifications: ").append(regularExplanations.size()) .toString()); - lastRegularJusts.clear(); - lastRegularJusts.addAll(regularJusts); - allPreviouslyFoundJustifications = new HashSet<Set<OWLAxiom>>(); - allPreviouslyFoundJustifications.addAll(regularJusts); - Set<Set<OWLAxiom>> nonLaconicJusts = new HashSet<Set<OWLAxiom>>(); - Set<Set<OWLAxiom>> laconicJusts = new HashSet<Set<OWLAxiom>>(); + lastRegularExplanations.clear(); + lastRegularExplanations.addAll(regularExplanations); + allPreviouslyFoundExplanations = new HashSet<Explanation>(); + allPreviouslyFoundExplanations.addAll(regularExplanations); + Set<Explanation> nonLaconicExplanations = new HashSet<Explanation>(); + Set<Explanation> laconicExplanations = new HashSet<Explanation>(); Set<OWLAxiom> axiomsInPreviousOntology = new HashSet<OWLAxiom>(); long counter = 0L; for (;;) { counter++; System.out.println(new StringBuilder().append("Count ").append( counter).toString()); - Set<OWLAxiom> unionOfAllJustifications = new HashSet<OWLAxiom>(); - for (Set<OWLAxiom> just : allPreviouslyFoundJustifications) { - unionOfAllJustifications.addAll(just); + Set<OWLAxiom> unionOfAllExplanations = new HashSet<OWLAxiom>(); + for (Explanation expl : allPreviouslyFoundExplanations) { + unionOfAllExplanations.addAll(expl.getAxioms()); } // Set<OWLAxiom> lastOPlus = new // HashSet<OWLAxiom>(computeOPlus(unionOfAllJustifications)); - Set<OWLAxiom> oPlus = computeOPlus(unionOfAllJustifications); + Set<OWLAxiom> oPlus = computeOPlus(unionOfAllExplanations); OWLOntologyManager man2 = OWLManager.createOWLOntologyManager(); OWLOntology extendedOntology = man2.createOntology(oPlus); for (OWLLogicalAxiom logAx : ontology.getLogicalAxioms()) { - if (!unionOfAllJustifications.contains(logAx) + if (!unionOfAllExplanations.contains(logAx) || oPlus.contains(logAx)) { man2.addAxiom(extendedOntology, logAx); } @@ -130,65 +130,67 @@ axiomsInPreviousOntology.clear(); axiomsInPreviousOntology .addAll(extendedOntology.getLogicalAxioms()); - Set<Set<OWLAxiom>> allPrevJustsCopy = new HashSet<Set<OWLAxiom>>( - allPreviouslyFoundJustifications); + Set<Explanation> allPrevJustsCopy = new HashSet<Explanation>( + allPreviouslyFoundExplanations); Set<OWLOntology> ont2 = new HashSet<OWLOntology>(); ont2.add(extendedOntology); - PelletExplanation expGen = new PelletExplanation(man2, ont2); - Set<Set<OWLAxiom>> currentJustifications = expGen - .getEntailmentExplanations((OWLAxiom) entailment); + PelletExplanationGenerator expGen = new PelletExplanationGenerator(man2, ont2); + Set<Explanation> currentExplanations = expGen + .getExplanations((OWLAxiom) entailment); - allPreviouslyFoundJustifications.addAll(currentJustifications); - if (allPreviouslyFoundJustifications.equals(allPrevJustsCopy)) { + allPreviouslyFoundExplanations.addAll(currentExplanations); + if (allPreviouslyFoundExplanations.equals(allPrevJustsCopy)) { break; } - for (Set<OWLAxiom> currentJust : currentJustifications) { - if (!laconicJusts.contains(currentJust) - && !nonLaconicJusts.contains(currentJust)) { - if (isLaconic(currentJust, entailment)) { - laconicJusts.add(currentJust); + for (Explanation currentExplanation : currentExplanations) { + if (!laconicExplanations.contains(currentExplanation) + && !nonLaconicExplanations.contains(currentExplanation)) { + if (isLaconic(currentExplanation)) { + laconicExplanations.add(currentExplanation); } else { - nonLaconicJusts.add(currentJust); + nonLaconicExplanations.add(currentExplanation); } - if (laconicJusts.size() == limit) { - return retrieveAxioms(laconicJusts); + if (laconicExplanations.size() == limit) { + return laconicExplanations;//retrieveAxioms(laconicJusts); } } } } - Set<Set<OWLAxiom>> laconicJustifications = new HashSet<Set<OWLAxiom>>(); - for (Set<OWLAxiom> just : allPreviouslyFoundJustifications) { - if (!nonLaconicJusts.contains(just)) { - if (laconicJusts.contains(just)) { - laconicJustifications.add(just); - } else if (isLaconic(just, entailment)) { - laconicJustifications.add(just); + Set<Explanation> explanations = new HashSet<Explanation>(); + for (Explanation explanation : allPreviouslyFoundExplanations) { + if (!nonLaconicExplanations.contains(explanation)) { + if (laconicExplanations.contains(explanation)) { + explanations.add(explanation); + } else if (isLaconic(explanation)) { + explanations.add(explanation); } } } - return retrieveAxioms(laconicJustifications); + return retrieveAxioms(explanations); } - public boolean isLaconic(Set<OWLAxiom> justification, OWLAxiom entailment) + public boolean isLaconic(Explanation explanation) throws ExplanationException { boolean laconic; try { OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); - Set<OWLAxiom> justificationSigmaClosure = computeOPlus(justification); + Set<OWLAxiom> justificationSigmaClosure = computeOPlus(explanation.getAxioms()); OWLOntology justificationSigmaClosureOnt = manager .createOntology(justificationSigmaClosure); - PelletExplanation expGen2 = new PelletExplanation(manager, + PelletExplanationGenerator expGen2 = new PelletExplanationGenerator(manager, Collections.singleton(justificationSigmaClosureOnt)); - Set<Set<OWLAxiom>> exps = expGen2.getEntailmentExplanations( - entailment, Integer.MAX_VALUE); +// Set<Set<OWLAxiom>> exps = expGen2.getEntailmentExplanations( +// entailment, 2); + Explanation expl = expGen2.getExplanation(explanation.getEntailment()); - laconic = Collections.singleton(justification).equals(exps); +// laconic = Collections.singleton(justification).equals(exps); + laconic = explanation.equals(expl); } catch (OWLOntologyCreationException e) { throw new ExplanationException(e); @@ -198,23 +200,23 @@ return laconic; } - private Set<Set<OWLAxiom>> retrieveAxioms(Set<Set<OWLAxiom>> explanations) { + private Set<Explanation> retrieveAxioms(Set<Explanation> explanations) { Map<OWLAxiom, Set<OWLAxiom>> sourceAxioms2OPlus = new HashMap<OWLAxiom, Set<OWLAxiom>>(); - for (Set<OWLAxiom> just : allPreviouslyFoundJustifications) { - for (OWLAxiom ax : just) { + for (Explanation explanation : allPreviouslyFoundExplanations) { + for (OWLAxiom ax : explanation.getAxioms()) { if (ontology.containsAxiom(ax)) { sourceAxioms2OPlus.put(ax, computeOPlus(Collections.singleton(ax))); } } } - Set<Set<OWLAxiom>> reconstituedExplanations = new HashSet<Set<OWLAxiom>>(); + Set<Explanation> reconstituedExplanations = new HashSet<Explanation>(); - for (Set<OWLAxiom> expl : explanations) { + for (Explanation explanation : explanations) { Map<OWLClass, Map<OWLAxiom, Set<OWLSubClassAxiom>>> lhs2SubClassAxiom = new HashMap<OWLClass, Map<OWLAxiom, Set<OWLSubClassAxiom>>>(); Set<OWLAxiom> reconstituedAxioms = new HashSet<OWLAxiom>(); - for (OWLAxiom laconicAx : expl) { + for (OWLAxiom laconicAx : explanation.getAxioms()) { if (laconicAx instanceof OWLSubClassAxiom) { OWLSubClassAxiom subAx = (OWLSubClassAxiom) laconicAx; if (subAx.getSubClass().isAnonymous()) { @@ -262,7 +264,7 @@ } } - reconstituedExplanations.add(reconstituedAxioms); + reconstituedExplanations.add(new Explanation(explanation.getEntailment(), reconstituedAxioms)); } @@ -271,39 +273,39 @@ - public Set<Set<OWLAxiom>> getExplanations(OWLAxiom entailment) throws ExplanationException { - Set<Set<OWLAxiom>> set; + public Set<Explanation> getExplanations(OWLAxiom entailment) throws ExplanationException { + Set<Explanation> explanations; try { - set = computePreciseJusts(entailment, 2147483647); + explanations = computePreciseJusts(entailment, 2147483647); } catch (OWLException e) { throw new ExplanationException(e); } - return set; + return explanations; } - public Set<Set<OWLAxiom>> getExplanations(OWLAxiom entailment, int limit) + public Set<Explanation> getExplanations(OWLAxiom entailment, int limit) throws ExplanationException { - Set<Set<OWLAxiom>> set; + Set<Explanation> explanations; try { - set = computePreciseJusts(entailment, limit); + explanations = computePreciseJusts(entailment, limit); } catch (OWLException e) { throw new ExplanationException(e); } - return set; + return explanations; } - public Set<Set<OWLAxiom>> getRegularExplanations(OWLAxiom entailment) throws ExplanationException { - Set<Set<OWLAxiom>> regularJusts; - regularJusts = pelletExplanation.getEntailmentExplanations((OWLAxiom)entailment); - lastRegularJusts.addAll(regularJusts); + public Set<Explanation> getRegularExplanations(OWLAxiom entailment) throws ExplanationException { + Set<Explanation> regularJusts; + regularJusts = pelletExplanation.getExplanations((OWLAxiom)entailment); + lastRegularExplanations.addAll(regularJusts); return regularJusts; } - public void returnSourceAxioms(Set<Set<OWLAxiom>> explanations){ + public void returnSourceAxioms(Set<Explanation> explanations){ Map<OWLAxiom, Set<OWLAxiom>> sourceMap = oPlus.getAxiomsMap(); System.out.println(sourceMap); - for(Set<OWLAxiom> explanation: explanations){ - for(OWLAxiom ax : explanation){ + for(Explanation explanation: explanations){ + for(OWLAxiom ax : explanation.getAxioms()){ System.out.println(ax + " gehört zu " + sourceMap.get(ax)); } Added: trunk/src/dl-learner/org/dllearner/tools/ore/recent.txt =================================================================== (Binary files differ) Property changes on: trunk/src/dl-learner/org/dllearner/tools/ore/recent.txt ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/src/dl-learner/org/dllearner/tools/ore/toggled.gif =================================================================== (Binary files differ) Property changes on: trunk/src/dl-learner/org/dllearner/tools/ore/toggled.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: trunk/src/dl-learner/org/dllearner/tools/ore/ui/ClassesTable.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ui/ClassesTable.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/ClassesTable.java 2009-08-24 09:19:17 UTC (rev 1829) @@ -0,0 +1,42 @@ +package org.dllearner.tools.ore.ui; + +import java.awt.Color; +import java.util.Set; + +import javax.swing.ListSelectionModel; + +import org.dllearner.core.owl.NamedClass; +import org.jdesktop.swingx.JXTable; +import org.jdesktop.swingx.decorator.HighlighterFactory; + +public class ClassesTable ext... [truncated message content] |
From: <lor...@us...> - 2009-08-18 15:32:44
|
Revision: 1828 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1828&view=rev Author: lorenz_b Date: 2009-08-18 15:32:20 +0000 (Tue, 18 Aug 2009) Log Message: ----------- added closed world assumption option to PelletReasoner as it is used in FastInstanceChecker integrated modularity approach to compute explanations in a smaller set of logical axioms provided recentmanager for former used knowledgebases renamed main application class to OREApplication cleaned up ORE-helper class and renamed it to OREManager Modified Paths: -------------- trunk/doc/configOptions.txt trunk/src/dl-learner/org/dllearner/core/configurators/PelletReasonerConfigurator.java trunk/src/dl-learner/org/dllearner/reasoning/OWLAPIReasoner.java trunk/src/dl-learner/org/dllearner/reasoning/PelletReasoner.java trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationManager.java trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ORE.java trunk/src/dl-learner/org/dllearner/tools/ore/SPARQLTest.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/laconic/LaconicExplanationGenerator.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/relevance/SyntacticRelevanceBasedExplanationGenerator.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/DescriptionLabel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExplanationTable.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/ImpactTable.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/OWLSyntaxTableCellRenderer.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/RepairDialog.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/RepairTable.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/StatusBar.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/StatusBarSimulator.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/WizardController.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/WizardModel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/ClassPanelOWLDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/InconsistencyExplanationPanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/KnowledgeSourcePanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/LearningPanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/RepairPanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/SavePanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/UnsatisfiableExplanationPanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/DescriptionPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/KnowledgeSourcePanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/UnsatisfiableExplanationPanel.java Added Paths: ----------- trunk/endpoints.txt trunk/examples/ore/tambis.owl trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationManagerListener.java trunk/src/dl-learner/org/dllearner/tools/ore/OREApplication.java trunk/src/dl-learner/org/dllearner/tools/ore/OREManager.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/CachedExplanationGenerator.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/ExplanationGenerator.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/LinkLabel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/MetricsPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/MetricsTableModel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/ReasonerProgressUI.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/RecentManager.java Removed Paths: ------------- trunk/src/dl-learner/org/dllearner/tools/ore/Main.java Modified: trunk/doc/configOptions.txt =================================================================== --- trunk/doc/configOptions.txt 2009-08-17 17:45:45 UTC (rev 1827) +++ trunk/doc/configOptions.txt 2009-08-18 15:32:20 UTC (rev 1828) @@ -215,6 +215,18 @@ conf file usage: owlAPIReasoner.reasonerType = pellet; +component: unnamed component (org.dllearner.reasoning.PelletReasoner) +===================================================================== + +conf file usage: reasoner = null; + +option name: defaultNegation +description: Whether to use default negation, i.e. an instance not being in a class means that it is in the negation of the class. +allowed values: boolean +default value: true +conf file usage: null.defaultNegation = true; + + ********************* * Learning Problems * ********************* @@ -236,7 +248,13 @@ default value: equivalence conf file usage: classLearning.type = equivalence; +option name: useApproximations +description: whether to use stochastic approximations for computing accuracy +allowed values: boolean +default value: true +conf file usage: classLearning.useApproximations = true; + component: pos neg learning problem (org.dllearner.learningproblems.PosNegLPStandard) ===================================================================================== @@ -469,6 +487,24 @@ conf file usage: algorithm = el; +component: disjunctive EL learning algorithm (org.dllearner.algorithms.el.ELLearningAlgorithmDisjunctive) +========================================================================================================= + +conf file usage: algorithm = disjunctiveEL; + +option name: noisePercentage +description: the (approximated) percentage of noise within the examples +allowed values: double min 0.0 max 100.0 +default value: 0.0 +conf file usage: disjunctiveEL.noisePercentage = 0.0; + +option name: startClass +description: the named class which should be used to start the algorithm (GUI: needs a widget for selecting a class) +allowed values: String [] +default value: not set +conf file usage: disjunctiveEL.startClass = ; + + component: genetic programming learning algorithm (org.dllearner.algorithms.gp.GP) ================================================================================== @@ -882,6 +918,12 @@ default value: true conf file usage: refexamples.useDoubleDatatypes = true; +option name: useStringDatatypes +description: specifies whether string datatypes are used in the learning algorothm +allowed values: boolean +default value: false +conf file usage: refexamples.useStringDatatypes = false; + option name: maxExecutionTimeInSeconds description: algorithm will stop after specified seconds allowed values: int Added: trunk/endpoints.txt =================================================================== --- trunk/endpoints.txt (rev 0) +++ trunk/endpoints.txt 2009-08-18 15:32:20 UTC (rev 1828) @@ -0,0 +1,12 @@ +DEBUG - sending query: length: 44 | ENDPOINT: http://www4.wiwiss.fu-berlin.de/dblp/sparql +INFO - finished 1 of 19 +DEBUG - sending query: length: 44 | ENDPOINT: http://dbpedia.org/sparql +INFO - finished 2 of 19 +DEBUG - sending query: length: 44 | ENDPOINT: http://doapspace.org/sparql +DEBUG - RuntimeException in SparqlQuery (see /log/sparql.txt): HttpException: HttpException: 404 Not Found: rethrew: HttpException: 404 Not Found +DEBUG - query was (max. 300 chars displayed) SELECT DISTINCT ?c WHERE {[] a ?c }LIMIT 10 +WARN - rethrew: HttpException: 404 Not Found +INFO - ************** +INFO - endpoint working: http://dbpedia.org/sparql (more than 100 concepts ) needed 20405 ms +INFO - endpoint working: http://www4.wiwiss.fu-berlin.de/dblp/sparql (about 4 concepts ) needed 1756 ms +INFO - endpoint NOT working: http://doapspace.org/sparql needed 583 ms Added: trunk/examples/ore/tambis.owl =================================================================== --- trunk/examples/ore/tambis.owl (rev 0) +++ trunk/examples/ore/tambis.owl 2009-08-18 15:32:20 UTC (rev 1828) @@ -0,0 +1,6051 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<rdf:RDF + xmlns:owl="http://www.w3.org/2002/07/owl#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" + xmlns:xsd="http://www.w3.org/2001/XMLSchema#" + xmlns="http://krono.act.uji.es/Links/ontologies/tambis.owl#" + xml:base="http://krono.act.uji.es/Links/ontologies/tambis.owl"> + <owl:Ontology rdf:about=""/> + <owl:Class rdf:about="#physical-substance"> + <rdfs:subClassOf> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="#physical"/> + <owl:Class rdf:about="#substance"/> + </owl:intersectionOf> + </owl:Class> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#enzyme-inhibitor"> + <rdfs:subClassOf> + <owl:Class rdf:about="#regulation"/> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#sodium"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="#chemical"/> + <owl:Restriction> + <owl:onProperty rdf:resource="#atomic-number"/> + <owl:cardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">1</owl:cardinality> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="#atomic-number"/> + <owl:someValuesFrom rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + <owl:Class rdf:about="#biological-compartment"> + <rdfs:subClassOf> + <owl:Class rdf:about="#biological-space"/> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#vanadium"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="#chemical"/> + <owl:Restriction> + <owl:onProperty rdf:resource="#atomic-number"/> + <owl:cardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">1</owl:cardinality> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="#atomic-number"/> + <owl:someValuesFrom rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + <owl:Class rdf:about="#amino-transfer"> + <rdfs:subClassOf> + <owl:Class rdf:about="#inter-molecule-transfer"/> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#physicochemical-selector"> + <rdfs:subClassOf> + <owl:Class rdf:about="#selector"/> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#nucleus"> + <rdfs:subClassOf> + <owl:Class rdf:about="#biological-structure"/> + </rdfs:subClassOf> + <rdfs:subClassOf> + <owl:Restriction> + <owl:onProperty rdf:resource="#part-of"/> + <owl:someValuesFrom> + <owl:Class rdf:about="#cell"/> + </owl:someValuesFrom> + </owl:Restriction> + </rdfs:subClassOf> + <rdfs:subClassOf> + <owl:Restriction> + <owl:onProperty rdf:resource="#part-of"/> + <owl:allValuesFrom> + <owl:Class rdf:about="#cell"/> + </owl:allValuesFrom> + </owl:Restriction> + </rdfs:subClassOf> + <rdfs:subClassOf> + <owl:Restriction> + <owl:onProperty rdf:resource="#has-classification"/> + <owl:someValuesFrom> + <owl:Class rdf:about="#eukaryote"/> + </owl:someValuesFrom> + </owl:Restriction> + </rdfs:subClassOf> + <rdfs:subClassOf> + <owl:Restriction> + <owl:onProperty rdf:resource="#has-classification"/> + <owl:allValuesFrom> + <owl:Class rdf:about="#eukaryote"/> + </owl:allValuesFrom> + </owl:Restriction> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#species"> + <rdfs:subClassOf> + <owl:Class rdf:about="#organism-classification"/> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#hydrophilic"> + <rdfs:subClassOf> + <owl:Class rdf:about="#hydrophobicity-property"/> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#hydrophobic"> + <rdfs:subClassOf> + <owl:Class rdf:about="#hydrophobicity-property"/> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#time-unit"> + <rdfs:subClassOf> + <owl:Class rdf:about="#unit"/> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#biological-classification"> + <rdfs:subClassOf> + <owl:Class rdf:about="#mental-organisation"/> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#complement-dna"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="#macromolecular-compound"/> + <owl:Restriction> + <owl:onProperty rdf:resource="#polymer-of"/> + <owl:someValuesFrom> + <owl:Class rdf:about="#deoxy-nucleotide"/> + </owl:someValuesFrom> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="#polymer-of"/> + <owl:allValuesFrom> + <owl:Class rdf:about="#deoxy-nucleotide"/> + </owl:allValuesFrom> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="#strandedness"/> + <owl:someValuesFrom> + <owl:Class rdf:about="#single-stranded"/> + </owl:someValuesFrom> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="#reverse-transcribed-from"/> + <owl:cardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">1</owl:cardinality> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="#reverse-transcribed-from"/> + <owl:allValuesFrom> + <owl:Class> + <owl:unionOf rdf:parseType="Collection"> + <owl:Class rdf:about="#messenger-rna"/> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Restriction> + <owl:onProperty rdf:resource="#part-of"/> + <owl:cardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">1</owl:cardinality> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="#part-of"/> + <owl:allValuesFrom> + <owl:Class rdf:about="#messenger-rna"/> + </owl:allValuesFrom> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:unionOf> + </owl:Class> + </owl:allValuesFrom> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + <owl:Class rdf:about="#small-organic-molecular-compound"> + <rdfs:subClassOf> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="#organic-molecular-compound"/> + <owl:Class rdf:about="#small-molecular-compound"/> + </owl:intersectionOf> + </owl:Class> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#sulphur"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="#chemical"/> + <owl:Restriction> + <owl:onProperty rdf:resource="#atomic-number"/> + <owl:cardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">1</owl:cardinality> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="#atomic-number"/> + <owl:someValuesFrom rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + <owl:Class rdf:about="#journal-name"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="#name"/> + <owl:Restriction> + <owl:onProperty rdf:resource="#name-of"/> + <owl:someValuesFrom> + <owl:Class rdf:about="#journal"/> + </owl:someValuesFrom> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="#name-of"/> + <owl:allValuesFrom> + <owl:Class rdf:about="#journal"/> + </owl:allValuesFrom> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + <owl:Class rdf:about="#structure"> + <rdfs:subClassOf> + <owl:Class rdf:about="http://www.w3.org/2002/07/owl#Thing"/> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#trivalent-cation"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="#chemical"/> + <owl:Restriction> + <owl:onProperty rdf:resource="#has-charge"/> + <owl:cardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">3</owl:cardinality> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="#has-charge"/> + <owl:someValuesFrom> + <owl:Class rdf:about="#positive-charge"/> + </owl:someValuesFrom> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + <owl:Class rdf:about="#hydrophobicity-property"> + <rdfs:subClassOf> + <owl:Class rdf:about="#physicochemical-property"/> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#nucleotide"> + <rdfs:subClassOf> + <owl:Class rdf:about="#small-organic-molecular-compound"/> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#storage-protein"> + <rdfs:subClassOf> + <owl:Class rdf:about="#biological-function"/> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#gene-name"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="#name"/> + <owl:Restriction> + <owl:onProperty rdf:resource="#name-of"/> + <owl:someValuesFrom> + <owl:Class rdf:about="#gene"/> + </owl:someValuesFrom> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="#name-of"/> + <owl:allValuesFrom> + <owl:Class rdf:about="#gene"/> + </owl:allValuesFrom> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + <owl:Class rdf:about="#gene-part"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="#dna-part"/> + <owl:Restriction> + <owl:onProperty rdf:resource="#part-of"/> + <owl:someValuesFrom> + <owl:Class rdf:about="#gene"/> + </owl:someValuesFrom> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="#part-of"/> + <owl:allValuesFrom> + <owl:Class rdf:about="#gene"/> + </owl:allValuesFrom> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + <owl:Class rdf:about="#property"> + <rdfs:subClassOf> + <owl:Class rdf:about="#modifier"/> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#physical"> + <rdfs:subClassOf> + <owl:Class rdf:about="http://www.w3.org/2002/07/owl#Thing"/> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#restriction-endonuclease-site"> + <rdfs:subClassOf> + <owl:Class rdf:about="#dna-site"/> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#alkali-metal"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="#chemical"/> + <owl:Restriction> + <owl:onProperty rdf:resource="#atomic-number"/> + <owl:cardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">1</owl:cardinality> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="#atomic-number"/> + <owl:someValuesFrom rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + <owl:Class rdf:about="#ether-bond-hydrolysis"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="#reaction"/> + <owl:Restriction> + <owl:onProperty rdf:resource="#hydrolysis-of"/> + <owl:someValuesFrom> + <owl:Class rdf:about="#ether-bond"/> + </owl:someValuesFrom> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + <owl:Class rdf:about="#small-nuclear-rna-function"> + <rdfs:subClassOf> + <owl:Class rdf:about="#biological-function"/> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#prosthetic-group"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="#cofactor"/> + <owl:Class> + <owl:complementOf> + <owl:Class rdf:about="#metal-ion"/> + </owl:complementOf> + </owl:Class> + </owl:intersectionOf> + </owl:Class> + <owl:Restriction> + <owl:onProperty rdf:resource="#binds-strongly"/> + <owl:someValuesFrom> + <owl:Class rdf:about="#protein"/> + </owl:someValuesFrom> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="#binds-strongly"/> + <owl:allValuesFrom> + <owl:Class rdf:about="#protein"/> + </owl:allValuesFrom> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + <owl:Class rdf:about="#macromolecular-compound"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="#molecule"/> + <owl:Class rdf:about="#compound"/> + </owl:intersectionOf> + </owl:Class> + <owl:Restriction> + <owl:onProperty rdf:resource="#has-molecular-weight"/> + <owl:cardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">1</owl:cardinality> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="#has-molecular-weight"/> + <owl:someValuesFrom rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="#polymer-of"/> + <owl:someValuesFrom> + <owl:Class rdf:about="#small-organic-molecular-compound"/> + </owl:someValuesFrom> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="#polymer-of"/> + <owl:allValuesFrom> + <owl:Class rdf:about="#small-organic-molecular-compound"/> + </owl:allValuesFrom> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="#has-length"/> + <owl:cardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">1</owl:cardinality> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="#has-length"/> + <owl:someValuesFrom> + <owl:Class rdf:about="#residue-number"/> + </owl:someValuesFrom> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + <owl:Class rdf:about="#enzyme-function"> + <rdfs:subClassOf> + <owl:Class rdf:about="#biological-function"/> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#thioester-bond"> + <rdfs:subClassOf> + <owl:Class rdf:about="#covalent-bond"/> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#element"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="#chemical"/> + <owl:Restriction> + <owl:onProperty rdf:resource="#atom-type"/> + <owl:someValuesFrom rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + <owl:Class rdf:about="#alpha-helix"> + <rdfs:subClassOf> + <owl:Class rdf:about="#protein-secondary-structure"/> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#carbon-sulfur-lysis"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="#reaction"/> + <owl:Restriction> + <owl:onProperty rdf:resource="#lysis-of"/> + <owl:someValuesFrom> + <owl:Class rdf:about="#carbon-sulphur-bond"/> + </owl:someValuesFrom> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + <owl:Class rdf:about="#protein-binding-site"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="#binding-site"/> + <owl:Restriction> + <owl:onProperty rdf:resource="#binds"/> + <owl:minCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">1</owl:minCardinality> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="#binds"/> + <owl:someValuesFrom> + <owl:Class rdf:about="#protein"/> + </owl:someValuesFrom> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + <owl:Class rdf:about="#reaction"> + <rdfs:subClassOf> + <owl:Class rdf:about="#physical-process"/> + </rdfs:subClassOf> + <rdfs:subClassOf> + <owl:Restriction> + <owl:onProperty rdf:resource="#transforms"/> + <owl:someValuesFrom> + <owl:Class rdf:about="#chemical"/> + </owl:someValuesFrom> + </owl:Restriction> + </rdfs:subClassOf> + <rdfs:subClassOf> + <owl:Restriction> + <owl:onProperty rdf:resource="#transforms"/> + <owl:allValuesFrom> + <owl:Class rdf:about="#chemical"/> + </owl:allValuesFrom> + </owl:Restriction> + </rdfs:subClassOf> + <rdfs:subClassOf> + <owl:Restriction> + <owl:onProperty rdf:resource="#has-product"/> + <owl:someValuesFrom> + <owl:Class rdf:about="#chemical"/> + </owl:someValuesFrom> + </owl:Restriction> + </rdfs:subClassOf> + <rdfs:subClassOf> + <owl:Restriction> + <owl:onProperty rdf:resource="#has-product"/> + <owl:allValuesFrom> + <owl:Class rdf:about="#chemical"/> + </owl:allValuesFrom> + </owl:Restriction> + </rdfs:subClassOf> + <rdfs:subClassOf> + <owl:Restriction> + <owl:onProperty rdf:resource="#has-substrate"/> + <owl:someValuesFrom> + <owl:Class rdf:about="#chemical"/> + </owl:someValuesFrom> + </owl:Restriction> + </rdfs:subClassOf> + <rdfs:subClassOf> + <owl:Restriction> + <owl:onProperty rdf:resource="#has-substrate"/> + <owl:allValuesFrom> + <owl:Class rdf:about="#chemical"/> + </owl:allValuesFrom> + </owl:Restriction> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#angstrom"> + <rdfs:subClassOf> + <owl:Class rdf:about="#length-unit"/> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#modification-site"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="#protein-part"/> + <owl:Restriction> + <owl:onProperty rdf:resource="#target-for"/> + <owl:someValuesFrom> + <owl:Class> + <owl:unionOf rdf:parseType="Collection"> + <owl:Class rdf:about="#inter-molecule-transfer"/> + <owl:Class rdf:about="#oxidation-and-reduction"/> + </owl:unionOf> + </owl:Class> + </owl:someValuesFrom> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + <owl:Class rdf:about="#ribosome-binding-site"> + <rdfs:subClassOf> + <owl:Class rdf:about="#rna-part"/> + </rdfs:subClassOf> + <rdfs:subClassOf> + <owl:Restriction> + <owl:onProperty rdf:resource="#part-of"/> + <owl:someValuesFrom> + <owl:Class rdf:about="#messenger-rna"/> + </owl:someValuesFrom> + </owl:Restriction> + </rdfs:subClassOf> + <rdfs:subClassOf> + <owl:Restriction> + <owl:onProperty rdf:resource="#binds"/> + <owl:cardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">1</owl:cardinality> + </owl:Restriction> + </rdfs:subClassOf> + <rdfs:subClassOf> + <owl:Restriction> + <owl:onProperty rdf:resource="#binds"/> + <owl:someValuesFrom> + <owl:Class rdf:about="#ribosome"/> + </owl:someValuesFrom> + </owl:Restriction> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#holoprotein"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="#macromolecular-compound"/> + <owl:Restriction> + <owl:onProperty rdf:resource="#polymer-of"/> + <owl:someValuesFrom> + <owl:Class rdf:about="#amino-acid"/> + </owl:someValuesFrom> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="#polymer-of"/> + <owl:allValuesFrom> + <owl:Class rdf:about="#amino-acid"/> + </owl:allValuesFrom> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="#has-bound"/> + <owl:minCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">1</owl:minCardinality> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="#has-bound"/> + <owl:someValuesFrom> + <owl:Class rdf:about="#prosthetic-group"/> + </owl:someValuesFrom> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + <owl:Class rdf:about="#coenzyme"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="#cofactor"/> + <owl:Restriction> + <owl:onProperty rdf:resource="#binds-loosely"/> + <owl:someValuesFrom> + <owl:Class rdf:about="#enzyme"/> + </owl:someValuesFrom> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="#binds-loosely"/> + <owl:allValuesFrom> + <owl:Class rdf:about="#enzyme"/> + </owl:allValuesFrom> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + <owl:Class rdf:about="#cofactor"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="#reaction-participant"/> + <owl:Class> + <owl:unionOf rdf:parseType="Collection"> + <owl:Class rdf:about="#metal-ion"/> + <owl:Class rdf:about="#small-organic-molecular-compound"/> + </owl:unionOf> + </owl:Class> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + <owl:Class rdf:about="#receptor"> + <rdfs:subClassOf> + <owl:Class rdf:about="#signal-transduction"/> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#glucosyl-transfer"> + <rdfs:subClassOf> + <owl:Class rdf:about="#inter-molecule-transfer"/> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#single-stranded-dna"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="#macromolecular-compound"/> + <owl:Restriction> + <owl:onProperty rdf:resource="#polymer-of"/> + <owl:someValuesFrom> + <owl:Class rdf:about="#deoxy-nucleotide"/> + </owl:someValuesFrom> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="#polymer-of"/> + <owl:allValuesFrom> + <owl:Class rdf:about="#deoxy-nucleotide"/> + </owl:allValuesFrom> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="#strandedness"/> + <owl:someValuesFrom> + <owl:Class rdf:about="#single-stranded"/> + </owl:someValuesFrom> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + <owl:Class rdf:about="#carbon-carbon-lysis"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="#reaction"/> + <owl:Restriction> + <owl:onProperty rdf:resource="#lysis-of"/> + <owl:someValuesFrom> + <owl:Class rdf:about="#carbon-carbon-bond"/> + </owl:someValuesFrom> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + <owl:Class rdf:about="#holoenzyme"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="#macromolecular-compound"/> + <owl:Restriction> + <owl:onProperty rdf:resource="#polymer-of"/> + <owl:someValuesFrom> + <owl:Class rdf:about="#amino-acid"/> + </owl:someValuesFrom> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="#polymer-of"/> + <owl:allValuesFrom> + <owl:Class rdf:about="#amino-acid"/> + </owl:allValuesFrom> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="#catalyses"/> + <owl:someValuesFrom> + <owl:Class rdf:about="#reaction"/> + </owl:someValuesFrom> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="#has-bound"/> + <owl:minCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">1</owl:minCardinality> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="#has-bound"/> + <owl:someValuesFrom> + <owl:Class rdf:about="#prosthetic-group"/> + </owl:someValuesFrom> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="#has-ec-number"/> + <owl:someValuesFrom> + <owl:Class rdf:about="#ec-number"/> + </owl:someValuesFrom> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + <owl:Class rdf:about="#substance"> + <rdfs:subClassOf> + <owl:Class rdf:about="http://www.w3.org/2002/07/owl#Thing"/> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#substrate"> + <rdfs:subClassOf> + <owl:Class rdf:about="#reaction-participant"/> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#regulation"> + <rdfs:subClassOf> + <owl:Class rdf:about="#biological-function"/> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#small-nucleolar-rna-function"> + <rdfs:subClassOf> + <owl:Class rdf:about="#biological-function"/> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#part-of-biological-structure"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="#biological-structure"/> + <owl:Restriction> + <owl:onProperty rdf:resource="#part-of"/> + <owl:someValuesFrom> + <owl:Class rdf:about="#biological-structure"/> + </owl:someValuesFrom> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="#part-of"/> + <owl:allValuesFrom> + <owl:Class rdf:about="#biological-structure"/> + </owl:allValuesFrom> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + <owl:Class rdf:about="#journal"> + <rdfs:subClassOf> + <owl:Class rdf:about="#published-material"/> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#biological-organisation"> + <rdfs:subClassOf> + <owl:Class rdf:about="#physical-organisation"/> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#membrane"> + <rdfs:subClassOf> + <owl:Class rdf:about="#cellular-part"/> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#binding-site"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="#protein-part"/> + <owl:Restriction> + <owl:onProperty rdf:resource="#target-for"/> + <owl:someValuesFrom> + <owl:Class rdf:about="#binding"/> + </owl:someValuesFrom> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + <owl:Class rdf:about="#peptide-bond-hydrolysis"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="#reaction"/> + <owl:Restriction> + <owl:onProperty rdf:resource="#hydrolysis-of"/> + <owl:someValuesFrom> + <owl:Class rdf:about="#peptide-bond"/> + </owl:someValuesFrom> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + <owl:Class rdf:about="#two-component-sensor-molecule"> + <rdfs:subClassOf> + <owl:Class rdf:about="#signal-transduction"/> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#modifier"> + <rdfs:subClassOf> + <owl:Class rdf:about="http://www.w3.org/2002/07/owl#Thing"/> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#prenylation-site"> + <rdfs:subClassOf> + <owl:Class rdf:about="#modification-site"/> + </rdfs:subClassOf> + <rdfs:subClassOf> + <owl:Restriction> + <owl:onProperty rdf:resource="#target-for"/> + <owl:someValuesFrom> + <owl:Class rdf:about="#inter-molecule-transfer"/> + </owl:someValuesFrom> + </owl:Restriction> + </rdfs:subClassOf> + <rdfs:subClassOf> + <owl:Restriction> + <owl:onProperty rdf:resource="#target-for"/> + <owl:someValuesFrom> + <owl:Class rdf:about="#inter-molecule-transfer"/> + </owl:someValuesFrom> + </owl:Restriction> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#compound"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="#chemical"/> + <owl:Restriction> + <owl:onProperty rdf:resource="#number-of-atoms"/> + <owl:someValuesFrom rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="#atom-type"/> + <owl:someValuesFrom rdf:resource="http://www.w3.org/2001/XMLSchema#string"/> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + <owl:Class rdf:about="#nucleic-acid-binding"> + <rdfs:subClassOf> + <owl:Class rdf:about="#binding"/> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#copper-divalent-cation"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="#chemical"/> + <owl:Restriction> + <owl:onProperty rdf:resource="#atomic-number"/> + <owl:someValuesFrom rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="#has-metal-class"/> + <owl:someValuesFrom> + <owl:Class rdf:about="#metal"/> + </owl:someValuesFrom> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="#has-charge"/> + <owl:cardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">2</owl:cardinality> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="#has-charge"/> + <owl:someValuesFrom> + <owl:Class rdf:about="#positive-charge"/> + </owl:someValuesFrom> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + <owl:Class rdf:about="#carbon-phosphorus-bond-hydrolysis"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="#reaction"/> + <owl:Restriction> + <owl:onProperty rdf:resource="#hydrolysis-of"/> + <owl:someValuesFrom> + <owl:Class rdf:about="#carbon-phosphorus-bond"/> + </owl:someValuesFrom> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + <owl:Class rdf:about="#lipid-attachment-site"> + <rdfs:subClassOf> + <owl:Class rdf:about="#modification-site"/> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#carbon-sulfur-bond"> + <rdfs:subClassOf> + <owl:Class rdf:about="#covalent-bond"/> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#chemical-structure"> + <rdfs:subClassOf> + <owl:Class rdf:about="#physical-structure"/> + </rdfs:subClassOf> + <rdfs:subClassOf> + <owl:Restriction> + <owl:onProperty rdf:resource="#structure-of"/> + <owl:someValuesFrom> + <owl:Class rdf:about="#chemical"/> + </owl:someValuesFrom> + </owl:Restriction> + </rdfs:subClassOf> + <rdfs:subClassOf> + <owl:Restriction> + <owl:onProperty rdf:resource="#structure-of"/> + <owl:allValuesFrom> + <owl:Class rdf:about="#chemical"/> + </owl:allValuesFrom> + </owl:Restriction> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#carbon-carbon-bond-formation"> + <rdfs:subClassOf> + <owl:Class rdf:about="#ligation"/> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#physical-organisation"> + <rdfs:subClassOf> + <owl:Class rdf:about="#physical-structure"/> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#transcription-factor-binding"> + <rdfs:subClassOf> + <owl:Class rdf:about="#binding"/> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#hydroxyl"> + <rdfs:subClassOf> + <owl:Class rdf:about="#ligand"/> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#cleaved-peptide"> + <rdfs:subClassOf> + <owl:Class rdf:about="#peptide"/> + </rdfs:subClassOf> + <rdfs:subClassOf> + <owl:Restriction> + <owl:onProperty rdf:resource="#part-of"/> + <owl:cardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">1</owl:cardinality> + </owl:Restriction> + </rdfs:subClassOf> + <rdfs:subClassOf> + <owl:Restriction> + <owl:onProperty rdf:resource="#part-of"/> + <owl:allValuesFrom> + <owl:Class rdf:about="#protein"/> + </owl:allValuesFrom> + </owl:Restriction> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#epimerisation"> + <rdfs:subClassOf> + <owl:Class rdf:about="#isomerisation"/> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#carboxylation-site"> + <rdfs:subClassOf> + <owl:Class rdf:about="#modification-site"/> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#physical-space"> + <rdfs:subClassOf> + <owl:Class rdf:about="#physical-structure"/> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#molecule"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="#chemical"/> + <owl:Restriction> + <owl:onProperty rdf:resource="#number-of-atoms"/> + <owl:someValuesFrom rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="#has-bond"/> + <owl:minCardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">1</owl:minCardinality> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="#has-bond"/> + <owl:someValuesFrom> + <owl:Class rdf:about="#covalent-bond"/> + </owl:someValuesFrom> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="#has-molecular-weight"/> + <owl:someValuesFrom> + <owl:Class rdf:about="#molecular-weight"/> + </owl:someValuesFrom> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + <owl:Class rdf:about="#astatine"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="#chemical"/> + <owl:Restriction> + <owl:onProperty rdf:resource="#atomic-number"/> + <owl:cardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">1</owl:cardinality> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="#atomic-number"/> + <owl:someValuesFrom rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + <owl:Class rdf:about="#sulphation-site"> + <rdfs:subClassOf> + <owl:Class rdf:about="#modification-site"/> + </rdfs:subClassOf> + <rdfs:subClassOf> + <owl:Restriction> + <owl:onProperty rdf:resource="#target-for"/> + <owl:someValuesFrom> + <owl:Class rdf:about="#inter-molecule-transfer"/> + </owl:someValuesFrom> + </owl:Restriction> + </rdfs:subClassOf> + <rdfs:subClassOf> + <owl:Restriction> + <owl:onProperty rdf:resource="#target-for"/> + <owl:someValuesFrom> + <owl:Class rdf:about="#inter-molecule-transfer"/> + </owl:someValuesFrom> + </owl:Restriction> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#endoplasmic-reticulum"> + <rdfs:subClassOf> + <owl:Class rdf:about="#organelle"/> + </rdfs:subClassOf> + <rdfs:subClassOf> + <owl:Restriction> + <owl:onProperty rdf:resource="#part-of"/> + <owl:someValuesFrom> + <owl:Class rdf:about="#cytosol"/> + </owl:someValuesFrom> + </owl:Restriction> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#covalent-bond"> + <rdfs:subClassOf> + <owl:Class rdf:about="#chemical-bond"/> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#electrical-charge"> + <rdfs:subClassOf> + <owl:Class rdf:about="#physicochemical-property"/> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#zinc-divalent-cation"> + <owl:equivalentClass> + <owl:Class> + <owl:intersectionOf rdf:parseType="Collection"> + <owl:Class rdf:about="#chemical"/> + <owl:Restriction> + <owl:onProperty rdf:resource="#atomic-number"/> + <owl:someValuesFrom rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="#has-metal-class"/> + <owl:someValuesFrom> + <owl:Class rdf:about="#metal"/> + </owl:someValuesFrom> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="#has-charge"/> + <owl:cardinality rdf:datatype="http://www.w3.org/2001/XMLSchema#nonNegativeInteger">2</owl:cardinality> + </owl:Restriction> + <owl:Restriction> + <owl:onProperty rdf:resource="#has-charge"/> + <owl:someValuesFrom> + <owl:Class rdf:about="#positive-charge"/> + </owl:someValuesFrom> + </owl:Restriction> + </owl:intersectionOf> + </owl:Class> + </owl:equivalentClass> + </owl:Class> + <owl:Class rdf:about="#spliceosome"> + <rdfs:subClassOf> + <owl:Class rdf:about="#biological-structure"/> + </rdfs:subClassOf> + <rdfs:subClassOf> + <owl:Restriction> + <owl:onProperty rdf:resource="#part-of"/> + <owl:someValuesFrom> + <owl:Class rdf:about="#nucleus"/> + </owl:someValuesFrom> + </owl:Restriction> + </rdfs:subClassOf> + <rdfs:subClassOf> + <owl:Restriction> + <owl:onProperty rdf:resource="#part-of"/> + <owl:allValuesFrom> + <owl:Class rdf:about="#nucleus"/> + </owl:allValuesFrom> + </owl:Restriction> + </rdfs:subClassOf> + </owl:Class> + <owl:Class rdf:about="#carbon-nitrogen-bond"> + <rdfs:subClassOf> + <owl:Class rdf:about="#covalent-bond"/> + ... [truncated message content] |
From: <hee...@us...> - 2009-08-17 17:45:59
|
Revision: 1827 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1827&view=rev Author: heeroyuy Date: 2009-08-17 17:45:45 +0000 (Mon, 17 Aug 2009) Log Message: ----------- -added labels for classes and instances Modified Paths: -------------- trunk/examples/swore/swore.rdf Modified: trunk/examples/swore/swore.rdf =================================================================== --- trunk/examples/swore/swore.rdf 2009-08-17 16:40:36 UTC (rev 1826) +++ trunk/examples/swore/swore.rdf 2009-08-17 17:45:45 UTC (rev 1827) @@ -570,7 +570,10 @@ <!-- http://ns.softwiki.de/req/AbstractComment --> - <owl:Class rdf:about="AbstractComment"/> + <owl:Class rdf:about="AbstractComment"> + <rdfs:label + >abstract comment</rdfs:label> + </owl:Class> @@ -616,6 +619,8 @@ <!-- http://ns.softwiki.de/req/AllocatedRequirement --> <owl:Class rdf:about="AllocatedRequirement"> + <rdfs:label + >allocated requirement</rdfs:label> <rdfs:subClassOf rdf:resource="Requirement"/> </owl:Class> @@ -624,6 +629,8 @@ <!-- http://ns.softwiki.de/req/ApplicationPointer --> <owl:Class rdf:about="ApplicationPointer"> + <rdfs:label + >application pointer</rdfs:label> <rdfs:subClassOf rdf:resource="AbstractReferencePoint"/> </owl:Class> @@ -632,6 +639,8 @@ <!-- http://ns.softwiki.de/req/ApplicationState --> <owl:Class rdf:about="ApplicationState"> + <rdfs:label + >application state</rdfs:label> <rdfs:subClassOf rdf:resource="AbstractReferencePoint"/> </owl:Class> @@ -651,6 +660,7 @@ <!-- http://ns.softwiki.de/req/Comment --> <owl:Class rdf:about="Comment"> + <rdfs:label>comment</rdfs:label> <rdfs:subClassOf rdf:resource="AbstractComment"/> </owl:Class> @@ -659,6 +669,7 @@ <!-- http://ns.softwiki.de/req/Creditor --> <owl:Class rdf:about="Creditor"> + <rdfs:label>creditor</rdfs:label> <rdfs:subClassOf rdf:resource="Stakeholder"/> </owl:Class> @@ -667,6 +678,7 @@ <!-- http://ns.softwiki.de/req/Customer --> <owl:Class rdf:about="Customer"> + <rdfs:label>customer</rdfs:label> <rdfs:subClassOf rdf:resource="Stakeholder"/> <owl:disjointWith rdf:resource="Programmer"/> </owl:Class> @@ -676,6 +688,8 @@ <!-- http://ns.softwiki.de/req/CustomerRequirement --> <owl:Class rdf:about="CustomerRequirement"> + <rdfs:label + >customer requirement</rdfs:label> <owl:equivalentClass> <owl:Class> <owl:intersectionOf rdf:parseType="Collection"> @@ -695,6 +709,7 @@ <!-- http://ns.softwiki.de/req/DefinedKeyword --> <owl:Class rdf:about="DefinedKeyword"> + <rdfs:label>defined keyword</rdfs:label> <rdfs:subClassOf rdf:resource="Keyword"/> </owl:Class> @@ -703,6 +718,8 @@ <!-- http://ns.softwiki.de/req/DerivedRequirement --> <owl:Class rdf:about="DerivedRequirement"> + <rdfs:label + >derived requirement</rdfs:label> <rdfs:subClassOf rdf:resource="Requirement"/> </owl:Class> @@ -711,6 +728,8 @@ <!-- http://ns.softwiki.de/req/DesignRequirement --> <owl:Class rdf:about="DesignRequirement"> + <rdfs:label + >design requirement</rdfs:label> <rdfs:subClassOf rdf:resource="Requirement"/> </owl:Class> @@ -719,6 +738,7 @@ <!-- http://ns.softwiki.de/req/Document --> <owl:Class rdf:about="Document"> + <rdfs:label>document</rdfs:label> <owl:equivalentClass> <owl:Class> <owl:intersectionOf rdf:parseType="Collection"> @@ -769,6 +789,7 @@ <!-- http://ns.softwiki.de/req/Government --> <owl:Class rdf:about="Government"> + <rdfs:label>government</rdfs:label> <rdfs:subClassOf rdf:resource="Stakeholder"/> </owl:Class> @@ -777,6 +798,7 @@ <!-- http://ns.softwiki.de/req/Keyword --> <owl:Class rdf:about="Keyword"> + <rdfs:label>keyword</rdfs:label> <rdfs:subClassOf rdf:resource="AbstractReferencePoint"/> </owl:Class> @@ -785,6 +807,8 @@ <!-- http://ns.softwiki.de/req/PerformanceRequirement --> <owl:Class rdf:about="PerformanceRequirement"> + <rdfs:label + >performance requirement</rdfs:label> <owl:equivalentClass> <owl:Class> <owl:intersectionOf rdf:parseType="Collection"> @@ -805,6 +829,7 @@ <!-- http://ns.softwiki.de/req/PriorityRating --> <owl:Class rdf:about="PriorityRating"> + <rdfs:label>priority rating</rdfs:label> <rdfs:subClassOf rdf:resource="Rating"/> <rdfs:comment rdf:datatype="&xsd;string" >Rule: Every Author only defines at most one rating about the priority for each requirement.</rdfs:comment> @@ -815,6 +840,7 @@ <!-- http://ns.softwiki.de/req/Programmer --> <owl:Class rdf:about="Programmer"> + <rdfs:label>programmer</rdfs:label> <rdfs:subClassOf rdf:resource="Stakeholder"/> </owl:Class> @@ -823,6 +849,7 @@ <!-- http://ns.softwiki.de/req/QualityRating --> <owl:Class rdf:about="QualityRating"> + <rdfs:label>quality rating</rdfs:label> <rdfs:subClassOf rdf:resource="Rating"/> <rdfs:comment rdf:datatype="&xsd;string" >Rule: Every Author only defines at most one rating about the quality for each requirement.</rdfs:comment> @@ -834,7 +861,7 @@ <owl:Class rdf:about="QualityRequirement"> <rdfs:label rdf:datatype="&xsd;string" - >QualityRequirement</rdfs:label> + >quality requirement</rdfs:label> <rdfs:subClassOf rdf:resource="Requirement"/> <rdfs:comment rdf:datatype="&xsd;string" >refers to quality reference point, e.g. reliability, performance, usability</rdfs:comment> @@ -845,6 +872,7 @@ <!-- http://ns.softwiki.de/req/Rating --> <owl:Class rdf:about="Rating"> + <rdfs:label>rating</rdfs:label> <rdfs:subClassOf rdf:resource="AbstractComment"/> </owl:Class> @@ -882,6 +910,8 @@ <!-- http://ns.softwiki.de/req/SeniorManagementStaff --> <owl:Class rdf:about="SeniorManagementStaff"> + <rdfs:label + >senior management staff</rdfs:label> <rdfs:subClassOf rdf:resource="Stakeholder"/> </owl:Class> @@ -890,6 +920,7 @@ <!-- http://ns.softwiki.de/req/Stakeholder --> <owl:Class rdf:about="Stakeholder"> + <rdfs:label>stakeholder</rdfs:label> <rdfs:subClassOf rdf:resource="AbstractSource"/> </owl:Class> @@ -898,6 +929,8 @@ <!-- http://ns.softwiki.de/req/SystemRequirement --> <owl:Class rdf:about="SystemRequirement"> + <rdfs:label + >system requirement</rdfs:label> <rdfs:subClassOf rdf:resource="&owl;Thing"/> </owl:Class> @@ -924,6 +957,7 @@ <!-- http://ns.softwiki.de/req/Topic --> <owl:Class rdf:about="Topic"> + <rdfs:label>topic</rdfs:label> <rdfs:subClassOf rdf:resource="DefinedKeyword"/> <rdfs:comment rdf:datatype="&xsd;string" >Rule: Every Requirement refers to exact one topic.</rdfs:comment> @@ -934,6 +968,7 @@ <!-- http://ns.softwiki.de/req/TradeUnion --> <owl:Class rdf:about="TradeUnion"> + <rdfs:label>trade union</rdfs:label> <rdfs:subClassOf rdf:resource="Stakeholder"/> </owl:Class> @@ -952,13 +987,17 @@ <!-- http://purl.org/dc/dcmitype/Image --> - <owl:Class rdf:about="&dcmitype;Image"/> + <owl:Class rdf:about="&dcmitype;Image"> + <rdfs:label>image</rdfs:label> + </owl:Class> <!-- http://www.w3.org/2000/01/rdf-schema#Resource --> - <owl:Class rdf:about="&rdfs;Resource"/> + <owl:Class rdf:about="&rdfs;Resource"> + <rdfs:label>resource</rdfs:label> + </owl:Class> @@ -980,13 +1019,16 @@ <owl:Class rdf:about="&skos;Concept"> <rdfs:label xml:lang="de">Thema</rdfs:label> + <rdfs:label>concept</rdfs:label> </owl:Class> <!-- http://xmlns.com/foaf/0.1/Document --> - <owl:Class rdf:about="&foaf2;Document"/> + <owl:Class rdf:about="&foaf2;Document"> + <rdfs:label>document</rdfs:label> + </owl:Class> @@ -1004,6 +1046,8 @@ <!-- http://ns.softwiki.de/req/1 --> <QualityRating rdf:about="1"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label>1</rdfs:label> <rates rdf:resource="BuildASecureLoginSystem"/> </QualityRating> @@ -1011,15 +1055,19 @@ <!-- http://ns.softwiki.de/req/2 --> - <QualityRating rdf:about="2"> + <owl:Thing rdf:about="2"> + <rdf:type rdf:resource="QualityRating"/> + <rdfs:label>2</rdfs:label> <rates rdf:resource="BuildASoftwareThatRuns24hADay"/> - </QualityRating> + </owl:Thing> <!-- http://ns.softwiki.de/req/3 --> <QualityRating rdf:about="3"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label>3</rdfs:label> <rates rdf:resource="BuildLoginSystem"/> </QualityRating> @@ -1028,6 +1076,8 @@ <!-- http://ns.softwiki.de/req/4 --> <QualityRating rdf:about="4"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label>4</rdfs:label> <rates rdf:resource="BuildNetworkLoginSystem"/> </QualityRating> @@ -1035,23 +1085,29 @@ <!-- http://ns.softwiki.de/req/5 --> - <QualityRating rdf:about="5"> + <owl:Thing rdf:about="5"> + <rdf:type rdf:resource="QualityRating"/> + <rdfs:label>5</rdfs:label> <rates rdf:resource="DataBaseBackupCreatedSyncron"/> - </QualityRating> + </owl:Thing> <!-- http://ns.softwiki.de/req/6 --> - <QualityRating rdf:about="6"> + <owl:Thing rdf:about="6"> + <rdf:type rdf:resource="QualityRating"/> + <rdfs:label>6</rdfs:label> <rates rdf:resource="CustomerRequirement1"/> - </QualityRating> + </owl:Thing> <!-- http://ns.softwiki.de/req/7 --> <QualityRating rdf:about="7"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label>7</rdfs:label> <rates rdf:resource="DialogSystemShoudRespondInUnder5Sec"/> </QualityRating> @@ -1060,6 +1116,8 @@ <!-- http://ns.softwiki.de/req/8 --> <QualityRating rdf:about="8"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label>8</rdfs:label> <rates rdf:resource="loadGUIInUnder2Sec"/> </QualityRating> @@ -1067,33 +1125,43 @@ <!-- http://ns.softwiki.de/req/9 --> - <QualityRating rdf:about="9"> + <owl:Thing rdf:about="9"> + <rdf:type rdf:resource="QualityRating"/> + <rdfs:label>9</rdfs:label> <rates rdf:resource="LogEveryUserActivity"/> - </QualityRating> + </owl:Thing> <!-- http://ns.softwiki.de/req/ActiveHelpDialog --> - <DesignRequirement rdf:about="ActiveHelpDialog"> + <owl:Thing rdf:about="ActiveHelpDialog"> + <rdf:type rdf:resource="DesignRequirement"/> + <rdfs:label + >Active Help Dialog</rdfs:label> <isCreatedBy rdf:resource="GermanGovernment"/> <isLeadingTo rdf:resource="Pflichtenheft"/> - </DesignRequirement> + </owl:Thing> <!-- http://ns.softwiki.de/req/Andrew_Stellman --> - <Author rdf:about="Andrew_Stellman"> + <owl:Thing rdf:about="Andrew_Stellman"> + <rdf:type rdf:resource="Author"/> + <rdfs:label>Andrew Stellman</rdfs:label> <defines rdf:resource="MultiUserSystem"/> <votes rdf:resource="UseDatabaseToStoreUserData"/> - </Author> + </owl:Thing> <!-- http://ns.softwiki.de/req/BuildAFastSoftware --> <CustomerRequirement rdf:about="BuildAFastSoftware"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label + >Build a Fast Software</rdfs:label> <isCreatedBy rdf:resource="Charlotte_Blay"/> <isLeadingTo rdf:resource="Lastenheft"/> <refersTo rdf:resource="PerformanceTopic"/> @@ -1103,16 +1171,22 @@ <!-- http://ns.softwiki.de/req/BuildASecureLoginSystem --> - <DerivedRequirement rdf:about="BuildASecureLoginSystem"> + <owl:Thing rdf:about="BuildASecureLoginSystem"> + <rdf:type rdf:resource="DerivedRequirement"/> + <rdfs:label + >Build A Secure Login System</rdfs:label> <details rdf:resource="BuildLoginSystem"/> <isLeadingTo rdf:resource="Pflichtenheft"/> - </DerivedRequirement> + </owl:Thing> <!-- http://ns.softwiki.de/req/BuildASoftwareThatRuns24hADay --> <CustomerRequirement rdf:about="BuildASoftwareThatRuns24hADay"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label + >Build A Software That Runs 24 h A Day</rdfs:label> <isLeadingTo rdf:resource="Lastenheft"/> <isCreatedBy rdf:resource="Philippe_Soupault"/> <depentsOn rdf:resource="SystemStabilityRequirement"/> @@ -1123,71 +1197,95 @@ <!-- http://ns.softwiki.de/req/BuildLoginSystem --> - <DerivedRequirement rdf:about="BuildLoginSystem"> + <owl:Thing rdf:about="BuildLoginSystem"> + <rdf:type rdf:resource="DerivedRequirement"/> + <rdfs:label + >Build Login System</rdfs:label> <details rdf:resource="MultiUserSystem"/> <isLeadingTo rdf:resource="Pflichtenheft"/> - </DerivedRequirement> + </owl:Thing> <!-- http://ns.softwiki.de/req/BuildNetworkLoginSystem --> - <DerivedRequirement rdf:about="BuildNetworkLoginSystem"> + <owl:Thing rdf:about="BuildNetworkLoginSystem"> + <rdf:type rdf:resource="DerivedRequirement"/> + <rdfs:label + >Build Network Login System</rdfs:label> <isLeadingTo rdf:resource="Pflichtenheft"/> <details rdf:resource="UserCanAccessDataFromEveryComputer"/> - </DerivedRequirement> + </owl:Thing> <!-- http://ns.softwiki.de/req/CentralOrganisationOfFinnishTrade --> - <TradeUnion rdf:about="CentralOrganisationOfFinnishTrade"/> + <owl:Thing rdf:about="CentralOrganisationOfFinnishTrade"> + <rdf:type rdf:resource="TradeUnion"/> + <rdfs:label + >Central Organisaion Of Finnish Trade</rdfs:label> + </owl:Thing> <!-- http://ns.softwiki.de/req/Charlotte_Blay --> - <Customer rdf:about="Charlotte_Blay"/> + <Customer rdf:about="Charlotte_Blay"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label>Carlotte Blay</rdfs:label> + </Customer> <!-- http://ns.softwiki.de/req/Consistent --> - <rdf:Description rdf:about="Consistent"> + <owl:Thing rdf:about="Consistent"> + <rdfs:label>Consistent</rdfs:label> <isCreatedBy rdf:resource="USGovernment"/> - </rdf:Description> + </owl:Thing> <!-- http://ns.softwiki.de/req/Correct --> - <rdf:Description rdf:about="Correct"> + <owl:Thing rdf:about="Correct"> + <rdfs:label>Correct</rdfs:label> <isCreatedBy rdf:resource="Jennifer_Greene"/> - </rdf:Description> + </owl:Thing> <!-- http://ns.softwiki.de/req/CreateACheaperSoftware --> - <Goal rdf:about="CreateACheaperSoftware"> + <owl:Thing rdf:about="CreateACheaperSoftware"> + <rdf:type rdf:resource="Goal"/> + <rdfs:label + >Create A Cheaper Software</rdfs:label> <details rdf:resource="SearchShouldBeDoneIn3Sec"/> <isDefinedBy rdf:resource="Tim"/> - </Goal> + </owl:Thing> <!-- http://ns.softwiki.de/req/CreateDatabaseInterface --> - <DerivedRequirement rdf:about="CreateDatabaseInterface"> + <owl:Thing rdf:about="CreateDatabaseInterface"> + <rdf:type rdf:resource="DerivedRequirement"/> + <rdfs:label + >Create Database Interface</rdfs:label> <details rdf:resource="DataBaseBackupCreatedSyncron"/> <isLeadingTo rdf:resource="Lastenheft"/> - </DerivedRequirement> + </owl:Thing> <!-- http://ns.softwiki.de/req/CreateModernGUIDesign --> <CustomerRequirement rdf:about="CreateModernGUIDesign"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label + >Create Modern GUI Design</rdfs:label> <refersTo rdf:resource="DesignTopic"/> <isCreatedBy rdf:resource="Jane_Smiley"/> <isLeadingTo rdf:resource="Lastenheft"/> @@ -1198,25 +1296,34 @@ <!-- http://ns.softwiki.de/req/CreateNetworkInterface --> - <DerivedRequirement rdf:about="CreateNetworkInterface"> + <owl:Thing rdf:about="CreateNetworkInterface"> + <rdf:type rdf:resource="DerivedRequirement"/> + <rdfs:label + >Create Network Interface</rdfs:label> <details rdf:resource="BuildNetworkLoginSystem"/> <isLeadingTo rdf:resource="Pflichtenheft"/> - </DerivedRequirement> + </owl:Thing> <!-- http://ns.softwiki.de/req/CreateVersion1 --> - <Goal rdf:about="CreateVersion1"> + <owl:Thing rdf:about="CreateVersion1"> + <rdf:type rdf:resource="Goal"/> + <rdfs:label + >Create Version 1</rdfs:label> <isDefinedBy rdf:resource="Jim"/> <details rdf:resource="SystemStabilityRequirement"/> - </Goal> + </owl:Thing> <!-- http://ns.softwiki.de/req/CreateVersion2 --> <Goal rdf:about="CreateVersion2"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label + >Create Version 2</rdfs:label> <isDefinedBy rdf:resource="Tom"/> <details rdf:resource="UseDatabaseToStoreUserData"/> </Goal> @@ -1226,6 +1333,9 @@ <!-- http://ns.softwiki.de/req/CustomerRequirement1 --> <Requirement rdf:about="CustomerRequirement1"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label + >Customer Requirement 1</rdfs:label> <isLeadingTo rdf:resource="Lastenheft"/> <isCreatedBy rdf:resource="Tom"/> </Requirement> @@ -1234,31 +1344,40 @@ <!-- http://ns.softwiki.de/req/DataBaseBackupCreatedSyncron --> - <PerformanceRequirement rdf:about="DataBaseBackupCreatedSyncron"> + <owl:Thing rdf:about="DataBaseBackupCreatedSyncron"> + <rdf:type rdf:resource="PerformanceRequirement"/> + <rdfs:label + >Database Backup Created Syncrom</rdfs:label> <isCreatedBy rdf:resource="Andrew_Stellman"/> <willLeadTo rdf:resource="DualCoreSystemWith8GigRam"/> <isCommentedBy rdf:resource="MustBeDiscussed"/> <refersTo rdf:resource="PerformanceTopic"/> <isLeadingTo rdf:resource="Pflichtenheft"/> - </PerformanceRequirement> + </owl:Thing> <!-- http://ns.softwiki.de/req/DataExecutionShouldBeDoneInUnder3Sec --> - <PerformanceRequirement rdf:about="DataExecutionShouldBeDoneInUnder3Sec"> + <owl:Thing rdf:about="DataExecutionShouldBeDoneInUnder3Sec"> + <rdf:type rdf:resource="PerformanceRequirement"/> + <rdfs:label + >Dataexecution Should Be Done In Under 3 Sec</rdfs:label> <isCreatedBy rdf:resource="Jennifer_Greene"/> <isLeadingTo rdf:resource="Lastenheft"/> <isCommentedBy rdf:resource="MustBeDiscussed"/> <refersTo rdf:resource="PerformanceTopic"/> <willLeadTo rdf:resource="QuadCoreSystemWith16GigRam"/> - </PerformanceRequirement> + </owl:Thing> <!-- http://ns.softwiki.de/req/DatabaseServerCanBeUsedBy1000PersonsSimultaneus --> <PerformanceRequirement rdf:about="DatabaseServerCanBeUsedBy1000PersonsSimultaneus"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label + >Database Server Can Be Used By 1000 Persons Simultaneus</rdfs:label> <willLeadTo rdf:resource="DatabaseServerWith32GigRam"/> <isLeadingTo rdf:resource="Lastenheft"/> <isCommentedBy rdf:resource="MustBeDiscussed"/> @@ -1270,13 +1389,19 @@ <!-- http://ns.softwiki.de/req/DatabaseServerWith32GigRam --> - <SystemRequirement rdf:about="DatabaseServerWith32GigRam"/> + <owl:Thing rdf:about="DatabaseServerWith32GigRam"> + <rdf:type rdf:resource="SystemRequirement"/> + <rdfs:label + >Database Server With 32 Gig Ram</rdfs:label> + </owl:Thing> <!-- http://ns.softwiki.de/req/DatabaseTopic --> <Topic rdf:about="DatabaseTopic"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label>Database Topic</rdfs:label> <specifies rdf:resource="UseDatabaseToStoreUserData"/> </Topic> @@ -1284,23 +1409,31 @@ <!-- http://ns.softwiki.de/req/Derick_Garnier --> - <Customer rdf:about="Derick_Garnier"/> + <owl:Thing rdf:about="Derick_Garnier"> + <rdf:type rdf:resource="Customer"/> + <rdfs:label>Derick Garnier</rdfs:label> + </owl:Thing> <!-- http://ns.softwiki.de/req/DesignTopic --> - <Topic rdf:about="DesignTopic"> + <owl:Thing rdf:about="DesignTopic"> + <rdf:type rdf:resource="Topic"/> + <rdfs:label>Design Topic</rdfs:label> <specifies rdf:resource="CreateModernGUIDesign"/> <specifies rdf:resource="UseOfIcons"/> <specifies rdf:resource="WindowDesign"/> - </Topic> + </owl:Thing> <!-- http://ns.softwiki.de/req/DialogSystemShoudRespondInUnder5Sec --> <PerformanceRequirement rdf:about="DialogSystemShoudRespondInUnder5Sec"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label + >Dialog System Should Respond In Under 5 Sec</rdfs:label> <willLeadTo rdf:resource="DualCoreSystemWith8GigRam"/> <isCommentedBy rdf:resource="GoodIdea"/> <isLeadingTo rdf:resource="Lastenheft"/> @@ -1312,19 +1445,29 @@ <!-- http://ns.softwiki.de/req/DualCoreSystemWith8GigRam --> - <SystemRequirement rdf:about="DualCoreSystemWith8GigRam"/> + <SystemRequirement rdf:about="DualCoreSystemWith8GigRam"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label + >Dual Core System With 8 Gig Ram</rdfs:label> + </SystemRequirement> <!-- http://ns.softwiki.de/req/EuropeanTradeUnionConfederation --> - <TradeUnion rdf:about="EuropeanTradeUnionConfederation"/> + <TradeUnion rdf:about="EuropeanTradeUnionConfederation"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label + >European Trade Union Confederation</rdfs:label> + </TradeUnion> <!-- http://ns.softwiki.de/req/FunctionTopic --> <Topic rdf:about="FunctionTopic"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label>Function Topic</rdfs:label> <specifies rdf:resource="LogEveryUserActivity"/> </Topic> @@ -1332,29 +1475,40 @@ <!-- http://ns.softwiki.de/req/GermanGovernment --> - <Government rdf:about="GermanGovernment"/> + <owl:Thing rdf:about="GermanGovernment"> + <rdf:type rdf:resource="Government"/> + <rdfs:label + >German Government</rdfs:label> + </owl:Thing> <!-- http://ns.softwiki.de/req/GoodIdea --> - <Comment rdf:about="GoodIdea"> + <owl:Thing rdf:about="GoodIdea"> + <rdf:type rdf:resource="Comment"/> + <rdfs:label>Good Idea</rdfs:label> <comments rdf:resource="DialogSystemShoudRespondInUnder5Sec"/> <isDefinedBy rdf:resource="Jennifer_Greene"/> <isDefinedBy rdf:resource="Stefan"/> - </Comment> + </owl:Thing> <!-- http://ns.softwiki.de/req/Jane_Smiley --> - <Customer rdf:about="Jane_Smiley"/> + <owl:Thing rdf:about="Jane_Smiley"> + <rdf:type rdf:resource="Customer"/> + <rdfs:label>Jane Smiley</rdfs:label> + </owl:Thing> <!-- http://ns.softwiki.de/req/Jennifer_Greene --> <Author rdf:about="Jennifer_Greene"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label>Jennifer Greene</rdfs:label> <votes rdf:resource="MultiWindowSystem"/> <defines rdf:resource="loadGUIInUnder2Sec"/> </Author> @@ -1363,16 +1517,20 @@ <!-- http://ns.softwiki.de/req/Jill --> - <Author rdf:about="Jill"> + <owl:Thing rdf:about="Jill"> + <rdf:type rdf:resource="Author"/> + <rdfs:label>Jill</rdfs:label> <defines rdf:resource="DialogSystemShoudRespondInUnder5Sec"/> <votes rdf:resource="SystemRequirement1"/> - </Author> + </owl:Thing> <!-- http://ns.softwiki.de/req/Jim --> <Author rdf:about="Jim"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label>Jim</rdfs:label> <defines rdf:resource="MultiWindowSystem"/> <votes rdf:resource="SystemStabilityRequirement"/> </Author> @@ -1382,6 +1540,8 @@ <!-- http://ns.softwiki.de/req/Lastenheft --> <Document rdf:about="Lastenheft"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label>Lastenheft</rdfs:label> <leadsTo rdf:resource="text"/> </Document> @@ -1390,6 +1550,9 @@ <!-- http://ns.softwiki.de/req/LogEveryUserActivity --> <FunctionalRequirement rdf:about="LogEveryUserActivity"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label + >Log Every User Activity</rdfs:label> <isLeadingTo rdf:resource="Lastenheft"/> <isCommentedBy rdf:resource="NotNecessaryRequirment"/> <isDefinedBy rdf:resource="Steve_McConnell"/> @@ -1400,76 +1563,100 @@ <!-- http://ns.softwiki.de/req/LoginTopic --> - <Topic rdf:about="LoginTopic"> + <owl:Thing rdf:about="LoginTopic"> + <rdf:type rdf:resource="Topic"/> + <rdfs:label>Login Topic</rdfs:label> <specifies rdf:resource="BuildASecureLoginSystem"/> <specifies rdf:resource="BuildLoginSystem"/> <specifies rdf:resource="BuildNetworkLoginSystem"/> - </Topic> + </owl:Thing> <!-- http://ns.softwiki.de/req/Michael_Steinmetz --> - <Customer rdf:about="Michael_Steinmetz"/> + <owl:Thing rdf:about="Michael_Steinmetz"> + <rdf:type rdf:resource="Customer"/> + <rdfs:label + >Michael Steinmetz</rdfs:label> + </owl:Thing> <!-- http://ns.softwiki.de/req/MultiTabSystem --> - <DesignRequirement rdf:about="MultiTabSystem"> + <owl:Thing rdf:about="MultiTabSystem"> + <rdf:type rdf:resource="DesignRequirement"/> + <rdfs:label + >Multi Tab System</rdfs:label> <refersTo rdf:resource="DesignTopic"/> <isLeadingTo rdf:resource="Pflichtenheft"/> <isCommentedBy rdf:resource="ShouldBeImplementedInALaterVersion"/> <isCreatedBy rdf:resource="Steve_McConnell"/> <isDefinedBy rdf:resource="Steve_McConnell"/> - </DesignRequirement> + </owl:Thing> <!-- http://ns.softwiki.de/req/MultiUserSystem --> - <FunctionalRequirement rdf:about="MultiUserSystem"> + <owl:Thing rdf:about="MultiUserSystem"> + <rdf:type rdf:resource="FunctionalRequirement"/> + <rdfs:label + >Multi User System</rdfs:label> <isDefinedBy rdf:resource="Andrew_Stellman"/> <isCreatedBy rdf:resource="Andrew_Stellman"/> <isDetailedBy rdf:resource="BuildLoginSystem"/> <isLeadingTo rdf:resource="Pflichtenheft"/> - </FunctionalRequirement> + </owl:Thing> <!-- http://ns.softwiki.de/req/MultiWindowSystem --> - <DesignRequirement rdf:about="MultiWindowSystem"> + <owl:Thing rdf:about="MultiWindowSystem"> + <rdf:type rdf:resource="DesignRequirement"/> + <rdfs:label + >Multi Window System</rdfs:label> <refersTo rdf:resource="DesignTopic"/> <isDefinedBy rdf:resource="Jennifer_Greene"/> <isCreatedBy rdf:resource="Jennifer_Greene"/> <isLeadingTo rdf:resource="UML"/> - </DesignRequirement> + </owl:Thing> <!-- http://ns.softwiki.de/req/MustBeDiscussed --> - <Comment rdf:about="MustBeDiscussed"> + <owl:Thing rdf:about="MustBeDiscussed"> + <rdf:type rdf:resource="Comment"/> + <rdfs:label + >Must Be Discussed</rdfs:label> <isDefinedBy rdf:resource="Andrew_Stellman"/> <isDefinedBy rdf:resource="Jennifer_Greene"/> <comments rdf:resource="UserCanAccessDataFromEveryComputer"/> - </Comment> + </owl:Thing> <!-- http://ns.softwiki.de/req/NotNecessaryRequirment --> - <Comment rdf:about="NotNecessaryRequirment"> + <owl:Thing rdf:about="NotNecessaryRequirment"> + <rdf:type rdf:resource="Comment"/> + <rdfs:label + >Not Necessary Requirement</rdfs:label> <isDefinedBy rdf:resource="Jennifer_Greene"/> <comments rdf:resource="LogEveryUserActivity"/> - </Comment> + </owl:Thing> <!-- http://ns.softwiki.de/req/PerformanceTopic --> <Topic rdf:about="PerformanceTopic"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label + >Performance Topic</rdfs:label> <specifies rdf:resource="BuildAFastSoftware"/> <specifies rdf:resource="DataExecutionShouldBeDoneInUnder3Sec"/> <specifies rdf:resource="loadGUIInUnder2Sec"/> @@ -1479,35 +1666,50 @@ <!-- http://ns.softwiki.de/req/Pflichtenheft --> - <Document rdf:about="Pflichtenheft"> + <owl:Thing rdf:about="Pflichtenheft"> + <rdf:type rdf:resource="Document"/> + <rdfs:label>Pflichtenheft</rdfs:label> <leadsTo rdf:resource="TextualScenario2"/> - </Document> + </owl:Thing> <!-- http://ns.softwiki.de/req/Philippe_Soupault --> - <Customer rdf:about="Philippe_Soupault"/> + <owl:Thing rdf:about="Philippe_Soupault"> + <rdf:type rdf:resource="Customer"/> + <rdfs:label + >Philippe Soupault</rdfs:label> + </owl:Thing> <!-- http://ns.softwiki.de/req/QuadCoreSystemWith16GigRam --> - <SystemRequirement rdf:about="QuadCoreSystemWith16GigRam"/> + <SystemRequirement rdf:about="QuadCoreSystemWith16GigRam"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label + >Quad Core System With 16 Gig Ram</rdfs:label> + </SystemRequirement> <!-- http://ns.softwiki.de/req/QualityTopic --> - <Topic rdf:about="QualityTopic"> + <owl:Thing rdf:about="QualityTopic"> + <rdf:type rdf:resource="Topic"/> + <rdfs:label>Quality Topic</rdfs:label> <specifies rdf:resource="usability"/> - </Topic> + </owl:Thing> <!-- http://ns.softwiki.de/req/SearchShouldBeDoneIn3Sec --> <PerformanceRequirement rdf:about="SearchShouldBeDoneIn3Sec"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label + >Search Should Be Done In 3 Sec</rdfs:label> <isCreatedBy rdf:resource="Andrew_Stellman"/> <isLeadingTo rdf:resource="Lastenheft"/> <isCommentedBy rdf:resource="NotNecessaryRequirment"/> @@ -1519,22 +1721,31 @@ <!-- http://ns.softwiki.de/req/ShouldBeImplementedInALaterVersion --> - <Comment rdf:about="ShouldBeImplementedInALaterVersion"> + <owl:Thing rdf:about="ShouldBeImplementedInALaterVersion"> + <rdf:type rdf:resource="Comment"/> + <rdfs:label + >Should Be Implemented In A Later Version</rdfs:label> <comments rdf:resource="MultiTabSystem"/> <isDefinedBy rdf:resource="Stefan"/> - </Comment> + </owl:Thing> <!-- http://ns.softwiki.de/req/SingleCoreWith_2GigRam --> - <SystemRequirement rdf:about="SingleCoreWith_2GigRam"/> + <SystemRequirement rdf:about="SingleCoreWith_2GigRam"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label + >Single Core With 2 Gig Ram</rdfs:label> + </SystemRequirement> <!-- http://ns.softwiki.de/req/Stefan --> <Author rdf:about="Stefan"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label>Stefan</rdfs:label> <votes rdf:resource="BuildNetworkLoginSystem"/> <defines rdf:resource="CreateModernGUIDesign"/> <defines rdf:resource="ShouldBeImplementedInALaterVersion"/> @@ -1545,6 +1756,8 @@ <!-- http://ns.softwiki.de/req/Steve_McConnell --> <Author rdf:about="Steve_McConnell"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label>Steve McConnell</rdfs:label> <votes rdf:resource="LogEveryUserActivity"/> <defines rdf:resource="comment"/> </Author> @@ -1553,19 +1766,30 @@ <!-- http://ns.softwiki.de/req/SwedishTradeUnionConfederation --> - <TradeUnion rdf:about="SwedishTradeUnionConfederation"/> + <TradeUnion rdf:about="SwedishTradeUnionConfederation"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label + >Swedish Trade Union Confederation</rdfs:label> + </TradeUnion> <!-- http://ns.softwiki.de/req/SystemRequirement1 --> - <SystemRequirement rdf:about="SystemRequirement1"/> + <owl:Thing rdf:about="SystemRequirement1"> + <rdf:type rdf:resource="SystemRequirement"/> + <rdfs:label + >Systemj Requirement 1</rdfs:label> + </owl:Thing> <!-- http://ns.softwiki.de/req/SystemShouldAlwaysRunBasicFeaturesAfterFailure --> <PerformanceRequirement rdf:about="SystemShouldAlwaysRunBasicFeaturesAfterFailure"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label + >System Should Always Run Basic Features After Failure</rdfs:label> <refersTo rdf:resource="PerformanceTopic"/> <isLeadingTo rdf:resource="Pflichtenheft"/> <willLeadTo rdf:resource="SingleCoreWith_2GigRam"/> @@ -1578,6 +1802,11 @@ <!-- http://ns.softwiki.de/req/SystemShoundStartUpIn7Sec --> <PerformanceRequirement rdf:about="SystemShoundStartUpIn7Sec"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label + >System Should Sartup In 7 Sec</rdfs:label> + <rdfs:label + >System Stability Requirement</rdfs:label> <isCreatedBy rdf:resource="Jennifer_Greene"/> <isLeadingTo rdf:resource="Lastenheft"/> <refersTo rdf:resource="PerformanceTopic"/> @@ -1589,34 +1818,47 @@ <!-- http://ns.softwiki.de/req/SystemStabilityRequirement --> - <PerformanceRequirement rdf:about="SystemStabilityRequirement"> + <owl:Thing rdf:about="SystemStabilityRequirement"> + <rdf:type rdf:resource="PerformanceRequirement"/> + <rdfs:label + >System Stability Requirement</rdfs:label> <isCreatedBy rdf:resource="Jennifer_Greene"/> <isLeadingTo rdf:resource="Pflichtenheft"/> <willLeadTo rdf:resource="SystemRequirement1"/> <refersTo rdf:resource="SystemStabilityTopic"/> <isCommentedBy rdf:resource="comment"/> - </PerformanceRequirement> + </owl:Thing> <!-- http://ns.softwiki.de/req/SystemStabilityTopic --> - <Topic rdf:about="SystemStabilityTopic"> + <owl:Thing rdf:about="SystemStabilityTopic"> + <rdf:type rdf:resource="Topic"/> + <rdfs:label + >System Stability Topic</rdfs:label> <specifies rdf:resource="BuildASoftwareThatRuns24hADay"/> <specifies rdf:resource="SystemStabilityRequirement"/> - </Topic> + </owl:Thing> <!-- http://ns.softwiki.de/req/SystemWithDiskArray --> - <SystemRequirement rdf:about="SystemWithDiskArray"/> + <SystemRequirement rdf:about="SystemWithDiskArray"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label + >System With Disk Array</rdfs:label> + </SystemRequirement> <!-- http://ns.softwiki.de/req/TextualScenario1 --> <TextualScenario rdf:about="TextualScenario1"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label + >Textual Scenario 1</rdfs:label> <isLeadingTo rdf:resource="UML"/> </TextualScenario> @@ -1625,6 +1867,9 @@ <!-- http://ns.softwiki.de/req/TextualScenario2 --> <TextualScenario rdf:about="TextualScenario2"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label + >Textual Scenario 2</rdfs:label> <isLeadingTo rdf:resource="Pflichtenheft"/> </TextualScenario> @@ -1633,6 +1878,9 @@ <!-- http://ns.softwiki.de/req/TextualScenario3 --> <TextualScenario rdf:about="TextualScenario3"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label + >Textual Scenario 3</rdfs:label> <isLeadingTo rdf:resource="use_cases"/> </TextualScenario> @@ -1641,6 +1889,9 @@ <!-- http://ns.softwiki.de/req/TextualScenario4 --> <TextualScenario rdf:about="TextualScenario4"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label + >Textual Scenario 4</rdfs:label> <isLeadingTo rdf:resource="UML"/> </TextualScenario> @@ -1649,6 +1900,9 @@ <!-- http://ns.softwiki.de/req/TextualScenario5 --> <TextualScenario rdf:about="TextualScenario5"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label + >Textual Scenario 5</rdfs:label> <isLeadingTo rdf:resource="Lastenheft"/> </TextualScenario> @@ -1657,6 +1911,9 @@ <!-- http://ns.softwiki.de/req/TextualScenario6 --> <TextualScenario rdf:about="TextualScenario6"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label + >Textual Scenario 6</rdfs:label> <isLeadingTo rdf:resource="Pflichtenheft"/> </TextualScenario> @@ -1664,13 +1921,18 @@ <!-- http://ns.softwiki.de/req/Tilman_Röhrig --> - <Customer rdf:about="Tilman_Röhrig"/> + <Customer rdf:about="Tilman_Röhrig"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label>Tilman Röhrig</rdfs:label> + </Customer> <!-- http://ns.softwiki.de/req/Tim --> <Author rdf:about="Tim"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label>Tim</rdfs:label> <defines rdf:resource="SystemShoundStartUpIn7Sec"/> <votes rdf:resource="UseDatabaseToStoreUserData"/> </Author> @@ -1679,16 +1941,20 @@ <!-- http://ns.softwiki.de/req/Tom --> - <Author rdf:about="Tom"> + <owl:Thing rdf:about="Tom"> + <rdf:type rdf:resource="Author"/> + <rdfs:label>Tom</rdfs:label> <defines rdf:resource="CustomerRequirement1"/> <votes rdf:resource="UserCanAccessDataFromEveryComputer"/> - </Author> + </owl:Thing> <!-- http://ns.softwiki.de/req/UML --> <Document rdf:about="UML"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label>UML</rdfs:label> <leadsTo rdf:resource="TextualScenario1"/> </Document> @@ -1696,13 +1962,19 @@ <!-- http://ns.softwiki.de/req/USGovernment --> - <Government rdf:about="USGovernment"/> + <owl:Thing rdf:about="USGovernment"> + <rdf:type rdf:resource="Government"/> + <rdfs:label>US Government</rdfs:label> + </owl:Thing> <!-- http://ns.softwiki.de/req/UseAsLittleSystemResourcesAsPosible --> <CustomerRequirement rdf:about="UseAsLittleSystemResourcesAsPosible"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label + >Use As Little System Resources As Possible</rdfs:label> <isLeadingTo rdf:resource="Lastenheft"/> <isCreatedBy rdf:resource="Michael_Steinmetz"/> <refersTo rdf:resource="PerformanceTopic"/> @@ -1712,34 +1984,45 @@ <!-- http://ns.softwiki.de/req/UseDatabaseToStoreUserData --> - <CustomerRequirement rdf:about="UseDatabaseToStoreUserData"> + <owl:Thing rdf:about="UseDatabaseToStoreUserData"> + <rdf:type rdf:resource="CustomerRequirement"/> + <rdfs:label + >Use Database To Store User Data</rdfs:label> <isCreatedBy rdf:resource="Derick_Garnier"/> <isLeadingTo rdf:resource="Pflichtenheft"/> - </CustomerRequirement> + </owl:Thing> <!-- http://ns.softwiki.de/req/UseOfIcons --> - <DesignRequirement rdf:about="UseOfIcons"> + <owl:Thing rdf:about="UseOfIcons"> + <rdf:type rdf:resource="DesignRequirement"/> + <rdfs:label>Use Of Icons</rdfs:label> <refersTo rdf:resource="DesignTopic"/> <isLeadingTo rdf:resource="Pflichtenheft"/> - </DesignRequirement> + </owl:Thing> <!-- http://ns.softwiki.de/req/UsefulRequirement --> - <Comment rdf:about="UsefulRequirement"> + <owl:Thing rdf:about="UsefulRequirement"> + <rdf:type rdf:resource="Comment"/> + <rdfs:label + >Useful Requirement</rdfs:label> <comments rdf:resource="CreateModernGUIDesign"/> <isDefinedBy rdf:resource="Steve_McConnell"/> - </Comment> + </owl:Thing> <!-- http://ns.softwiki.de/req/UserCanAccessDataFromEveryComputer --> <FunctionalRequirement rdf:about="UserCanAccessDataFromEveryComputer"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label + >User Can Access Data From Every Computer</rdfs:label> <isDetailedBy rdf:resource="BuildNetworkLoginSystem"/> <isCommentedBy rdf:resource="MustBeDiscussed"/> <isLeadingTo rdf:resource="Pflichtenheft"/> @@ -1750,17 +2033,21 @@ <!-- http://ns.softwiki.de/req/WindowDesign --> - <DesignRequirement rdf:about="WindowDesign"> + <owl:Thing rdf:about="WindowDesign"> + <rdf:type rdf:resource="DesignRequirement"/> + <rdfs:label>Window Design</rdfs:label> <isCreatedBy rdf:resource="Andrew_Stellman"/> <refersTo rdf:resource="DesignTopic"/> <isLeadingTo rdf:resource="Lastenheft"/> - </DesignRequirement> + </owl:Thing> <!-- http://ns.softwiki.de/req/calculations --> <FunctionalRequirement rdf:about="calculations"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label>Calculations</rdfs:label> <isLeadingTo rdf:resource="UML"/> </FunctionalRequirement> @@ -1768,22 +2055,30 @@ <!-- http://ns.softwiki.de/req/comment --> - <Comment rdf:about="comment"> + <owl:Thing rdf:about="comment"> + <rdf:type rdf:resource="Comment"/> + <rdfs:label>Comment</rdfs:label> <isDefinedBy rdf:resource="Steve_McConnell"/> <comments rdf:resource="SystemStabilityRequirement"/> - </Comment> + </owl:Thing> <!-- http://ns.softwiki.de/req/complete --> - <ApplicationState rdf:about="complete"/> + <owl:Thing rdf:about="complete"> + <rdf:type rdf:resource="ApplicationState"/> + <rdfs:label>Complete</rdfs:label> + </owl:Thing> <!-- http://ns.softwiki.de/req/data_manipulation --> <FunctionalRequirement rdf:about="data_manipulation"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label + >Data Manipulation</rdfs:label> <isLeadingTo rdf:resource="Pflichtenheft"/> <isCreatedBy rdf:resource="Steve_McConnell"/> </FunctionalRequirement> @@ -1793,6 +2088,9 @@ <!-- http://ns.softwiki.de/req/determineCoreRequirements --> <Goal rdf:about="determineCoreRequirements"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label + >Determine Core Requirments</rdfs:label> <details rdf:resource="DialogSystemShoudRespondInUnder5Sec"/> <isDefinedBy rdf:resource="Jennifer_Greene"/> </Goal> @@ -1801,34 +2099,49 @@ <!-- http://ns.softwiki.de/req/determineSystemRequirements --> - <Goal rdf:about="determineSystemRequirements"> + <owl:Thing rdf:about="determineSystemRequirements"> + <rdf:type rdf:resource="Goal"/> + <rdfs:label + >Determine System Requirment</rdfs:label> <details rdf:resource="CreateModernGUIDesign"/> <isDefinedBy rdf:resource="Jill"/> - </Goal> + </owl:Thing> <!-- http://ns.softwiki.de/req/important --> - <Vote rdf:about="important"/> + <owl:Thing rdf:about="important"> + <rdf:type rdf:resource="Vote"/> + <rdfs:label>Important</rdfs:label> + </owl:Thing> <!-- http://ns.softwiki.de/req/incomplete --> - <ApplicationState rdf:about="incomplete"/> + <ApplicationState rdf:about="incomplete"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label>Incomplete</rdfs:label> + </ApplicationState> <!-- http://ns.softwiki.de/req/less_importent --> - <Vote rdf:about="less_importent"/> + <owl:Thing rdf:about="less_importent"> + <rdf:type rdf:resource="Vote"/> + <rdfs:label>Less Important</rdfs:label> + </owl:Thing> <!-- http://ns.softwiki.de/req/loadGUIInUnder2Sec --> <PerformanceRequirement rdf:about="loadGUIInUnder2Sec"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label + >Load GUI In Under 2 Sec</rdfs:label> <isDefinedBy rdf:resource="Andrew_Stellman"/> <isCreatedBy rdf:resource="Andrew_Stellman"/> <willLeadTo rdf:resource="DualCoreSystemWith8GigRam"/> @@ -1841,13 +2154,18 @@ <!-- http://ns.softwiki.de/req/task --> - <owl:Thing rdf:about="task"/> + <owl:Thing rdf:about="task"> + <rdfs:label>Task</rdfs:label> + </owl:Thing> <!-- http://ns.softwiki.de/req/technical_details --> <FunctionalRequirement rdf:about="technical_details"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label + >Technical Details</rdfs:label> <isLeadingTo rdf:resource="use_cases"/> </FunctionalRequirement> @@ -1855,29 +2173,38 @@ <!-- http://ns.softwiki.de/req/text --> - <TextualScenario rdf:about="text"> + <owl:Thing rdf:about="text"> + <rdf:type rdf:resource="TextualScenario"/> + <rdfs:label>Text</rdfs:label> <isLeadingTo rdf:resource="Lastenheft"/> - </TextualScenario> + </owl:Thing> <!-- http://ns.softwiki.de/req/unimportant --> - <Vote rdf:about="unimportant"/> + <Vote rdf:about="unimportant"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label>Unimportant</rdfs:label> + </Vote> <!-- http://ns.softwiki.de/req/usability --> - <QualityRequirement rdf:about="usability"> + <owl:Thing rdf:about="usability"> + <rdf:type rdf:resource="QualityRequirement"/> + <rdfs:label>Usability</rdfs:label> <isLeadingTo rdf:resource="Pflichtenheft"/> - </QualityRequirement> + </owl:Thing> <!-- http://ns.softwiki.de/req/use_cases --> <Document rdf:about="use_cases"> + <rdf:type rdf:resource="&owl;Thing"/> + <rdfs:label>Use Cases</rdfs:label> <leadsTo rdf:resource="TextualScenario3"/> </Document> @@ -1885,35 +2212,40 @@ <!-- http://ns.softwiki.de/req/very_important --> - <Vote rdf:about="very_important"/> + <owl:Thing rdf:about="very_important"> + <rdf:type rdf:resource="Vote"/> + <rdfs:label>Very Important</rdfs:label> + </owl:Thing> <!-- http://www.holygoat.co.uk/foaf.rdf#RichardNewman --> - <Author rdf:about="&foaf;RichardNewman"> + <owl:Thing rdf:about="&foaf;RichardNewman"> + <rdf:type rdf:resource="Author"/> + <rdfs:label>Richard Newman</rdfs:label> <defines rdf:resource="DataBaseBackupCreatedSyncron"/> <votes rdf:resource="SearchShouldBeDoneIn3Sec"/> - </Author> + </owl:Thing> <!-- http://www.w3.org/2001/XMLSchema#boolean --> - <rdf:Description rdf:about="&xsd;boolean"> + <owl:Thing rdf:about="&xsd;boolean"> <rdfs:label rdf:datatype="&xsd;string">boolean</rdfs:label> - </rdf:Description> + </owl:Thing> <!-- http://www.w3.org/2001/XMLSchema#dateTime --> - <rdf:Description rdf:about="&xsd;dateTime"> + <owl:Thing rdf:about="&xsd;dateTime"> <rdfs:label rdf:datatype="&xsd;string">dateTime</rdfs:label> - </rdf:Description> + </owl:Thing> </rdf:RDF> -<!-- Generated by the OWL API (version 2.2.1.962) http://owlapi.sourceforge.net --> +<!-- Generated by the OWL API (version 2.2.1.1138) http://owlapi.sourceforge.net --> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-08-17 16:40:52
|
Revision: 1826 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1826&view=rev Author: jenslehmann Date: 2009-08-17 16:40:36 +0000 (Mon, 17 Aug 2009) Log Message: ----------- fixed JSON output (bug in JSON API) Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/core/owl/Individual.java trunk/src/dl-learner/org/dllearner/learningproblems/EvaluatedDescriptionClass.java trunk/src/php-examples/LearningClass.php Modified: trunk/src/dl-learner/org/dllearner/core/owl/Individual.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/owl/Individual.java 2009-08-17 15:17:59 UTC (rev 1825) +++ trunk/src/dl-learner/org/dllearner/core/owl/Individual.java 2009-08-17 16:40:36 UTC (rev 1826) @@ -51,11 +51,15 @@ } public int compareTo(Individual o) { +// System.out.println(o); return name.compareTo(o.name); } @Override public boolean equals(Object o) { + if(o==null) { + return false; + } return (compareTo((Individual)o)==0); } Modified: trunk/src/dl-learner/org/dllearner/learningproblems/EvaluatedDescriptionClass.java =================================================================== --- trunk/src/dl-learner/org/dllearner/learningproblems/EvaluatedDescriptionClass.java 2009-08-17 15:17:59 UTC (rev 1825) +++ trunk/src/dl-learner/org/dllearner/learningproblems/EvaluatedDescriptionClass.java 2009-08-17 16:40:36 UTC (rev 1826) @@ -26,6 +26,7 @@ import org.dllearner.core.owl.Individual; import org.dllearner.utilities.owl.OWLAPIDescriptionConvertVisitor; import org.dllearner.utilities.owl.OWLAPIRenderers; +import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; import org.semanticweb.owl.model.OWLDescription; @@ -114,8 +115,8 @@ object.put("descriptionOWLXML", OWLAPIRenderers.toOWLXMLSyntax(d)); object.put("descriptionKBSyntax", description.toKBSyntaxString()); object.put("scoreValue", score.getAccuracy()); - object.put("additionalInstances", getAdditionalInstances()); - object.put("coveredInstances", getCoveredInstances()); + object.put("additionalInstances", new JSONArray(getAdditionalInstances())); + object.put("coveredInstances", new JSONArray(getCoveredInstances())); object.put("isConsistent", isConsistent()); object.put("coverage", getCoverage()); object.put("addition", getAddition()); Modified: trunk/src/php-examples/LearningClass.php =================================================================== --- trunk/src/php-examples/LearningClass.php 2009-08-17 15:17:59 UTC (rev 1825) +++ trunk/src/php-examples/LearningClass.php 2009-08-17 16:40:36 UTC (rev 1826) @@ -48,6 +48,7 @@ $client->applyConfigEntryURL($id, $lp, "classToDescribe", "http://ns.softwiki.de/req/CustomerRequirement"); $la_id = $client->setLearningAlgorithm($id, "celoe"); +$client->applyConfigEntryInt($id, $la_id, "maxExecutionTimeInSeconds", 5); $client->initAll($id); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-08-17 15:18:09
|
Revision: 1825 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1825&view=rev Author: jenslehmann Date: 2009-08-17 15:17:59 +0000 (Mon, 17 Aug 2009) Log Message: ----------- return solutions in descending order Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/learningproblems/EvaluatedDescriptionClass.java trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java Modified: trunk/src/dl-learner/org/dllearner/learningproblems/EvaluatedDescriptionClass.java =================================================================== --- trunk/src/dl-learner/org/dllearner/learningproblems/EvaluatedDescriptionClass.java 2009-08-15 11:31:37 UTC (rev 1824) +++ trunk/src/dl-learner/org/dllearner/learningproblems/EvaluatedDescriptionClass.java 2009-08-17 15:17:59 UTC (rev 1825) @@ -105,6 +105,7 @@ * descriptions by transforming them to a JSON string. * @return A JSON representation of an evaluated description. */ + @Override public String asJSON() { JSONObject object = new JSONObject(); try { Modified: trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2009-08-15 11:31:37 UTC (rev 1824) +++ trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2009-08-17 15:17:59 UTC (rev 1825) @@ -366,7 +366,7 @@ TreeSet<? extends EvaluatedDescription> descriptions = state.getLearningAlgorithm().getCurrentlyBestEvaluatedDescriptions(); String json = "{"; int count = 1; - for(EvaluatedDescription description : descriptions) { + for(EvaluatedDescription description : descriptions.descendingSet()) { if (count>1) json += ",\"solution" + count + "\" : " + description.asJSON(); else json += "\"solution" + count + "\" : " + description.asJSON(); count++; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <hee...@us...> - 2009-08-15 11:31:45
|
Revision: 1824 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1824&view=rev Author: heeroyuy Date: 2009-08-15 11:31:37 +0000 (Sat, 15 Aug 2009) Log Message: ----------- -add a new task to build the necessary jars for ontowiki and copy it to the plugin dir of ontowiki Modified Paths: -------------- trunk/build.xml Modified: trunk/build.xml =================================================================== --- trunk/build.xml 2009-08-13 14:27:03 UTC (rev 1823) +++ trunk/build.xml 2009-08-15 11:31:37 UTC (rev 1824) @@ -6,6 +6,7 @@ <property name="source_dir" value="src/dl-learner" /> <property name="protege_dir" value="/home/jl/programme/Protege_4.0_beta/plugins" /> <property name="class_dir" value="classes" /> + <property name="ontowiki_dir" value="${user.home}/workspace/ontowiki/ontowiki/src/extensions/components/dllearner/dllearner" /> <property name="php_client_dir" value="src/php-client" /> <tstamp> @@ -404,4 +405,44 @@ <delete dir="${release}" /> </target> + <!--Builds the Ontowiki DL-Learner Jar --> + + <target name="buildOntowikiDLLearnerJar"> + <mkdir dir="${temp}"/> + <mkdir dir="${release}"/> + <mkdir dir="${release}/lib"/> + <mkdir dir="${release}/lib/pellet"/> + <mkdir dir="${release}/lib/jena"/> + <mkdir dir="${release}/lib/owlapi"/> + + <copy toDir="${release}/lib"> + <fileset dir="${lib_dir}" includes="jamon-2.7.jar,log4j.jar,components.ini"/> + </copy> + + <copy toDir="${release}/lib/owlapi"> + <fileset dir="${lib_dir}/owlapi" includes="owlapi-bin.jar"/> + </copy> + <copy toDir="${release}/lib/pellet"> + <fileset dir="${lib_dir}/pellet" includes="pellet-core.jar, pellet-owlapi.jar"/> + </copy> + + <copy toDir="${release}/lib/jena"> + <fileset dir="${lib_dir}/jena" includes="commons-logging-1.1.1.jar,json.jar"/> + </copy> + + <copy toDir="${temp}"> + <fileset dir="${class_dir}"/> + </copy> + + <jar destfile="${release}/dllearner.jar"> + <fileset dir="${temp}"/> + </jar> + <copy toDir="${ontowiki_dir}"> + <fileset dir="${release}"/> + </copy> + + <delete dir="${temp}" /> + <delete dir="${release}" /> + </target> + </project> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ku...@us...> - 2009-08-13 14:27:11
|
Revision: 1823 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1823&view=rev Author: kurzum Date: 2009-08-13 14:27:03 +0000 (Thu, 13 Aug 2009) Log Message: ----------- hacked a hack with a hack to fix it Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/kb/extraction/BlankNode.java Modified: trunk/src/dl-learner/org/dllearner/kb/extraction/BlankNode.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/extraction/BlankNode.java 2009-08-13 14:08:23 UTC (rev 1822) +++ trunk/src/dl-learner/org/dllearner/kb/extraction/BlankNode.java 2009-08-13 14:27:03 UTC (rev 1823) @@ -4,6 +4,7 @@ import java.util.ArrayList; import java.util.HashSet; import java.util.List; +import java.util.NoSuchElementException; import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; @@ -148,15 +149,26 @@ //System.out.println("nil found"); //do nothing }else{ - if(next.otherNodes.first().a.equals(OWLVocabulary.RDF_FIRST)){ - target.add(factory.getOWLClass(URI.create(next.otherNodes.first().b))); - tmp.add(next.blankNodes.get(0)); - //System.out.println("bnode added"); - }else{ + StringTuple firstOtherNodes = null; + try{ + firstOtherNodes = next.otherNodes.first(); + if(firstOtherNodes.a.equals(OWLVocabulary.RDF_FIRST)){ + target.add(factory.getOWLClass(URI.create(firstOtherNodes.b))); + tmp.add(next.blankNodes.get(0)); + //System.out.println("bnode added"); + }else{ + + tail("double nesting not supported yet"); + + } - tail("double nesting not supported yet"); + }catch (NoSuchElementException e) { + logger.warn("something strange happened here: "+firstOtherNodes); + logger.warn("and here: "+next.otherNodes); + e.printStackTrace(); } + } }//end while This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-08-13 14:08:35
|
Revision: 1822 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1822&view=rev Author: jenslehmann Date: 2009-08-13 14:08:23 +0000 (Thu, 13 Aug 2009) Log Message: ----------- - added PHP example for class learning - implemented JSON return format for class learning - added new learning method to web service Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/learningproblems/EvaluatedDescriptionClass.java trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java trunk/src/php-examples/LearningSimple.php trunk/src/php-examples/main.wsdl Added Paths: ----------- trunk/src/php-examples/LearningClass.php Modified: trunk/src/dl-learner/org/dllearner/learningproblems/EvaluatedDescriptionClass.java =================================================================== --- trunk/src/dl-learner/org/dllearner/learningproblems/EvaluatedDescriptionClass.java 2009-08-07 08:54:57 UTC (rev 1821) +++ trunk/src/dl-learner/org/dllearner/learningproblems/EvaluatedDescriptionClass.java 2009-08-13 14:08:23 UTC (rev 1822) @@ -24,6 +24,11 @@ import org.dllearner.core.EvaluatedDescription; import org.dllearner.core.owl.Description; import org.dllearner.core.owl.Individual; +import org.dllearner.utilities.owl.OWLAPIDescriptionConvertVisitor; +import org.dllearner.utilities.owl.OWLAPIRenderers; +import org.json.JSONException; +import org.json.JSONObject; +import org.semanticweb.owl.model.OWLDescription; /** * An evaluated description for learning classes in ontologies. @@ -95,4 +100,28 @@ return classScore.followsFromKB(); } + /** + * This convenience method can be used to store and exchange evaluated + * descriptions by transforming them to a JSON string. + * @return A JSON representation of an evaluated description. + */ + public String asJSON() { + JSONObject object = new JSONObject(); + try { + object.put("descriptionManchesterSyntax", description.toManchesterSyntaxString(null, null)); + OWLDescription d = OWLAPIDescriptionConvertVisitor.getOWLDescription(description); + object.put("descriptionOWLXML", OWLAPIRenderers.toOWLXMLSyntax(d)); + object.put("descriptionKBSyntax", description.toKBSyntaxString()); + object.put("scoreValue", score.getAccuracy()); + object.put("additionalInstances", getAdditionalInstances()); + object.put("coveredInstances", getCoveredInstances()); + object.put("isConsistent", isConsistent()); + object.put("coverage", getCoverage()); + object.put("addition", getAddition()); + return object.toString(3); + } catch (JSONException e) { + e.printStackTrace(); + return null; + } + } } Modified: trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java =================================================================== --- trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2009-08-07 08:54:57 UTC (rev 1821) +++ trunk/src/dl-learner/org/dllearner/server/DLLearnerWS.java 2009-08-13 14:08:23 UTC (rev 1822) @@ -356,12 +356,37 @@ * of the learned description. * * @param id The session ID. + * @return A JSON string encoding learned descriptions. + * @throws ClientNotKnownException Thrown if client (session ID) is not known. + */ + @WebMethod + public String learnDescriptionsEvaluated(int id) throws ClientNotKnownException { + ClientState state = getState(id); + state.getLearningAlgorithm().start(); + TreeSet<? extends EvaluatedDescription> descriptions = state.getLearningAlgorithm().getCurrentlyBestEvaluatedDescriptions(); + String json = "{"; + int count = 1; + for(EvaluatedDescription description : descriptions) { + if (count>1) json += ",\"solution" + count + "\" : " + description.asJSON(); + else json += "\"solution" + count + "\" : " + description.asJSON(); + count++; + } + json+="}"; + return json; + } + + /** + * Returns a list of JSON encoded description including extra information + * (which partially depends on the learning problem) such as the accuracy + * of the learned description. + * + * @param id The session ID. * @param limit Maximum number of results desired. * @return A JSON string encoding learned descriptions. * @throws ClientNotKnownException Thrown if client (session ID) is not known. */ @WebMethod - public String learnDescriptionsEvaluated(int id, int limit) throws ClientNotKnownException { + public String learnDescriptionsEvaluatedLimit(int id, int limit) throws ClientNotKnownException { ClientState state = getState(id); state.getLearningAlgorithm().start(); List<? extends EvaluatedDescription> descriptions = state.getLearningAlgorithm().getCurrentlyBestEvaluatedDescriptions(limit); Added: trunk/src/php-examples/LearningClass.php =================================================================== --- trunk/src/php-examples/LearningClass.php (rev 0) +++ trunk/src/php-examples/LearningClass.php 2009-08-13 14:08:23 UTC (rev 1822) @@ -0,0 +1,66 @@ +<?php +/** + * Copyright (C) 2007-2009, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + + /** + * Small example showing how to use DL-Learner for learning class definitions. + * + * @author Jens Lehmann + */ + +include('Utilities.php'); + +// load WSDL files (has to be done due to a Java web service bug) +ini_set("soap.wsdl_cache_enabled","0"); +$wsdluri="http://localhost:8181/services?wsdl"; +// Utilities::loadWSDLfiles($wsdluri); + +// specifiy ontology +$ontology = 'file:'.realpath("../../examples/swore/swore.rdf"); + +// create DL-Learner client +$client = new SoapClient("main.wsdl"); +// $client = new SoapClient($wsdluri); + +$id = $client->generateID(); +$ksID = $client->addKnowledgeSource($id, "owlfile", $ontology); +$rID = $client->setReasoner($id, "fastInstanceChecker"); + +// create a learning problem +$lp = $client->setLearningProblem($id, "classLearning"); +$client->applyConfigEntryURL($id, $lp, "classToDescribe", "http://ns.softwiki.de/req/CustomerRequirement"); + +$la_id = $client->setLearningAlgorithm($id, "celoe"); + +$client->initAll($id); + +// learn concept +echo 'start learning ... '; +// get only concept +// $concept = $client->learn($id, "manchester"); +// get concept and additional information in JSON syntax +$concept = $client->learnDescriptionsEvaluated($id); +echo 'OK <br />'; + +echo 'solution: <pre>'; +var_dump(json_decode($concept, true)); +echo '</pre>'; + +?> Modified: trunk/src/php-examples/LearningSimple.php =================================================================== --- trunk/src/php-examples/LearningSimple.php 2009-08-07 08:54:57 UTC (rev 1821) +++ trunk/src/php-examples/LearningSimple.php 2009-08-13 14:08:23 UTC (rev 1822) @@ -30,7 +30,7 @@ // load WSDL files (has to be done due to a Java web service bug) ini_set("soap.wsdl_cache_enabled","0"); $wsdluri="http://localhost:8181/services?wsdl"; -Utilities::loadWSDLfiles($wsdluri); +// Utilities::loadWSDLfiles($wsdluri); // specifiy ontology $ontology = 'file:'.realpath("../../examples/family/father.owl"); Modified: trunk/src/php-examples/main.wsdl =================================================================== --- trunk/src/php-examples/main.wsdl 2009-08-07 08:54:57 UTC (rev 1821) +++ trunk/src/php-examples/main.wsdl 2009-08-13 14:08:23 UTC (rev 1822) @@ -1,4 +1,4 @@ -<?xml version="1.0" encoding="UTF-8"?><!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.6 in JDK 6. --><!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.6 in JDK 6. --><definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://server.dllearner.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://server.dllearner.org/" name="DLLearnerWSService"> +<?xml version="1.0" encoding="UTF-8"?><!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.1 in JDK 6. --><!-- Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.1 in JDK 6. --><definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://server.dllearner.org/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://server.dllearner.org/" name="DLLearnerWSService"> <types> <xsd:schema> <xsd:import namespace="http://server.dllearner.org/" schemaLocation="def0.xsd"></xsd:import> @@ -117,7 +117,6 @@ </message> <message name="learnDescriptionsEvaluated"> <part name="arg0" type="xsd:int"></part> -<part name="arg1" type="xsd:int"></part> </message> <message name="learnDescriptionsEvaluatedResponse"> <part name="return" type="xsd:string"></part> @@ -129,6 +128,13 @@ <message name="getCurrentlyBestEvaluatedDescriptionsResponse"> <part name="return" type="xsd:string"></part> </message> +<message name="learnDescriptionsEvaluatedLimit"> +<part name="arg0" type="xsd:int"></part> +<part name="arg1" type="xsd:int"></part> +</message> +<message name="learnDescriptionsEvaluatedLimitResponse"> +<part name="return" type="xsd:string"></part> +</message> <message name="learnThreaded"> <part name="arg0" type="xsd:int"></part> </message> @@ -406,40 +412,40 @@ <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> <fault message="tns:ComponentInitException" name="ComponentInitException"></fault> </operation> -<operation name="stop"> +<operation name="stop" parameterOrder="arg0"> <input message="tns:stop"></input> <output message="tns:stopResponse"></output> <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> </operation> -<operation name="getBuild"> +<operation name="getBuild" parameterOrder=""> <input message="tns:getBuild"></input> <output message="tns:getBuildResponse"></output> </operation> -<operation name="ping"> +<operation name="ping" parameterOrder=""> <input message="tns:ping"></input> <output message="tns:pingResponse"></output> </operation> -<operation name="generateID"> +<operation name="generateID" parameterOrder=""> <input message="tns:generateID"></input> <output message="tns:generateIDResponse"></output> </operation> -<operation name="getComponents"> +<operation name="getComponents" parameterOrder=""> <input message="tns:getComponents"></input> <output message="tns:getComponentsResponse"></output> </operation> -<operation name="getKnowledgeSources"> +<operation name="getKnowledgeSources" parameterOrder=""> <input message="tns:getKnowledgeSources"></input> <output message="tns:getKnowledgeSourcesResponse"></output> </operation> -<operation name="getReasoners"> +<operation name="getReasoners" parameterOrder=""> <input message="tns:getReasoners"></input> <output message="tns:getReasonersResponse"></output> </operation> -<operation name="getLearningProblems"> +<operation name="getLearningProblems" parameterOrder=""> <input message="tns:getLearningProblems"></input> <output message="tns:getLearningProblemsResponse"></output> </operation> -<operation name="getLearningAlgorithms"> +<operation name="getLearningAlgorithms" parameterOrder=""> <input message="tns:getLearningAlgorithms"></input> <output message="tns:getLearningAlgorithmsResponse"></output> </operation> @@ -479,7 +485,7 @@ <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> <fault message="tns:LearningProblemUnsupportedException" name="LearningProblemUnsupportedException"></fault> </operation> -<operation name="initAll"> +<operation name="initAll" parameterOrder="arg0"> <input message="tns:initAll"></input> <output message="tns:initAllResponse"></output> <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> @@ -490,7 +496,7 @@ <output message="tns:learnResponse"></output> <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> </operation> -<operation name="learnDescriptionsEvaluated" parameterOrder="arg0 arg1"> +<operation name="learnDescriptionsEvaluated" parameterOrder="arg0"> <input message="tns:learnDescriptionsEvaluated"></input> <output message="tns:learnDescriptionsEvaluatedResponse"></output> <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> @@ -500,12 +506,17 @@ <output message="tns:getCurrentlyBestEvaluatedDescriptionsResponse"></output> <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> </operation> -<operation name="learnThreaded"> +<operation name="learnDescriptionsEvaluatedLimit" parameterOrder="arg0 arg1"> +<input message="tns:learnDescriptionsEvaluatedLimit"></input> +<output message="tns:learnDescriptionsEvaluatedLimitResponse"></output> +<fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> +</operation> +<operation name="learnThreaded" parameterOrder="arg0"> <input message="tns:learnThreaded"></input> <output message="tns:learnThreadedResponse"></output> <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> </operation> -<operation name="getCurrentlyBestConcept"> +<operation name="getCurrentlyBestConcept" parameterOrder="arg0"> <input message="tns:getCurrentlyBestConcept"></input> <output message="tns:getCurrentlyBestConceptResponse"></output> <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> @@ -520,7 +531,7 @@ <output message="tns:getCurrentlyBestEvaluatedDescriptionsFilteredResponse"></output> <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> </operation> -<operation name="isAlgorithmRunning"> +<operation name="isAlgorithmRunning" parameterOrder="arg0"> <input message="tns:isAlgorithmRunning"></input> <output message="tns:isAlgorithmRunningResponse"></output> <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> @@ -608,12 +619,12 @@ <fault message="tns:UnknownComponentException" name="UnknownComponentException"></fault> <fault message="tns:ConfigOptionTypeException" name="ConfigOptionTypeException"></fault> </operation> -<operation name="getAtomicConcepts"> +<operation name="getAtomicConcepts" parameterOrder="arg0"> <input message="tns:getAtomicConcepts"></input> <output message="tns:getAtomicConceptsResponse"></output> <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> </operation> -<operation name="getSubsumptionHierarchy"> +<operation name="getSubsumptionHierarchy" parameterOrder="arg0"> <input message="tns:getSubsumptionHierarchy"></input> <output message="tns:getSubsumptionHierarchyResponse"></output> <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> @@ -624,17 +635,17 @@ <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> <fault message="tns:ParseException" name="ParseException"></fault> </operation> -<operation name="getConceptLength"> +<operation name="getConceptLength" parameterOrder="arg0"> <input message="tns:getConceptLength"></input> <output message="tns:getConceptLengthResponse"></output> <fault message="tns:ParseException" name="ParseException"></fault> </operation> -<operation name="getAtomicRoles"> +<operation name="getAtomicRoles" parameterOrder="arg0"> <input message="tns:getAtomicRoles"></input> <output message="tns:getAtomicRolesResponse"></output> <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> </operation> -<operation name="getInstances"> +<operation name="getInstances" parameterOrder="arg0"> <input message="tns:getInstances"></input> <output message="tns:getInstancesResponse"></output> <fault message="tns:ClientNotKnownException" name="ClientNotKnownException"></fault> @@ -952,6 +963,18 @@ <soap:fault name="ClientNotKnownException" use="literal"></soap:fault> </fault> </operation> +<operation name="learnDescriptionsEvaluatedLimit"> +<soap:operation soapAction=""></soap:operation> +<input> +<soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> +</input> +<output> +<soap:body use="literal" namespace="http://server.dllearner.org/"></soap:body> +</output> +<fault name="ClientNotKnownException"> +<soap:fault name="ClientNotKnownException" use="literal"></soap:fault> +</fault> +</operation> <operation name="learnThreaded"> <soap:operation soapAction=""></soap:operation> <input> @@ -1465,4 +1488,4 @@ <soap:address location="http://localhost:8181/services"></soap:address> </port> </service> -</definitions> \ No newline at end of file +</definitions> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ku...@us...> - 2009-08-07 08:55:11
|
Revision: 1821 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1821&view=rev Author: kurzum Date: 2009-08-07 08:54:57 +0000 (Fri, 07 Aug 2009) Log Message: ----------- Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/ore/SPARQLTest.java Modified: trunk/src/dl-learner/org/dllearner/tools/ore/SPARQLTest.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/SPARQLTest.java 2009-08-06 14:43:14 UTC (rev 1820) +++ trunk/src/dl-learner/org/dllearner/tools/ore/SPARQLTest.java 2009-08-07 08:54:57 UTC (rev 1821) @@ -36,7 +36,9 @@ import org.dllearner.kb.sparql.SparqlKnowledgeSource; import org.dllearner.kb.sparql.SparqlQuery; import org.dllearner.learningproblems.ClassLearningProblem; +import org.dllearner.reasoning.FastInstanceChecker; import org.dllearner.reasoning.OWLAPIReasoner; +import org.dllearner.utilities.datastructures.SetManipulation; import org.dllearner.utilities.examples.AutomaticNegativeExampleFinderSPARQL; import org.dllearner.utilities.examples.AutomaticPositiveExampleFinderSPARQL; @@ -78,11 +80,16 @@ AutomaticPositiveExampleFinderSPARQL pos = new AutomaticPositiveExampleFinderSPARQL(task); pos.makePositiveExamplesFromConcept(exampleClass); - SortedSet<String> posExamples = pos.getPosExamples(); + + SortedSet<String> allPosExamples = pos.getPosExamples(); + SortedSet<String> posExamples = SetManipulation.stableShrink(allPosExamples, 20); + System.out.println(posExamples.size()); System.out.println(posExamples); + AutomaticNegativeExampleFinderSPARQL neg = new AutomaticNegativeExampleFinderSPARQL( posExamples, task, new TreeSet<String>()); + neg.makeNegativeExamplesFromSuperClasses(exampleClass, 1000); SortedSet<String> negExamples = neg.getNegativeExamples(20); System.out.println(negExamples); @@ -95,8 +102,9 @@ cm.applyConfigEntry(ks, "predefinedEndpoint", "DBPEDIA"); ks.getConfigurator().setInstances(instances); ks.getConfigurator().setPredefinedFilter("YAGO"); + ks.getConfigurator().setSaveExtractedFragment(true); ks.init(); - ReasonerComponent reasoner = cm.reasoner(OWLAPIReasoner.class, ks); + ReasonerComponent reasoner = cm.reasoner(FastInstanceChecker.class, ks); reasoner.init(); ClassLearningProblem lp = cm.learningProblem(ClassLearningProblem.class, reasoner); // lp.getConfigurator().setPositiveExamples(posExamples); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-08-06 14:43:20
|
Revision: 1820 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1820&view=rev Author: jenslehmann Date: 2009-08-06 14:43:14 +0000 (Thu, 06 Aug 2009) Log Message: ----------- added manual as dependency of build task Modified Paths: -------------- trunk/build.xml Modified: trunk/build.xml =================================================================== --- trunk/build.xml 2009-08-06 14:23:17 UTC (rev 1819) +++ trunk/build.xml 2009-08-06 14:43:14 UTC (rev 1820) @@ -97,7 +97,7 @@ <!-- build target --> - <target name="build" depends="createScripts" description="fast build including scripts, no javadoc"> + <target name="build" depends="createScripts,manual" description="fast build including scripts, no javadoc"> <!-- write current build date into Info.java --> <echo file="${source_dir}/org/dllearner/Info.java" append="false"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-08-06 14:23:35
|
Revision: 1819 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1819&view=rev Author: jenslehmann Date: 2009-08-06 14:23:17 +0000 (Thu, 06 Aug 2009) Log Message: ----------- - new stat constructor for merging two stat objects - evaluation script extended Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/scripts/evaluation/OntologyEngineering.java trunk/src/dl-learner/org/dllearner/utilities/statistics/Stat.java Modified: trunk/src/dl-learner/org/dllearner/scripts/evaluation/OntologyEngineering.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/evaluation/OntologyEngineering.java 2009-08-04 20:07:44 UTC (rev 1818) +++ trunk/src/dl-learner/org/dllearner/scripts/evaluation/OntologyEngineering.java 2009-08-06 14:23:17 UTC (rev 1819) @@ -78,10 +78,10 @@ private static DecimalFormat df = new DecimalFormat(); // for performance measurements and development - private static boolean autoMode = true; + private static boolean autoMode = false; private static boolean useFastInstanceChecker = true; - private static boolean useApproximations = false; - private static boolean computeApproxDiff = true; + private static boolean useApproximations = true; + private static boolean computeApproxDiff = false; @SuppressWarnings("unchecked") public static void main(String[] args) throws ComponentInitException, @@ -424,6 +424,24 @@ + accAboveThresholdStatSC.prettyPrint("")); System.out.println("non-perfect (not 100% accuracy) axioms selected: " + nonPerfectCountSC); System.out.println("average number typed by user: " + positionStatSC.prettyPrint("")); + System.out.println(); + + System.out.println("merged statistics for equivalence/superclass:"); + System.out.println("classes above " + (minAccuracy * 100) + "% threshold: " + + (candidatesAboveThresholdCount+candidatesAboveThresholdCountSC)); + System.out.println("axioms learned succesfully: " + (foundDescriptionCount+foundDescriptionCountSC)); + System.out.println("axioms missed: " + (missesCount+missesCountSC)); + System.out.println("class with no sensible axioms: " + (noSensibleDescriptionCount+noSensibleDescriptionCountSC)); + System.out.println("inconsistencies detected: " + (inconsistencyDetected+inconsistencyDetectedSC)); + System.out.println("additional instances found: " + new Stat(moreInstancesCountStat,moreInstancesCountStatSC).prettyPrint("")); + System.out.println("average accuracy overall: " + new Stat(accStat,accStatSC).prettyPrint("")); + System.out.println("average accuracy of selected expressions: " + + new Stat(accSelectedStat,accSelectedStatSC).prettyPrint("")); + System.out.println("average accuracy of expressions above threshold: " + + new Stat(accAboveThresholdStat,accAboveThresholdStatSC).prettyPrint("")); + System.out.println("non-perfect (not 100% accuracy) axioms selected: " + (nonPerfectCount+nonPerfectCountSC)); + System.out.println("average number typed by user: " + new Stat(positionStat,positionStatSC).prettyPrint("")); + System.out.println(); } @SuppressWarnings("unused") Modified: trunk/src/dl-learner/org/dllearner/utilities/statistics/Stat.java =================================================================== --- trunk/src/dl-learner/org/dllearner/utilities/statistics/Stat.java 2009-08-04 20:07:44 UTC (rev 1818) +++ trunk/src/dl-learner/org/dllearner/utilities/statistics/Stat.java 2009-08-06 14:23:17 UTC (rev 1819) @@ -39,7 +39,26 @@ //used to give a good percentage output private DecimalFormat df = new DecimalFormat( ".00%" ); + public Stat() { + + } + /** + * Creates a new stat object by merging two stat objects. The result is the same as if + * the numbers, which have been added to stat1 and stat2 would have been added to this + * stat object. + * @param stat1 Statistical object 1. + * @param stat2 Statistical object 2. + */ + public Stat(Stat stat1, Stat stat2) { + count = stat1.count + stat2.count; + sum = stat1.sum + stat2.sum; + squareSum = stat1.squareSum + stat2.squareSum; + min = Math.min(stat1.min, stat2.min); + max = Math.max(stat1.max, stat2.max); + } + + /** * Add a number to this object. * * @param number This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lor...@us...> - 2009-08-04 20:07:58
|
Revision: 1818 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1818&view=rev Author: lorenz_b Date: 2009-08-04 20:07:44 +0000 (Tue, 04 Aug 2009) Log Message: ----------- refactored package structure, since developing and maintaining became to ineffective Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/reasoning/PelletReasoner.java trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationManager.java trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ImpactManager.java trunk/src/dl-learner/org/dllearner/tools/ore/Main.java trunk/src/dl-learner/org/dllearner/tools/ore/ORE.java trunk/src/dl-learner/org/dllearner/tools/ore/SPARQLTest.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/AxiomSelector.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/LaconicTest.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionParseTest.java trunk/src/dl-learner/org/dllearner/tools/ore/RepairManager.java trunk/src/dl-learner/org/dllearner/tools/ore/RepairManagerListener.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/laconic/ trunk/src/dl-learner/org/dllearner/tools/ore/explanation/laconic/BaseDescriptionGenerator.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/laconic/Beta.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/laconic/BottomTester.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/laconic/LaconicExplanationGenerator.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/laconic/OPlus.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/laconic/Tau.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/laconic/TopTester.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/relevance/ trunk/src/dl-learner/org/dllearner/tools/ore/explanation/relevance/HittingSet.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/relevance/SyntacticRelevanceBasedExplanationGenerator.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/MouseOverHintDemo.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/MouseOverHintManager.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/StatusBar.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/StatusBarSimulator.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/StatusManager.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/StatusManagerListener.java Removed Paths: ------------- trunk/src/dl-learner/org/dllearner/tools/ore/ChangePanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ChangesPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelOWL.java trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelOWLDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelSparql.java trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelSparqlDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/ClassificationProgressMonitor.java trunk/src/dl-learner/org/dllearner/tools/ore/ColorListCellRenderer.java trunk/src/dl-learner/org/dllearner/tools/ore/ColumnListCellRenderer.java trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionLabel.java trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionMenuItem.java trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationTable.java trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationTableModel.java trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationTablePanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ImpactTable.java trunk/src/dl-learner/org/dllearner/tools/ore/ImpactTableModel.java trunk/src/dl-learner/org/dllearner/tools/ore/InconsistencyExplanationPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/InconsistencyExplanationPanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/IntroductionPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/IntroductionPanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/KnowledgeSourcePanel.java trunk/src/dl-learner/org/dllearner/tools/ore/KnowledgeSourcePanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/LearningPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/LearningPanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/LeftPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/OWLSyntaxTableCellRenderer.java trunk/src/dl-learner/org/dllearner/tools/ore/RepairDialog.java trunk/src/dl-learner/org/dllearner/tools/ore/RepairPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/RepairPanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/RepairPlanPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/RepairTable.java trunk/src/dl-learner/org/dllearner/tools/ore/RepairTableModel.java trunk/src/dl-learner/org/dllearner/tools/ore/SavePanel.java trunk/src/dl-learner/org/dllearner/tools/ore/SavePanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/StatsPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/UndoLabel.java trunk/src/dl-learner/org/dllearner/tools/ore/UnsatClassesListCellRenderer.java trunk/src/dl-learner/org/dllearner/tools/ore/UnsatisfiableExplanationPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/UnsatisfiableExplanationPanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/Wizard.java trunk/src/dl-learner/org/dllearner/tools/ore/WizardController.java trunk/src/dl-learner/org/dllearner/tools/ore/WizardModel.java trunk/src/dl-learner/org/dllearner/tools/ore/WizardPanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/WizardPanelNotFoundException.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/BaseDescriptionGenerator.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/Beta.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/BottomTester.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/HittingSet.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/LaconicExplanationGenerator.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/OPlus.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/SyntacticRelevanceBasedExplanationGenerator.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/Tau.java trunk/src/dl-learner/org/dllearner/tools/ore/explanation/TopTester.java Modified: trunk/src/dl-learner/org/dllearner/reasoning/PelletReasoner.java =================================================================== --- trunk/src/dl-learner/org/dllearner/reasoning/PelletReasoner.java 2009-08-04 20:02:34 UTC (rev 1817) +++ trunk/src/dl-learner/org/dllearner/reasoning/PelletReasoner.java 2009-08-04 20:07:44 UTC (rev 1818) @@ -290,7 +290,7 @@ manager = OWLManager.createOWLOntologyManager(); factory = manager.getOWLDataFactory(); //set classification output to "none", while default is "console" - PelletOptions.USE_CLASSIFICATION_MONITOR = PelletOptions.MonitorType.NONE; + PelletOptions.USE_CLASSIFICATION_MONITOR = PelletOptions.MonitorType.CONSOLE; // change log level to WARN for Pellet, because otherwise log // output will be very large Logger pelletLogger = Logger.getLogger("org.mindswap.pellet"); Deleted: trunk/src/dl-learner/org/dllearner/tools/ore/ChangePanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ChangePanel.java 2009-08-04 20:02:34 UTC (rev 1817) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ChangePanel.java 2009-08-04 20:07:44 UTC (rev 1818) @@ -1,58 +0,0 @@ -/** - * Copyright (C) 2007-2008, Jens Lehmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -package org.dllearner.tools.ore; - - -import java.awt.Color; -import java.awt.event.MouseListener; -import java.util.List; - -import javax.swing.JLabel; -import javax.swing.JPanel; - -import org.semanticweb.owl.model.OWLOntologyChange; -/** - * JPanel where an ontology change and his undo function is listed. - * @author Lorenz Buehmann - * - */ -public class ChangePanel extends JPanel{ - - /** - * - */ - private static final long serialVersionUID = -934113184795465461L; - - /** - * Constructor. - * @param label labelname - * @param changes ontology changes - * @param mL mouse listener - */ - public ChangePanel(String label, List<OWLOntologyChange> changes, MouseListener mL){ - super(); - add(new JLabel(label)); - add(new UndoLabel(changes, mL)); - setBackground(Color.WHITE); - - } - -} Deleted: trunk/src/dl-learner/org/dllearner/tools/ore/ChangesPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ChangesPanel.java 2009-08-04 20:02:34 UTC (rev 1817) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ChangesPanel.java 2009-08-04 20:07:44 UTC (rev 1818) @@ -1,62 +0,0 @@ -/** - * Copyright (C) 2007-2008, Jens Lehmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -package org.dllearner.tools.ore; - -import java.awt.Color; -import java.awt.Container; -import java.awt.GridLayout; - -import javax.swing.BorderFactory; -import javax.swing.JPanel; -import javax.swing.SwingUtilities; -import javax.swing.border.BevelBorder; -/** - * JPanel where all ontology changes are shown. - * @author Lorenz Buehmann - * - */ -public class ChangesPanel extends JPanel{ - - private static final long serialVersionUID = -7538532926820669891L; - - /** - * Constructor. - */ - public ChangesPanel(){ - super(); - setLayout(new GridLayout(0, 1)); - setBackground(Color.WHITE); - setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); - - } - - - /** - * Refresh the actual panel. - * @param cont gui container for changes - */ - public void updatePanel(Container cont){ - remove(cont); - SwingUtilities.updateComponentTreeUI(this); - } - - -} Deleted: trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelOWL.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelOWL.java 2009-08-04 20:02:34 UTC (rev 1817) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelOWL.java 2009-08-04 20:07:44 UTC (rev 1818) @@ -1,170 +0,0 @@ -/** - * Copyright (C) 2007-2008, Jens Lehmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -package org.dllearner.tools.ore; - -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.geom.Ellipse2D; -import java.awt.geom.RoundRectangle2D; - -import javax.swing.DefaultListModel; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.event.ListSelectionListener; - -import org.jdesktop.swingx.JXBusyLabel; -import org.jdesktop.swingx.JXList; -import org.jdesktop.swingx.decorator.ColorHighlighter; -import org.jdesktop.swingx.decorator.FilterPipeline; -import org.jdesktop.swingx.decorator.HighlightPredicate; -import org.jdesktop.swingx.decorator.HighlighterFactory; -import org.jdesktop.swingx.decorator.ShuttleSorter; -import org.jdesktop.swingx.icon.EmptyIcon; -import org.jdesktop.swingx.painter.BusyPainter; - -/** - * Wizard panel where atomic classes are shown in list. - * @author Lorenz Buehmann - * - */ -public class ClassPanelOWL extends JPanel{ - - private static final long serialVersionUID = 3026319637264844550L; - - private JXList conceptList; - - private JPanel contentPanel; - - private DefaultListModel model; - private JXBusyLabel loadingLabel; - private JLabel statusLabel; - - /** - * Constructor. - */ - @SuppressWarnings("unchecked") - public ClassPanelOWL() { - - super(); - - model = new DefaultListModel(); - loadingLabel = new JXBusyLabel(new Dimension(15, 15)); - statusLabel = new JLabel(); - - - BusyPainter painter = new BusyPainter( - new RoundRectangle2D.Float(0, 0, 6.0f, 2.6f, 10.0f, 10.0f), - new Ellipse2D.Float(2.0f, 2.0f, 11.0f, 11.0f)); - painter.setTrailLength(2); - painter.setPoints(7); - painter.setFrame(-1); - loadingLabel.setPreferredSize(new Dimension(15, 15)); - loadingLabel.setIcon(new EmptyIcon(15, 15)); - loadingLabel.setBusyPainter(painter); - - - - JPanel labelPanel = new JPanel(); - labelPanel.add(loadingLabel); - labelPanel.add(statusLabel); - - - contentPanel = getContentPanel(); - setLayout(new java.awt.BorderLayout()); - add(contentPanel, BorderLayout.CENTER); - add(labelPanel, BorderLayout.SOUTH); - } - - private JPanel getContentPanel() { - - JPanel contentPanel1 = new JPanel(); - JScrollPane scroll = new JScrollPane(); - - - - conceptList = new JXList(model); - conceptList.setFilterEnabled(true); - conceptList.setFilters(new FilterPipeline(new ShuttleSorter(0, true))); - conceptList.setHighlighters(HighlighterFactory.createSimpleStriping(HighlighterFactory.CLASSIC_LINE_PRINTER)); - conceptList.addHighlighter(new ColorHighlighter( HighlightPredicate.ROLLOVER_ROW)); - conceptList.setRolloverEnabled(true); -// conceptList.setSearchable(new ListsSearchPredicate.MATCH_ALL); -// conceptList.setHighlighters(HighlighterFactory.createAlternateStriping()); - - scroll.setPreferredSize(new Dimension(400, 400)); - scroll.setViewportView(conceptList); - contentPanel1.add(scroll); - - - - return contentPanel1; - } - - /** - * Returns list model for owl-classes. - * @return the list model - */ - public DefaultListModel getModel(){ - return model; - } - - - /** - * Adds list selection listener to atomic classes list. - * @param l the default list selection listener - */ - public void addSelectionListener(ListSelectionListener l){ - conceptList.addListSelectionListener(l); - } - - /** - * Returns the list where atomic owl classes are the list elements. - * @return instance of JList - */ - public JList getList(){ - return conceptList; - } - - /** - * Returns the label which reports the loading status. - * @return instance of JLabel - */ - public JLabel getStatusLabel() { - return statusLabel; - } - - /** - * Returns the animated label for loading action. - * @return instance of JXBusyLabel - */ - public JXBusyLabel getLoadingLabel() { - return loadingLabel; - } - - - - - - - -} \ No newline at end of file Deleted: trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelOWLDescriptor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelOWLDescriptor.java 2009-08-04 20:02:34 UTC (rev 1817) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelOWLDescriptor.java 2009-08-04 20:07:44 UTC (rev 1818) @@ -1,114 +0,0 @@ -/** - * Copyright (C) 2007-2008, Jens Lehmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -package org.dllearner.tools.ore; - -import javax.swing.event.ListSelectionEvent; - -import org.dllearner.core.owl.NamedClass; - - - -/** - * Wizard panel descriptor for selecting one of the atomic classes in OWL-ontology that - * has to be (re)learned. - * @author Lorenz Buehmann - * - */ -public class ClassPanelOWLDescriptor extends WizardPanelDescriptor implements javax.swing.event.ListSelectionListener{ - - /** - * Identification string for class choose panel. - */ - public static final String IDENTIFIER = "CLASS_CHOOSE_OWL_PANEL"; - /** - * Information string for class choose panel. - */ - public static final String INFORMATION = "In this panel all atomic classes in the ontology are shown in the list above. " - + "Select one of them which should be (re)learned from, then press \"Next-Button\""; - - private ClassPanelOWL owlClassPanel; - - /** - * Constructor creates new panel and adds listener to list. - */ - public ClassPanelOWLDescriptor() { - owlClassPanel = new ClassPanelOWL(); - owlClassPanel.addSelectionListener(this); - - setPanelDescriptorIdentifier(IDENTIFIER); - setPanelComponent(owlClassPanel); - - } - - @Override - public Object getNextPanelDescriptor() { - return LearningPanelDescriptor.IDENTIFIER; - } - - @Override - public Object getBackPanelDescriptor() { - return KnowledgeSourcePanelDescriptor.IDENTIFIER; - } - - @Override - public void aboutToDisplayPanel() { - getWizard().getInformationField().setText(INFORMATION); - setNextButtonAccordingToConceptSelected(); - } - - /** - * Method is called when other element in list is selected, and sets next button enabled. - * @param e ListSelectionEvent - */ - public void valueChanged(ListSelectionEvent e) { - setNextButtonAccordingToConceptSelected(); - if (!e.getValueIsAdjusting()) { - getWizardModel().getOre().setClassToLearn((NamedClass) owlClassPanel.getList().getSelectedValue()); - } - } - - private void setNextButtonAccordingToConceptSelected() { - - if (owlClassPanel.getList().getSelectedValue()!= null){ - getWizard().setNextFinishButtonEnabled(true); - }else{ - getWizard().setNextFinishButtonEnabled(false); - } - - } - - /** - * Returns the JPanel with the GUI elements. - * @return extended JPanel - */ - public ClassPanelOWL getOwlClassPanel() { - return owlClassPanel; - } - - - - - - - - - -} Deleted: trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelSparql.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelSparql.java 2009-08-04 20:02:34 UTC (rev 1817) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelSparql.java 2009-08-04 20:07:44 UTC (rev 1818) @@ -1,112 +0,0 @@ -/** - * Copyright (C) 2007-2008, Jens Lehmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -package org.dllearner.tools.ore; - -import java.awt.BorderLayout; -import java.awt.Dimension; -import java.awt.geom.Ellipse2D; -import java.awt.geom.RoundRectangle2D; - -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.JTextField; - -import org.jdesktop.swingx.JXBusyLabel; -import org.jdesktop.swingx.icon.EmptyIcon; -import org.jdesktop.swingx.painter.BusyPainter; - -/** - * Wizard Panel for SPARQL-Mode. - * @author Lorenz Buehmann - * - */ -public class ClassPanelSparql extends JPanel{ - - private static final long serialVersionUID = 3026319637264844550L; - - private JTextField classField; - - private JPanel contentPanel; - - private JXBusyLabel loadingLabel; - private JLabel statusLabel; - - @SuppressWarnings("unchecked") - public ClassPanelSparql() { - - super(); - - statusLabel = new JLabel(); - - loadingLabel = new JXBusyLabel(new Dimension(15, 15)); - BusyPainter painter = new BusyPainter( - new RoundRectangle2D.Float(0, 0, 6.0f, 2.6f, 10.0f, 10.0f), - new Ellipse2D.Float(2.0f, 2.0f, 11.0f, 11.0f)); - painter.setTrailLength(2); - painter.setPoints(7); - painter.setFrame(-1); - loadingLabel.setPreferredSize(new Dimension(15, 15)); - loadingLabel.setIcon(new EmptyIcon(15, 15)); - loadingLabel.setBusyPainter(painter); - - - JPanel labelPanel = new JPanel(); - labelPanel.add(loadingLabel); - labelPanel.add(statusLabel); - - contentPanel = getContentPanel(); - setLayout(new java.awt.BorderLayout()); - add(contentPanel, BorderLayout.CENTER); - add(labelPanel, BorderLayout.SOUTH); - } - - private JPanel getContentPanel() { - - JPanel contentPanel = new JPanel(); - - classField = new JTextField(); - - contentPanel.add(classField); - - return contentPanel; - } - - - public JTextField getClassField(){ - return classField; - } - - - public JLabel getStatusLabel() { - return statusLabel; - } - - public JXBusyLabel getLoadingLabel() { - return loadingLabel; - } - - - - - - - -} \ No newline at end of file Deleted: trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelSparqlDescriptor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelSparqlDescriptor.java 2009-08-04 20:02:34 UTC (rev 1817) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ClassPanelSparqlDescriptor.java 2009-08-04 20:07:44 UTC (rev 1818) @@ -1,72 +0,0 @@ -/** - * Copyright (C) 2007-2008, Jens Lehmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -package org.dllearner.tools.ore; - -/** - * Class for SPARQL-Mode - * @author Lorenz Buehmann - * - */ -public class ClassPanelSparqlDescriptor extends WizardPanelDescriptor{ - - public static final String IDENTIFIER = "CLASS_CHOOSE_SPARQL_PANEL"; - public static final String INFORMATION = "In this panel all atomic classes in the ontology are shown in the list above. " + - "Select one of them which should be (re)learned from then press \"Next-Button\""; - - ClassPanelSparql panel3; - - public ClassPanelSparqlDescriptor() { - panel3 = new ClassPanelSparql(); - - - setPanelDescriptorIdentifier(IDENTIFIER); - setPanelComponent(panel3); - - } - - @Override - public Object getNextPanelDescriptor() { - return LearningPanelDescriptor.IDENTIFIER; - } - - @Override - public Object getBackPanelDescriptor() { - return KnowledgeSourcePanelDescriptor.IDENTIFIER; - } - - @Override - public void aboutToDisplayPanel() { - getWizard().getInformationField().setText(INFORMATION); - - } - - - - - - - - - - - - -} Deleted: trunk/src/dl-learner/org/dllearner/tools/ore/ClassificationProgressMonitor.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ClassificationProgressMonitor.java 2009-08-04 20:02:34 UTC (rev 1817) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ClassificationProgressMonitor.java 2009-08-04 20:07:44 UTC (rev 1818) @@ -1,117 +0,0 @@ -package org.dllearner.tools.ore; - -import java.awt.Cursor; -import java.awt.Dimension; - -import javax.swing.JPanel; -import javax.swing.JProgressBar; -import javax.swing.SwingUtilities; - -import org.mindswap.pellet.utils.progress.ProgressMonitor; - -public class ClassificationProgressMonitor extends JPanel implements ProgressMonitor{ - - /** - * - */ - private static final long serialVersionUID = -4913267621100462227L; - private javax.swing.ProgressMonitor monitor; - private JProgressBar progressBar; - private String progressMessage = ""; - private String progressTitle = ""; - private int progress = 0; - private int progressLength = 0; - private int progressPercent = -1; - private long startTime = -1; - private boolean canceled = false; - - - public ClassificationProgressMonitor(){ - super(); - monitor = new javax.swing.ProgressMonitor(this, progressTitle, progressMessage, 0 ,progressLength); - progressBar = new JProgressBar(0, progressLength); - progressBar.setValue(progress); - progressBar.setStringPainted(true); - add(progressBar); - setSize(new Dimension(200, 200)); - - } - - @Override - public int getProgress() { - return progress; - } - - @Override - public int getProgressPercent() { - return progressPercent; - } - - @Override - public void incrementProgress() { - setProgress(progress + 1); - - } - - @Override - public boolean isCanceled() { - return monitor.isCanceled(); - } - - @Override - public void setProgress(int progress) { - this.progress = progress; - updateProgress(); - - } - - @Override - public void setProgressLength(int length) { - progressLength = length; - monitor.setMaximum(length); - progressBar.setMaximum(length); - - } - - @Override - public void setProgressMessage(String message) { - progressMessage = message; - monitor.setNote(message); - - } - - @Override - public void setProgressTitle(String title) { - progressTitle = title; - - } - - @Override - public void taskFinished() { - monitor.close(); - setCursor(null); - - } - - @Override - public void taskStarted() { - setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - - } - - private void updateProgress(){ - SwingUtilities.invokeLater(new Runnable(){ - - @Override - public void run() { - monitor.setProgress(progress); - progressBar.setValue(progress); - - } - - }); - } - - - -} Deleted: trunk/src/dl-learner/org/dllearner/tools/ore/ColorListCellRenderer.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ColorListCellRenderer.java 2009-08-04 20:02:34 UTC (rev 1817) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ColorListCellRenderer.java 2009-08-04 20:07:44 UTC (rev 1818) @@ -1,78 +0,0 @@ -/** - * Copyright (C) 2007-2008, Jens Lehmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -package org.dllearner.tools.ore; - -import java.awt.Color; -import java.awt.Component; - -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.ListCellRenderer; - -import org.dllearner.core.owl.Individual; -import org.dllearner.core.owl.NamedClass; - -/** - * List cell renderer for colored lines to provide better view on list values. - * @author Lorenz Buehmann - * - */ -public class ColorListCellRenderer extends JLabel implements ListCellRenderer { - - private static final long serialVersionUID = -7592805113197759247L; - private ORE ore; - - public ColorListCellRenderer(ORE ore) { - setOpaque(true); - this.ore = ore; - } - - public Component getListCellRendererComponent(JList list, Object value, - int index, boolean isSelected, boolean cellHasFocus) { - - if(value instanceof NamedClass){ - setText(((NamedClass) value).toManchesterSyntaxString(ore.getBaseURI(), ore.getPrefixes())); - } else if(value instanceof Individual){ - setText(((Individual) value).toManchesterSyntaxString(ore.getBaseURI(), ore.getPrefixes())); - } - Color background; - Color foreground; - - if (index % 2 == 0 && !isSelected) { - background = new Color(242, 242, 242); - foreground = Color.BLACK; - - } else if(isSelected){ - - background = Color.LIGHT_GRAY; - foreground = Color.BLACK; - }else{ - background = Color.WHITE; - foreground = Color.BLACK; - } - - setForeground(foreground); - setBackground(background); - - return this; - } - -} Deleted: trunk/src/dl-learner/org/dllearner/tools/ore/ColumnListCellRenderer.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ColumnListCellRenderer.java 2009-08-04 20:02:34 UTC (rev 1817) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ColumnListCellRenderer.java 2009-08-04 20:07:44 UTC (rev 1818) @@ -1,93 +0,0 @@ -/** - * Copyright (C) 2007-2008, Jens Lehmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -package org.dllearner.tools.ore; - -import java.awt.Color; -import java.awt.Component; -import java.awt.GridBagConstraints; -import java.awt.GridBagLayout; -import java.awt.Insets; -import java.math.BigDecimal; - -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JPanel; -import javax.swing.ListCellRenderer; - -import org.dllearner.learningproblems.EvaluatedDescriptionClass; - -/** - * List cell renderer for 2 columns. - * @author Lorenz Buehmann - * - */ -public class ColumnListCellRenderer extends JPanel implements ListCellRenderer { - - private static final long serialVersionUID = 3024913291199515567L; - private ORE ore; - - - public ColumnListCellRenderer(ORE ore) { - this.ore = ore; - setOpaque(true); - } - - public Component getListCellRendererComponent(JList list, Object value, - int index, boolean isSelected, boolean cellHasFocus) { - - removeAll(); - - JLabel cor = new JLabel(); - JLabel desc = new JLabel(); - setLayout(new GridBagLayout()); - desc.setText(((EvaluatedDescriptionClass) value).getDescription().toManchesterSyntaxString(ore.getBaseURI(), ore.getPrefixes())); - //round accuracy to 2 digits - double accuracy = ((EvaluatedDescriptionClass) value).getAccuracy(); - - BigDecimal roundedAccuracy = new BigDecimal(accuracy * 100); - roundedAccuracy = roundedAccuracy.setScale(2, BigDecimal.ROUND_HALF_UP); - cor.setText(String.valueOf(roundedAccuracy)); - add(cor, new GridBagConstraints(0, 0, 1, 1, 0.1, 0.0, GridBagConstraints.LINE_END, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));//, BorderLayout.WEST); - add(desc, new GridBagConstraints(1, 0, 1, 1, 0.8, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));//, BorderLayout.EAST); - - Color background; - Color foreground; - - if (index % 2 == 0 && !isSelected) { - background = new Color(242, 242, 242); - foreground = Color.BLACK; - - } else if(isSelected){ - - background = Color.LIGHT_GRAY; - foreground = Color.WHITE; - }else{ - background = Color.WHITE; - foreground = Color.BLACK; - } - - setForeground(foreground); - setBackground(background); - - return this; - } - -} \ No newline at end of file Deleted: trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionLabel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionLabel.java 2009-08-04 20:02:34 UTC (rev 1817) +++ trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionLabel.java 2009-08-04 20:07:44 UTC (rev 1818) @@ -1,315 +0,0 @@ -/** - * Copyright (C) 2007-2008, Jens Lehmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -package org.dllearner.tools.ore; - -import java.awt.Color; -import java.awt.Component; -import java.awt.Cursor; -import java.awt.event.ActionListener; -import java.awt.event.MouseEvent; -import java.awt.event.MouseListener; -import java.util.Map; -import java.util.Set; - -import javax.swing.JLabel; -import javax.swing.JMenu; -import javax.swing.JPopupMenu; -import javax.swing.ToolTipManager; - -import org.dllearner.core.owl.Description; -import org.dllearner.core.owl.Individual; -import org.dllearner.core.owl.NamedClass; -import org.dllearner.core.owl.Negation; -import org.dllearner.core.owl.ObjectAllRestriction; -import org.dllearner.core.owl.ObjectCardinalityRestriction; -import org.dllearner.core.owl.ObjectSomeRestriction; -import org.dllearner.core.owl.Thing; - -/** - * Label that might have menu items when clicked on it. - * @author Lorenz Buehmann - * - */ -public class DescriptionLabel extends JLabel implements MouseListener{ - /** - * - */ - private static final long serialVersionUID = 1L; - - private static final int MOVE_TO_CLASS = 0; - private static final int MOVE_FROM_CLASS = 1; - private static final int ADD_CLASS = 2; - private static final int REMOVE_CLASS = 3; - private static final int ADD_PROPERTY = 4; - private static final int REMOVE_RANGE_PROPERTY = 5; - private static final int DELETE_PROPERTY = 6; - private static final int REMOVE_NOT_RANGE_PROPERTY = 7; - - private final Description desc; - private Individual ind; - private ORE ore; - private JPopupMenu menu; - private String mode; - private String descriptionLabel; - - private String baseURI; - private Map<String, String> prefixes; - - /** - * constructor. - * - * @param d - * @param mode - */ - public DescriptionLabel(Description d, String mode) { - super(); - this.desc = d; - this.mode = mode; - setForeground(Color.red); - addMouseListener(this); - - } - - /** - * initialize description label with solution. - */ - public void init(){ - baseURI = ore.getBaseURI(); - prefixes = ore.getPrefixes(); - - setText(((Description) desc).toManchesterSyntaxString(ore.getBaseURI(), ore.getPrefixes())); - menu = new JPopupMenu(); - ToolTipManager.sharedInstance().setDismissDelay(7000); - //negative example solutions - if(mode.equals("neg")){ - if(!(desc instanceof Negation)){ - if(desc instanceof NamedClass){ //1. description is a named class - descriptionLabel = desc.toManchesterSyntaxString(baseURI, prefixes); - menu.add(new DescriptionMenuItem(REMOVE_CLASS, descriptionLabel, desc)); //1.a remove class assertion - - JMenu dme = new JMenu("move class assertion " + descriptionLabel + " to ..."); //1.b move individual - for(NamedClass nc : ore.getpossibleClassesMoveTo(ind)){ - DescriptionMenuItem move = new DescriptionMenuItem(MOVE_TO_CLASS, nc.toManchesterSyntaxString(baseURI, prefixes), (NamedClass) desc); - move.setName(nc.toString()); - dme.add(move); - Set<NamedClass> complements = ore.getComplements(nc, ind); //check for complement error - if(!(complements.isEmpty() || (complements.size() == 1 && complements.toArray()[0].toString().equals(desc.toString())))){ - move.setEnabled(false); - StringBuffer strBuf = new StringBuffer(); - strBuf.append("<html>class assertion not possible because individual<br> " - + "is still asserted to its complements:<br><BLOCKQUOTE>"); - - for(NamedClass n: complements){ - strBuf.append("<br><b>" + n + "</b>"); - } - strBuf.append("</BLOCKQUOTE></html>"); - - - move.setToolTipText(strBuf.toString()); - } - } - menu.add(dme); - } else if(desc instanceof ObjectSomeRestriction){ //2. description is a object some restriction - String propertyName = ((ObjectSomeRestriction) desc).getRole().toString(baseURI, prefixes); - String propertyRange = ((ObjectSomeRestriction) desc).getChild(0).toManchesterSyntaxString(baseURI, prefixes); - menu.add(new DescriptionMenuItem(DELETE_PROPERTY, propertyName , desc)); //2.a remove all property assertions - if (!(desc.getChild(0) instanceof Thing)){ - menu.add(new DescriptionMenuItem(REMOVE_RANGE_PROPERTY, propertyRange, desc)); //2.b remove property assertions with objects in range - } - } else if(desc instanceof ObjectAllRestriction){ //3. description is a object all restriction - if (!(desc.getChild(0) instanceof Thing)) { - JMenu dme = new JMenu("add property assertion " + ((ObjectAllRestriction) desc).getRole().toKBSyntaxString(baseURI, prefixes) //3.a add property assertion with object not in range - + " with object ..."); - for (Individual i : ore.getIndividualsNotInPropertyRange((ObjectAllRestriction) desc, ind)){ - dme.add(new DescriptionMenuItem(ADD_PROPERTY, i.toManchesterSyntaxString(baseURI, prefixes), desc)); - } - menu.add(dme); - } - } - - } else if(desc instanceof Negation){ - if(desc.getChild(0) instanceof NamedClass){ //4. description is a negated named class - DescriptionMenuItem addItem = new DescriptionMenuItem(ADD_CLASS, desc.getChild(0).toManchesterSyntaxString(baseURI, prefixes), desc.getChild(0)); - menu.add(addItem); //4.a add class assertion - Set<NamedClass> complements = ore.getComplements(desc.getChild(0), ind); //check for complement errors - if(!complements.isEmpty()){ - addItem.setEnabled(false); - StringBuffer strBuf = new StringBuffer(); - strBuf.append("<html>class assertion not possible because individual<br> " - + "is still asserted to its complements:<br><BLOCKQUOTE>"); - - for(NamedClass n: complements){ - strBuf.append("<br><b>" + n + "</b>"); - } - strBuf.append("</BLOCKQUOTE></html>"); - - - addItem.setToolTipText(strBuf.toString()); - } - } - } - } else if(mode.equals("pos")){//positive example solutions - if(!(desc instanceof Negation)){ - if(desc instanceof NamedClass){ - DescriptionMenuItem add = new DescriptionMenuItem(ADD_CLASS, desc.toManchesterSyntaxString(baseURI, prefixes), desc); - Set<NamedClass> complements = ore.getComplements(desc, ind); - if(!(complements.isEmpty())){ - add.setEnabled(false); - StringBuffer strBuf = new StringBuffer(); - strBuf.append("<html>class assertion not possible because individual<br> " - + "is still asserted to its complements:<br><BLOCKQUOTE>"); - - for(NamedClass n: complements){ - strBuf.append("<br><b>" + n + "</b>"); - } - strBuf.append("</BLOCKQUOTE></html>"); - - - add.setToolTipText(strBuf.toString()); - } - menu.add(add); - - Set<NamedClass> moveClasses = ore.getpossibleClassesMoveFrom(ind); - if(moveClasses.size() > 0){ - JMenu move = new JMenu("move to " + desc.toManchesterSyntaxString(baseURI, prefixes) + " from ..."); - for (NamedClass m : moveClasses){System.out.println("hier" + m); - DescriptionMenuItem item = new DescriptionMenuItem(MOVE_FROM_CLASS, m.toManchesterSyntaxString(baseURI, prefixes), desc); - item.setName(m.toString()); - move.add(item); - - if(!(complements.isEmpty() || (complements.size() == 1 && complements.toArray()[0].toString().equals(m.toString())))){ - move.setEnabled(false); - StringBuffer strBuf = new StringBuffer(); - strBuf.append("<html>moving class is not possible because individual<br> " - + "is still asserted to its complements:<br><BLOCKQUOTE>"); - - for(NamedClass n: complements){ - strBuf.append("<br><b>" + n + "</b>"); - } - strBuf.append("</BLOCKQUOTE></html>"); - - - move.setToolTipText(strBuf.toString()); - } - } - menu.add(move); - - } - - - } else if(desc instanceof ObjectSomeRestriction){ - JMenu dme = new JMenu("add property assertion " + ((ObjectSomeRestriction) desc).getRole() - + " with object ..."); - for (Individual i : ore.getIndividualsInPropertyRange((ObjectSomeRestriction) desc, ind)){ - dme.add(new DescriptionMenuItem(ADD_PROPERTY, i.toManchesterSyntaxString(baseURI, prefixes), desc)); - } - menu.add(dme); - - } else if(desc instanceof ObjectAllRestriction){ - if (!(desc.getChild(0) instanceof Thing)) { - menu.add(new DescriptionMenuItem(REMOVE_NOT_RANGE_PROPERTY, ((ObjectAllRestriction) desc).getChild(0).toString(baseURI, prefixes), desc)); - menu.add(new DescriptionMenuItem(DELETE_PROPERTY, ((ObjectAllRestriction) desc).getRole().toString(baseURI, prefixes), desc)); - } - } - - - } - - } else if(desc instanceof Negation){ - if(desc.getChild(0) instanceof NamedClass){ - descriptionLabel = desc.toManchesterSyntaxString(baseURI, prefixes); - menu.add(new DescriptionMenuItem(REMOVE_CLASS, descriptionLabel, desc)); - } - } - } - - - /** - * returns actual description. - * @return desc Description - */ - public Description getDescription(){ - return desc; - } - - /** - * adds action listeners to menu items. - * @param aL ActionListener - */ - public void addActionListeners(ActionListener aL){ - for(Component c : menu.getComponents()){ - if(c instanceof DescriptionMenuItem){ - ((DescriptionMenuItem) c).addActionListener(aL); - } else if(c instanceof JMenu){ - for(int i = 0; i < ((JMenu) c).getItemCount(); i++){ - ((JMenu) c).getItem(i).addActionListener(aL); - } - } - - - } - - - } - - public void setIndOre(ORE ore, Individual ind) { - this.ore = ore; - this.ind = ind; - } - - public void mouseClicked(MouseEvent e) { - menu.show(this.getParent(), getLocation().x, getLocation().y + 50); - - } - - /** - * Underlining label when mouse over. - */ - public void mouseEntered(MouseEvent e) { - setText("<html><u>" - + ((Description) desc).toManchesterSyntaxString(ore - .getBaseURI(), ore.getPrefixes()) + "</u></html>"); - setCursor(new Cursor(Cursor.HAND_CURSOR)); - if(desc instanceof ObjectCardinalityRestriction){ - setToolTipText("ObjectCardinality repair not available at present"); - } - - } - - /** - * Removing underlining when mosue relased. - */ - public void mouseExited(MouseEvent e) { - setText(((Description) desc).toManchesterSyntaxString(ore.getBaseURI(), - ore.getPrefixes())); - setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); - } - - public void mousePressed(MouseEvent e) { - // TODO Auto-generated method stub - - } - - public void mouseReleased(MouseEvent e) { - // TODO Auto-generated method stub - - } -} Deleted: trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionMenuItem.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionMenuItem.java 2009-08-04 20:02:34 UTC (rev 1817) +++ trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionMenuItem.java 2009-08-04 20:07:44 UTC (rev 1818) @@ -1,84 +0,0 @@ -/** - * Copyright (C) 2007-2008, Jens Lehmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -package org.dllearner.tools.ore; - -import javax.swing.JMenuItem; - -import org.dllearner.core.owl.Description; - -/** - * Item for possible repair action. - * @author Lorenz Buehmann - * - */ -public class DescriptionMenuItem extends JMenuItem { - - /** - * - */ - private static final long serialVersionUID = 6784086889435854440L; - - private Description desc; - private int action; - - public DescriptionMenuItem(int action, String text, Description d){ - super(); - if(action == 3){ - setText("remove class assertion to " + text); - } else if(action == 0){ - setText(text); - } else if(action == 2){ - setText("add class assertion to " + text); - } else if(action == 4){ - setText(text); - } else if(action == 6){ - setText("delete complete property " + text); - }else if(action == 5){ - setText("remove all property assertions to " + text); - } else if(action == 7){ - setText("remove all property assertions with range not in " + text); - } else if(action == 1){ - setText(text); - } - - this.desc = d; - this.action = action; - } - - /** - * Returns the description part where item is asserted to. - * @return description - */ - public Description getDescription(){ - return desc; - } - - /** - * Returns action type represented as number.. - * @return number - */ - public int getActionID(){ - return action; - } - - - -} Deleted: trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionPanel.java 2009-08-04 20:02:34 UTC (rev 1817) +++ trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionPanel.java 2009-08-04 20:07:44 UTC (rev 1818) @@ -1,136 +0,0 @@ -/** - * Copyright (C) 2007-2008, Jens Lehmann - * - * This file is part of DL-Learner. - * - * DL-Learner is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * DL-Learner is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - * - */ - -package org.dllearner.tools.ore; - -import java.awt.Color; -import java.awt.Component; -import java.awt.event.ActionListener; - -import javax.swing.BorderFactory; -import javax.swing.JLabel; -import javax.swing.JPanel; -import javax.swing.SwingUtilities; -import javax.swing.border.BevelBorder; - -import org.dllearner.core.owl.Description; -import org.dllearner.core.owl.Individual; - -/** - * Panel where learned class description is shown, and parts that might occur errors are red colored. - * @author Lorenz Buehmann - * - */ -public class DescriptionPanel extends JPanel{ - - /** - * - */ - private static final long serialVersionUID = -3684937339236885595L; - - private ORE ore; - private Individual ind; - private ActionListener aL; - private String mode; - private boolean correct = false; - private Description newClassDescription; - - public DescriptionPanel(ORE ore, Individual ind, ActionListener aL, String mode){ - super(); - setBackground(Color.WHITE); - setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); - this.ore = ore; - this.newClassDescription = ore.getNewClassDescription().getDescription(); - this.ind = ind; - this.aL = aL; - this.mode = mode; - if(mode.equals("neg")){ - for(JLabel jL : ore.descriptionToJLabelNeg(ind, newClassDescription)){ - add(jL); - if(jL instanceof DescriptionLabel){ - - ((DescriptionLabel) jL).setIndOre(ore, ind); - ((DescriptionLabel) jL).init(); - ((DescriptionLabel) jL).addActionListeners(aL); - - } - - } - } else if(mode.equals("pos")){ - for(JLabel jL : ore.descriptionToJLabelPos(ind, newClassDescription)){ - add(jL); - if(jL instanceof DescriptionLabel){ - - ((DescriptionLabel) jL).setIndOre(ore, ind); - ((DescriptionLabel) jL).init(); - ((DescriptionLabel) jL).addActionListeners(aL); - - } - - } - } - } - - /** - * Updates the panel. - */ - public void updatePanel(){ - for(Component c : getComponents()){ - if(c instanceof JLabel){ - remove(c); - } - } -// ore.updateReasoner(); - correct = true; - if (mode.equals("neg")) { - for (JLabel jL : ore.descriptionToJLabelNeg(ind, newClassDescription)) { - add(jL); - if (jL instanceof DescriptionLabel) { - ((DescriptionLabel) jL).setIndOre(ore, ind); - ((DescriptionLabel) jL).init(); - ((DescriptionLabel) jL).addActionListeners(aL); - correct = false; - - } - } - } else if(mode.equals("pos")){ - for (JLabel jL : ore.descriptionToJLabelPos(ind, newClassDescription)) { - add(jL); - if (jL instanceof DescriptionLabel) { - ((DescriptionLabel) jL).setIndOre(ore, ind); - ((DescriptionLabel) jL).init(); - ((DescriptionLabel) jL).addActionListeners(aL); - correct = false; - - } - } - } - SwingUtilities.updateComponentTreeUI(this); - - - } - /** - * Checks whether description is covered by positive example, or not covered by negative example. - * @return true if description is covered by positive example, or not covered by negative example, otherwise false is returned - */ - public boolean isCorrect(){ - return correct; - } -} \ No newline at end of file Added: trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionParseTest.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionParseTest.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionParseTest.java 2009-08-04 20:07:44 UTC (rev 1818) @@ -0,0 +1,59 @@ +package org.dllearner.tools.ore; + +import java.io.StringWriter; +import java.net.URI; +import java.util.Collections; +import java.util.Set; + +import org.coode.manchesterowlsyntax.ManchesterOWLSyntaxClassFrameParser; +import org.semanticweb.owl.apibinding.OWLManager; +import org.semanticweb.owl.expression.ParserException; +import org.semanticweb.owl.expression.ShortFormEntityChecker; +import org.semanticweb.owl.model.OWLAxiom; +import org.semanticweb.owl.model.OWLClass; +import org.semanticweb.owl.model.OWLDataFactory; +import org.semanticweb.owl.model.OWLOntology; +import org.semanticweb.owl.model.OWLOntologyChangeException; +import org.semanticweb.owl.model.OWLOntologyCreationException; +import org.semanticweb.owl.model.OWLOntologyManager; +import org.semanticweb.owl.util.BidirectionalShortFormProviderAdapter; +import org.semanticweb.owl.util.SimpleShortFormProvider; + +import com.clarkparsia.explanation.io.manchester.BlockWriter; +import com.clarkparsia.explanation.io.manchester.ManchesterSyntaxObjectRenderer; +import com.clarkparsia.explanation.io.manchester.TextBlockWriter; + +public class DescriptionParseTest { + + public static void main(String[] args) throws OWLOntologyChangeException, OWLOntologyCreationException, ParserException { + + System.out.println(System.getProperty("os.name")); + System.out.println(System.getProperty("os.version")); + System.out.println(System.getProperty("os.arch")); + + OWLOntologyManager manager = OWLManager.createOWLOntologyManager(); + OWLDataFactory factory = manager.getOWLDataFactory(); + + OWLClass class1 = factory.getOWLClass(URI.create("Class1")); + OWLClass class2 = factory.getOWLClass(URI.create("Class2")); + OWLAxiom axiom = factory.getOWLSubClassAxiom(class1, class2); + OWLOntology ontology = manager.createOntology(Collections.singleton(axiom)); + + //rendering + StringWriter buffer = new StringWriter(); + BlockWriter writer = new TextBlockWriter(buffer); + ManchesterSyntaxObjectRenderer renderer = new ManchesterSyntaxObjectRenderer(writer); + axiom.accept(renderer); + String manSyntaxString = buffer.toString(); + System.out.println(manSyntaxString); + + //parsing + ManchesterOWLSyntaxClassFrameParser parser = new ManchesterOWLSyntaxClassFrameParser( + manager.getOWLDataFactory(), new ShortFormEntityChecker( + new BidirectionalShortFormProviderAdapter(manager, Collections + .singleton(ontology), new SimpleShortFormProvider()))); + Set<OWLAxiom> axioms = parser.parse(manSyntaxString); + + System.out.println(axioms); + } +} Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationManager.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationManager.java 2009-08-04 20:02:34 UTC (rev 1817) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationManager.java 2009-08-04 20:07:44 UTC (rev 1818) @@ -1,7 +1,6 @@ package org.dllearner.tools.ore; import java.util.ArrayList; -import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -9,8 +8,8 @@ import java.util.Set; import org.dllearner.tools.ore.explanation.ExplanationException; -import org.dllearner.tools.ore.explanation.LaconicExplanationGenerator; import org.dllearner.tools.ore.explanation.RootFinder; +import org.dllearner.tools.ore.explanation.laconic.LaconicExplanationGenerator; import org.mindswap.pellet.owlapi.PelletReasonerFactory; import org.mindswap.pellet.owlapi.Reasoner; import org.semanticweb.owl.model.OWLAxiom; @@ -29,7 +28,7 @@ import com.clarkparsia.explanation.PelletExplanation; -public class ExplanationManager implements OWLOntologyChangeListener, ImpactManagerListener{ +public class ExplanationManager implements OWLOntologyChangeListener, RepairManagerListener{ private static ExplanationManager instance; @@ -61,7 +60,7 @@ manager.addOntologyChangeListener(this); // manager.addOntologyChangeListener(reasoner); dataFactory = manager.getOWLDataFactory(); - ImpactManager.getImpactManager(reasoner).addListener(this); + RepairManager.getRepairManager(reasoner).addListener(this); reasonerFactory = new PelletReasonerFactory(); rootFinder = new RootFinder(manager, reasoner, reasonerFactory); @@ -270,11 +269,6 @@ } - @Override - public void axiomForImpactChanged() { - // TODO Auto-generated method stub - - } @Override public void repairPlanExecuted() { @@ -286,6 +280,12 @@ regularExplanationCache.clear(); laconicExplanationCache.clear(); } + + @Override + public void repairPlanChanged() { + // TODO Auto-generated method stub + + } } Modified: trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationPanel.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationPanel.java 2009-08-04 20:02:34 UTC (rev 1817) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationPanel.java 2009-08-04 20:07:44 UTC (rev 1818) @@ -30,6 +30,12 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; +import org.dllearner.tools.ore.ui.ClassificationProgressMonitor; +import org.dllearner.tools.ore.ui.ExplanationTable; +import org.dllearner.tools.ore.ui.ImpactTable; +import org.dllearner.tools.ore.ui.UnsatClassesListCellRenderer; +import org.dllearner.tools.ore.ui.wizard.panels.ExplanationTablePanel; +import org.dllearner.tools.ore.ui.wizard.panels.RepairPlanPanel; import org.jdesktop.swingx.JXList; import org.mindswap.pellet.PelletOptions; import org.mindswap.pellet.owlapi.PelletReasonerFactory; @@ -61,7 +67,7 @@ private ExplanationManager expManager; private ImpactManager impManager; - + private RepairManager repManager; private OWLClass unsatClass; @@ -70,11 +76,12 @@ */ private static final long serialVersionUID = 2213073383532597460L; - public ExplanationPanel(ExplanationManager expMan, ImpactManager impMan) { + public ExplanationPanel(ExplanationManager expMan, ImpactManager impMan, RepairManager repMan) { this.expManager = expMan; this.impManager = impMan; + this.repManager = repMan; impManager.addListener(this); setLayout(new BorderLayout()); @@ -141,7 +148,7 @@ impactPanel.add(impScr); impRepSplit.setRightComponent(impactPanel); - RepairPlanPanel repairPanel = new RepairPlanPanel(impManager); + RepairPlanPanel repairPanel = new RepairPlanPanel(repManager); impRepSplit.setLeftComponent(repairPanel); @@ -185,7 +192,7 @@ // t.add(r.render(ax)); // model.addColumn("axiom", t); - ExplanationTable expTable = new ExplanationTable(explanation, impManager, expManager, unsatClass); + ExplanationTable expTable = new ExplanationTable(explanation, repManager, impManager, expManager, unsatClass); explanationsPanel.add(new ExplanationTablePanel(expTable, number)); } @@ -340,8 +347,9 @@ .getExplanationManager(reasoner); Impact... [truncated message content] |
From: <lor...@us...> - 2009-08-04 20:02:49
|
Revision: 1817 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1817&view=rev Author: lorenz_b Date: 2009-08-04 20:02:34 +0000 (Tue, 04 Aug 2009) Log Message: ----------- refactored package structure, since developing and maintaining became to ineffective Added Paths: ----------- trunk/src/dl-learner/org/dllearner/tools/ore/ui/ trunk/src/dl-learner/org/dllearner/tools/ore/ui/ClassificationProgressMonitor.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/ColorListCellRenderer.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/ColumnListCellRenderer.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/DescriptionLabel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/DescriptionMenuItem.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExplanationTable.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExplanationTableModel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/ImpactTable.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/ImpactTableModel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/OWLSyntaxTableCellRenderer.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/RepairDialog.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/RepairTable.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/RepairTableModel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/UndoLabel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/UnsatClassesListCellRenderer.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/ trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/Wizard.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/WizardController.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/WizardModel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/WizardPanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/WizardPanelNotFoundException.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/ trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/ClassPanelOWLDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/ClassPanelSparqlDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/InconsistencyExplanationPanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/IntroductionPanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/KnowledgeSourcePanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/LearningPanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/RepairPanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/SavePanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/descriptors/UnsatisfiableExplanationPanelDescriptor.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/ trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/ChangePanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/ChangesPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/ClassPanelOWL.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/ClassPanelSparql.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/DescriptionPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/ExplanationTablePanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/InconsistencyExplanationPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/IntroductionPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/KnowledgeSourcePanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/LearningPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/LeftPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/RepairPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/RepairPlanPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/SavePanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/StatsPanel.java trunk/src/dl-learner/org/dllearner/tools/ore/ui/wizard/panels/UnsatisfiableExplanationPanel.java Copied: trunk/src/dl-learner/org/dllearner/tools/ore/ui/ClassificationProgressMonitor.java (from rev 1816, trunk/src/dl-learner/org/dllearner/tools/ore/ClassificationProgressMonitor.java) =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ui/ClassificationProgressMonitor.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/ClassificationProgressMonitor.java 2009-08-04 20:02:34 UTC (rev 1817) @@ -0,0 +1,117 @@ +package org.dllearner.tools.ore.ui; + +import java.awt.Cursor; +import java.awt.Dimension; + +import javax.swing.JPanel; +import javax.swing.JProgressBar; +import javax.swing.SwingUtilities; + +import org.mindswap.pellet.utils.progress.ProgressMonitor; + +public class ClassificationProgressMonitor extends JPanel implements ProgressMonitor{ + + /** + * + */ + private static final long serialVersionUID = -4913267621100462227L; + private javax.swing.ProgressMonitor monitor; + private JProgressBar progressBar; + private String progressMessage = ""; + private String progressTitle = ""; + private int progress = 0; + private int progressLength = 0; + private int progressPercent = -1; + private long startTime = -1; + private boolean canceled = false; + + + public ClassificationProgressMonitor(){ + super(); + monitor = new javax.swing.ProgressMonitor(this, progressTitle, progressMessage, 0 ,progressLength); + progressBar = new JProgressBar(0, progressLength); + progressBar.setValue(progress); + progressBar.setStringPainted(true); + add(progressBar); + setSize(new Dimension(200, 200)); + + } + + @Override + public int getProgress() { + return progress; + } + + @Override + public int getProgressPercent() { + return progressPercent; + } + + @Override + public void incrementProgress() { + setProgress(progress + 1); + + } + + @Override + public boolean isCanceled() { + return monitor.isCanceled(); + } + + @Override + public void setProgress(int progress) { + this.progress = progress; + updateProgress(); + + } + + @Override + public void setProgressLength(int length) { + progressLength = length; + monitor.setMaximum(length); + progressBar.setMaximum(length); + + } + + @Override + public void setProgressMessage(String message) { + progressMessage = message; + monitor.setNote(message); + + } + + @Override + public void setProgressTitle(String title) { + progressTitle = title; + + } + + @Override + public void taskFinished() { + monitor.close(); + setCursor(null); + + } + + @Override + public void taskStarted() { + setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); + + } + + private void updateProgress(){ + SwingUtilities.invokeLater(new Runnable(){ + + @Override + public void run() { + monitor.setProgress(progress); + progressBar.setValue(progress); + + } + + }); + } + + + +} Copied: trunk/src/dl-learner/org/dllearner/tools/ore/ui/ColorListCellRenderer.java (from rev 1816, trunk/src/dl-learner/org/dllearner/tools/ore/ColorListCellRenderer.java) =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ui/ColorListCellRenderer.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/ColorListCellRenderer.java 2009-08-04 20:02:34 UTC (rev 1817) @@ -0,0 +1,79 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +package org.dllearner.tools.ore.ui; + +import java.awt.Color; +import java.awt.Component; + +import javax.swing.JLabel; +import javax.swing.JList; +import javax.swing.ListCellRenderer; + +import org.dllearner.core.owl.Individual; +import org.dllearner.core.owl.NamedClass; +import org.dllearner.tools.ore.ORE; + +/** + * List cell renderer for colored lines to provide better view on list values. + * @author Lorenz Buehmann + * + */ +public class ColorListCellRenderer extends JLabel implements ListCellRenderer { + + private static final long serialVersionUID = -7592805113197759247L; + private ORE ore; + + public ColorListCellRenderer(ORE ore) { + setOpaque(true); + this.ore = ore; + } + + public Component getListCellRendererComponent(JList list, Object value, + int index, boolean isSelected, boolean cellHasFocus) { + + if(value instanceof NamedClass){ + setText(((NamedClass) value).toManchesterSyntaxString(ore.getBaseURI(), ore.getPrefixes())); + } else if(value instanceof Individual){ + setText(((Individual) value).toManchesterSyntaxString(ore.getBaseURI(), ore.getPrefixes())); + } + Color background; + Color foreground; + + if (index % 2 == 0 && !isSelected) { + background = new Color(242, 242, 242); + foreground = Color.BLACK; + + } else if(isSelected){ + + background = Color.LIGHT_GRAY; + foreground = Color.BLACK; + }else{ + background = Color.WHITE; + foreground = Color.BLACK; + } + + setForeground(foreground); + setBackground(background); + + return this; + } + +} Copied: trunk/src/dl-learner/org/dllearner/tools/ore/ui/ColumnListCellRenderer.java (from rev 1816, trunk/src/dl-learner/org/dllearner/tools/ore/ColumnListCellRenderer.java) =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ui/ColumnListCellRenderer.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/ColumnListCellRenderer.java 2009-08-04 20:02:34 UTC (rev 1817) @@ -0,0 +1,94 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +package org.dllearner.tools.ore.ui; + +import java.awt.Color; +import java.awt.Component; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Insets; +import java.math.BigDecimal; + +import javax.swing.JLabel; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.ListCellRenderer; + +import org.dllearner.learningproblems.EvaluatedDescriptionClass; +import org.dllearner.tools.ore.ORE; + +/** + * List cell renderer for 2 columns. + * @author Lorenz Buehmann + * + */ +public class ColumnListCellRenderer extends JPanel implements ListCellRenderer { + + private static final long serialVersionUID = 3024913291199515567L; + private ORE ore; + + + public ColumnListCellRenderer(ORE ore) { + this.ore = ore; + setOpaque(true); + } + + public Component getListCellRendererComponent(JList list, Object value, + int index, boolean isSelected, boolean cellHasFocus) { + + removeAll(); + + JLabel cor = new JLabel(); + JLabel desc = new JLabel(); + setLayout(new GridBagLayout()); + desc.setText(((EvaluatedDescriptionClass) value).getDescription().toManchesterSyntaxString(ore.getBaseURI(), ore.getPrefixes())); + //round accuracy to 2 digits + double accuracy = ((EvaluatedDescriptionClass) value).getAccuracy(); + + BigDecimal roundedAccuracy = new BigDecimal(accuracy * 100); + roundedAccuracy = roundedAccuracy.setScale(2, BigDecimal.ROUND_HALF_UP); + cor.setText(String.valueOf(roundedAccuracy)); + add(cor, new GridBagConstraints(0, 0, 1, 1, 0.1, 0.0, GridBagConstraints.LINE_END, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));//, BorderLayout.WEST); + add(desc, new GridBagConstraints(1, 0, 1, 1, 0.8, 0.0, GridBagConstraints.LINE_START, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));//, BorderLayout.EAST); + + Color background; + Color foreground; + + if (index % 2 == 0 && !isSelected) { + background = new Color(242, 242, 242); + foreground = Color.BLACK; + + } else if(isSelected){ + + background = Color.LIGHT_GRAY; + foreground = Color.WHITE; + }else{ + background = Color.WHITE; + foreground = Color.BLACK; + } + + setForeground(foreground); + setBackground(background); + + return this; + } + +} \ No newline at end of file Copied: trunk/src/dl-learner/org/dllearner/tools/ore/ui/DescriptionLabel.java (from rev 1816, trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionLabel.java) =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ui/DescriptionLabel.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/DescriptionLabel.java 2009-08-04 20:02:34 UTC (rev 1817) @@ -0,0 +1,316 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +package org.dllearner.tools.ore.ui; + +import java.awt.Color; +import java.awt.Component; +import java.awt.Cursor; +import java.awt.event.ActionListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.util.Map; +import java.util.Set; + +import javax.swing.JLabel; +import javax.swing.JMenu; +import javax.swing.JPopupMenu; +import javax.swing.ToolTipManager; + +import org.dllearner.core.owl.Description; +import org.dllearner.core.owl.Individual; +import org.dllearner.core.owl.NamedClass; +import org.dllearner.core.owl.Negation; +import org.dllearner.core.owl.ObjectAllRestriction; +import org.dllearner.core.owl.ObjectCardinalityRestriction; +import org.dllearner.core.owl.ObjectSomeRestriction; +import org.dllearner.core.owl.Thing; +import org.dllearner.tools.ore.ORE; + +/** + * Label that might have menu items when clicked on it. + * @author Lorenz Buehmann + * + */ +public class DescriptionLabel extends JLabel implements MouseListener{ + /** + * + */ + private static final long serialVersionUID = 1L; + + private static final int MOVE_TO_CLASS = 0; + private static final int MOVE_FROM_CLASS = 1; + private static final int ADD_CLASS = 2; + private static final int REMOVE_CLASS = 3; + private static final int ADD_PROPERTY = 4; + private static final int REMOVE_RANGE_PROPERTY = 5; + private static final int DELETE_PROPERTY = 6; + private static final int REMOVE_NOT_RANGE_PROPERTY = 7; + + private final Description desc; + private Individual ind; + private ORE ore; + private JPopupMenu menu; + private String mode; + private String descriptionLabel; + + private String baseURI; + private Map<String, String> prefixes; + + /** + * constructor. + * + * @param d + * @param mode + */ + public DescriptionLabel(Description d, String mode) { + super(); + this.desc = d; + this.mode = mode; + setForeground(Color.red); + addMouseListener(this); + + } + + /** + * initialize description label with solution. + */ + public void init(){ + baseURI = ore.getBaseURI(); + prefixes = ore.getPrefixes(); + + setText(((Description) desc).toManchesterSyntaxString(ore.getBaseURI(), ore.getPrefixes())); + menu = new JPopupMenu(); + ToolTipManager.sharedInstance().setDismissDelay(7000); + //negative example solutions + if(mode.equals("neg")){ + if(!(desc instanceof Negation)){ + if(desc instanceof NamedClass){ //1. description is a named class + descriptionLabel = desc.toManchesterSyntaxString(baseURI, prefixes); + menu.add(new DescriptionMenuItem(REMOVE_CLASS, descriptionLabel, desc)); //1.a remove class assertion + + JMenu dme = new JMenu("move class assertion " + descriptionLabel + " to ..."); //1.b move individual + for(NamedClass nc : ore.getpossibleClassesMoveTo(ind)){ + DescriptionMenuItem move = new DescriptionMenuItem(MOVE_TO_CLASS, nc.toManchesterSyntaxString(baseURI, prefixes), (NamedClass) desc); + move.setName(nc.toString()); + dme.add(move); + Set<NamedClass> complements = ore.getComplements(nc, ind); //check for complement error + if(!(complements.isEmpty() || (complements.size() == 1 && complements.toArray()[0].toString().equals(desc.toString())))){ + move.setEnabled(false); + StringBuffer strBuf = new StringBuffer(); + strBuf.append("<html>class assertion not possible because individual<br> " + + "is still asserted to its complements:<br><BLOCKQUOTE>"); + + for(NamedClass n: complements){ + strBuf.append("<br><b>" + n + "</b>"); + } + strBuf.append("</BLOCKQUOTE></html>"); + + + move.setToolTipText(strBuf.toString()); + } + } + menu.add(dme); + } else if(desc instanceof ObjectSomeRestriction){ //2. description is a object some restriction + String propertyName = ((ObjectSomeRestriction) desc).getRole().toString(baseURI, prefixes); + String propertyRange = ((ObjectSomeRestriction) desc).getChild(0).toManchesterSyntaxString(baseURI, prefixes); + menu.add(new DescriptionMenuItem(DELETE_PROPERTY, propertyName , desc)); //2.a remove all property assertions + if (!(desc.getChild(0) instanceof Thing)){ + menu.add(new DescriptionMenuItem(REMOVE_RANGE_PROPERTY, propertyRange, desc)); //2.b remove property assertions with objects in range + } + } else if(desc instanceof ObjectAllRestriction){ //3. description is a object all restriction + if (!(desc.getChild(0) instanceof Thing)) { + JMenu dme = new JMenu("add property assertion " + ((ObjectAllRestriction) desc).getRole().toKBSyntaxString(baseURI, prefixes) //3.a add property assertion with object not in range + + " with object ..."); + for (Individual i : ore.getIndividualsNotInPropertyRange((ObjectAllRestriction) desc, ind)){ + dme.add(new DescriptionMenuItem(ADD_PROPERTY, i.toManchesterSyntaxString(baseURI, prefixes), desc)); + } + menu.add(dme); + } + } + + } else if(desc instanceof Negation){ + if(desc.getChild(0) instanceof NamedClass){ //4. description is a negated named class + DescriptionMenuItem addItem = new DescriptionMenuItem(ADD_CLASS, desc.getChild(0).toManchesterSyntaxString(baseURI, prefixes), desc.getChild(0)); + menu.add(addItem); //4.a add class assertion + Set<NamedClass> complements = ore.getComplements(desc.getChild(0), ind); //check for complement errors + if(!complements.isEmpty()){ + addItem.setEnabled(false); + StringBuffer strBuf = new StringBuffer(); + strBuf.append("<html>class assertion not possible because individual<br> " + + "is still asserted to its complements:<br><BLOCKQUOTE>"); + + for(NamedClass n: complements){ + strBuf.append("<br><b>" + n + "</b>"); + } + strBuf.append("</BLOCKQUOTE></html>"); + + + addItem.setToolTipText(strBuf.toString()); + } + } + } + } else if(mode.equals("pos")){//positive example solutions + if(!(desc instanceof Negation)){ + if(desc instanceof NamedClass){ + DescriptionMenuItem add = new DescriptionMenuItem(ADD_CLASS, desc.toManchesterSyntaxString(baseURI, prefixes), desc); + Set<NamedClass> complements = ore.getComplements(desc, ind); + if(!(complements.isEmpty())){ + add.setEnabled(false); + StringBuffer strBuf = new StringBuffer(); + strBuf.append("<html>class assertion not possible because individual<br> " + + "is still asserted to its complements:<br><BLOCKQUOTE>"); + + for(NamedClass n: complements){ + strBuf.append("<br><b>" + n + "</b>"); + } + strBuf.append("</BLOCKQUOTE></html>"); + + + add.setToolTipText(strBuf.toString()); + } + menu.add(add); + + Set<NamedClass> moveClasses = ore.getpossibleClassesMoveFrom(ind); + if(moveClasses.size() > 0){ + JMenu move = new JMenu("move to " + desc.toManchesterSyntaxString(baseURI, prefixes) + " from ..."); + for (NamedClass m : moveClasses){System.out.println("hier" + m); + DescriptionMenuItem item = new DescriptionMenuItem(MOVE_FROM_CLASS, m.toManchesterSyntaxString(baseURI, prefixes), desc); + item.setName(m.toString()); + move.add(item); + + if(!(complements.isEmpty() || (complements.size() == 1 && complements.toArray()[0].toString().equals(m.toString())))){ + move.setEnabled(false); + StringBuffer strBuf = new StringBuffer(); + strBuf.append("<html>moving class is not possible because individual<br> " + + "is still asserted to its complements:<br><BLOCKQUOTE>"); + + for(NamedClass n: complements){ + strBuf.append("<br><b>" + n + "</b>"); + } + strBuf.append("</BLOCKQUOTE></html>"); + + + move.setToolTipText(strBuf.toString()); + } + } + menu.add(move); + + } + + + } else if(desc instanceof ObjectSomeRestriction){ + JMenu dme = new JMenu("add property assertion " + ((ObjectSomeRestriction) desc).getRole() + + " with object ..."); + for (Individual i : ore.getIndividualsInPropertyRange((ObjectSomeRestriction) desc, ind)){ + dme.add(new DescriptionMenuItem(ADD_PROPERTY, i.toManchesterSyntaxString(baseURI, prefixes), desc)); + } + menu.add(dme); + + } else if(desc instanceof ObjectAllRestriction){ + if (!(desc.getChild(0) instanceof Thing)) { + menu.add(new DescriptionMenuItem(REMOVE_NOT_RANGE_PROPERTY, ((ObjectAllRestriction) desc).getChild(0).toString(baseURI, prefixes), desc)); + menu.add(new DescriptionMenuItem(DELETE_PROPERTY, ((ObjectAllRestriction) desc).getRole().toString(baseURI, prefixes), desc)); + } + } + + + } + + } else if(desc instanceof Negation){ + if(desc.getChild(0) instanceof NamedClass){ + descriptionLabel = desc.toManchesterSyntaxString(baseURI, prefixes); + menu.add(new DescriptionMenuItem(REMOVE_CLASS, descriptionLabel, desc)); + } + } + } + + + /** + * returns actual description. + * @return desc Description + */ + public Description getDescription(){ + return desc; + } + + /** + * adds action listeners to menu items. + * @param aL ActionListener + */ + public void addActionListeners(ActionListener aL){ + for(Component c : menu.getComponents()){ + if(c instanceof DescriptionMenuItem){ + ((DescriptionMenuItem) c).addActionListener(aL); + } else if(c instanceof JMenu){ + for(int i = 0; i < ((JMenu) c).getItemCount(); i++){ + ((JMenu) c).getItem(i).addActionListener(aL); + } + } + + + } + + + } + + public void setIndOre(ORE ore, Individual ind) { + this.ore = ore; + this.ind = ind; + } + + public void mouseClicked(MouseEvent e) { + menu.show(this.getParent(), getLocation().x, getLocation().y + 50); + + } + + /** + * Underlining label when mouse over. + */ + public void mouseEntered(MouseEvent e) { + setText("<html><u>" + + ((Description) desc).toManchesterSyntaxString(ore + .getBaseURI(), ore.getPrefixes()) + "</u></html>"); + setCursor(new Cursor(Cursor.HAND_CURSOR)); + if(desc instanceof ObjectCardinalityRestriction){ + setToolTipText("ObjectCardinality repair not available at present"); + } + + } + + /** + * Removing underlining when mosue relased. + */ + public void mouseExited(MouseEvent e) { + setText(((Description) desc).toManchesterSyntaxString(ore.getBaseURI(), + ore.getPrefixes())); + setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); + } + + public void mousePressed(MouseEvent e) { + // TODO Auto-generated method stub + + } + + public void mouseReleased(MouseEvent e) { + // TODO Auto-generated method stub + + } +} Copied: trunk/src/dl-learner/org/dllearner/tools/ore/ui/DescriptionMenuItem.java (from rev 1816, trunk/src/dl-learner/org/dllearner/tools/ore/DescriptionMenuItem.java) =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ui/DescriptionMenuItem.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/DescriptionMenuItem.java 2009-08-04 20:02:34 UTC (rev 1817) @@ -0,0 +1,84 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +package org.dllearner.tools.ore.ui; + +import javax.swing.JMenuItem; + +import org.dllearner.core.owl.Description; + +/** + * Item for possible repair action. + * @author Lorenz Buehmann + * + */ +public class DescriptionMenuItem extends JMenuItem { + + /** + * + */ + private static final long serialVersionUID = 6784086889435854440L; + + private Description desc; + private int action; + + public DescriptionMenuItem(int action, String text, Description d){ + super(); + if(action == 3){ + setText("remove class assertion to " + text); + } else if(action == 0){ + setText(text); + } else if(action == 2){ + setText("add class assertion to " + text); + } else if(action == 4){ + setText(text); + } else if(action == 6){ + setText("delete complete property " + text); + }else if(action == 5){ + setText("remove all property assertions to " + text); + } else if(action == 7){ + setText("remove all property assertions with range not in " + text); + } else if(action == 1){ + setText(text); + } + + this.desc = d; + this.action = action; + } + + /** + * Returns the description part where item is asserted to. + * @return description + */ + public Description getDescription(){ + return desc; + } + + /** + * Returns action type represented as number.. + * @return number + */ + public int getActionID(){ + return action; + } + + + +} Copied: trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExplanationTable.java (from rev 1816, trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationTable.java) =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExplanationTable.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExplanationTable.java 2009-08-04 20:02:34 UTC (rev 1817) @@ -0,0 +1,215 @@ +package org.dllearner.tools.ore.ui; + +import java.awt.Color; +import java.awt.Component; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.util.List; + +import javax.swing.AbstractCellEditor; +import javax.swing.JButton; +import javax.swing.JTable; +import javax.swing.UIManager; +import javax.swing.event.ListSelectionEvent; +import javax.swing.event.ListSelectionListener; +import javax.swing.table.TableCellEditor; +import javax.swing.table.TableCellRenderer; +import javax.swing.table.TableColumn; + +import org.dllearner.tools.ore.ExplanationManager; +import org.dllearner.tools.ore.ImpactManager; +import org.dllearner.tools.ore.RepairManager; +import org.dllearner.tools.ore.RepairManagerListener; +import org.jdesktop.swingx.JXTable; +import org.semanticweb.owl.model.OWLAxiom; +import org.semanticweb.owl.model.OWLClass; + +public class ExplanationTable extends JXTable implements RepairManagerListener{ + + /** + * + */ + private static final long serialVersionUID = 5580730282611559609L; + + private List<OWLAxiom> explanation; + private RepairManager repMan; + private ImpactManager impMan; + + public ExplanationTable(List<OWLAxiom> explanation, RepairManager repMan,ImpactManager impMan, ExplanationManager expMan, OWLClass cl) { + this.explanation = explanation; + this.repMan = repMan; + this.impMan = impMan; + repMan.addListener(this); + setBackground(Color.WHITE); + setAutoResizeMode(JTable.AUTO_RESIZE_OFF); + setModel(new ExplanationTableModel(explanation, expMan,impMan, repMan, cl)); + getColumn(0).setCellRenderer(new OWLSyntaxTableCellRenderer(repMan)); + TableColumn column4 = getColumn(3); + column4.setCellRenderer(new ButtonCellRenderer()); + column4.setCellEditor(new ButtonCellEditor()); + column4.setResizable(false); + setColumnSizes(); + getSelectionModel().addListSelectionListener(new ListSelectionListener(){ + + + final ExplanationTable table; + + @Override + public void valueChanged(ListSelectionEvent e) { + + table.changeSelection(); + + } + { + table = ExplanationTable.this; + + } + + }); + + addFocusListener(new FocusListener() { + + final ExplanationTable table; + + public void focusGained(FocusEvent focusevent) + { + } + + public void focusLost(FocusEvent e) + { + table.clearSelection(); + table.changeSelection(); + + } + + + + + { + + table = ExplanationTable.this; + + } + }); + + addMouseListener(new MouseAdapter() { + + final ExplanationTable table; + { + table = ExplanationTable.this; + } + public void mouseClicked(MouseEvent e){ + if(e.getClickCount() == 2){ + System.out.println(getValueAt(table.rowAtPoint(e.getPoint()), 0)); + } + } + }); + } + + private OWLAxiom getOWLAxiomAtRow(int rowIndex){ + return ((ExplanationTableModel)getModel()).getOWLAxiomAtRow(rowIndex); + } + + private void setColumnSizes(){ + getColumn(1).setMaxWidth(30); + getColumn(2).setMaxWidth(30); + getColumn(3).setMaxWidth(80); + } + + private void changeSelection() { + +// +// if(getSelectedRow() >=0){ +// OWLAxiom rowAxiom = getOWLAxiomAtRow(getSelectedRow()); +// impMan.setActualAxiom(rowAxiom); +// } else { +// impMan.setActualAxiom(null); +// } + + } + + class ButtonCellRenderer extends JButton implements TableCellRenderer{ + + /** + * + */ + private static final long serialVersionUID = 1962950956976967243L; + + + @Override + public Component getTableCellRendererComponent(JTable table, Object value, + boolean isSelected, boolean hasFocus, int row, int column) { + if (isSelected) { + setForeground(table.getSelectionForeground()); + setBackground(table.getSelectionBackground()); + } else { + setForeground(table.getForeground()); + setBackground(UIManager.getColor("Button.background")); + } + setText( (value ==null) ? "" : value.toString() ); + return this; + } + + + } + + class ButtonCellEditor extends AbstractCellEditor implements + TableCellEditor, ActionListener { + /** + * + */ + private static final long serialVersionUID = 9017452102605141646L; + JTable table; + JButton editButton; + String text; + + + public ButtonCellEditor() { + super(); + + editButton = new JButton(); + editButton.setFocusPainted(false); + editButton.addActionListener(this); + } + + + @Override + public Component getTableCellEditorComponent(JTable table, + Object value, boolean isSelected, int row, int column) { + text = (value == null) ? "" : value.toString(); + editButton.setText(text); + return editButton; + } + + @Override + public Object getCellEditorValue() { + return text; + } + + @Override + public void actionPerformed(ActionEvent e) { + fireEditingStopped(); + } + } + + + @Override + public void repairPlanExecuted() { + // TODO Auto-generated method stub + + } + + @Override + public void repairPlanChanged() { + repaint(); + + } + + + + +} Copied: trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExplanationTableModel.java (from rev 1816, trunk/src/dl-learner/org/dllearner/tools/ore/ExplanationTableModel.java) =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExplanationTableModel.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/ExplanationTableModel.java 2009-08-04 20:02:34 UTC (rev 1817) @@ -0,0 +1,106 @@ +package org.dllearner.tools.ore.ui; + +import java.util.ArrayList; +import java.util.List; + +import javax.swing.table.AbstractTableModel; + +import org.dllearner.tools.ore.ExplanationManager; +import org.dllearner.tools.ore.ImpactManager; +import org.dllearner.tools.ore.RepairManager; +import org.semanticweb.owl.model.OWLAxiom; +import org.semanticweb.owl.model.OWLClass; + +public class ExplanationTableModel extends AbstractTableModel { + + + /** + * + */ + private static final long serialVersionUID = -4537633628250304813L; + private List<OWLAxiom> axioms; + private List<Boolean> remove; + private ExplanationManager expMan; + private ImpactManager impMan; + private RepairManager repMan; + private OWLClass unsat; + + public ExplanationTableModel(List<OWLAxiom> axioms, ExplanationManager expMan, ImpactManager impMan, RepairManager repMan, OWLClass cl){ + this.axioms = axioms; + this.expMan = expMan; + this.impMan = impMan; + this.repMan = repMan; + this.unsat = cl; + remove = new ArrayList<Boolean>(); + for(int i = 0; i < axioms.size(); i++){ + remove.add(false); + } + } + + @Override + public int getColumnCount() { + return 4; + } + + @Override + public int getRowCount() { + return axioms.size(); + } + + @Override + public Object getValueAt(int rowIndex, int columnIndex) { + if(columnIndex == 0 && rowIndex >=0){ + return axioms.get(rowIndex); + } else if(columnIndex == 1){ + return expMan.getArity(unsat, axioms.get(rowIndex)); + } else if(columnIndex == 2) { + return Boolean.valueOf(impMan.isSelected(getOWLAxiomAtRow(rowIndex))); + } else { + return "rewrite"; + } + + } + + + @Override + public void setValueAt(Object value, int rowIndex, int columnIndex) { + if(columnIndex == 2){ + OWLAxiom ax = getOWLAxiomAtRow(rowIndex); + if(impMan.isSelected(ax)){ + repMan.removeAxiom2Remove(ax); + impMan.removeAxiomFromImpactList(ax); + } else { + impMan.addAxiom2ImpactList(ax); + repMan.addAxiom2Remove(ax); + } + } + super.setValueAt(value, rowIndex, columnIndex); + } + + @Override + public Class<? extends Object> getColumnClass(int columnIndex){ + if(columnIndex == 0) { + return OWLAxiom.class; + } else if(columnIndex == 1){ + return int.class; + } else if(columnIndex == 2) { + return Boolean.class; + } else { + return String.class; + } + } + + @Override + public boolean isCellEditable(int rowIndex, int columnIndex) { + if(columnIndex == 2 || columnIndex == 3) + return true; + return false; + } + + public OWLAxiom getOWLAxiomAtRow(int rowIndex){ + return axioms.get(rowIndex); + } + + + +} Copied: trunk/src/dl-learner/org/dllearner/tools/ore/ui/ImpactTable.java (from rev 1816, trunk/src/dl-learner/org/dllearner/tools/ore/ImpactTable.java) =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ui/ImpactTable.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/ImpactTable.java 2009-08-04 20:02:34 UTC (rev 1817) @@ -0,0 +1,28 @@ +package org.dllearner.tools.ore.ui; + +import java.awt.Color; + +import org.dllearner.tools.ore.ImpactManager; +import org.jdesktop.swingx.JXTable; + +public class ImpactTable extends JXTable { + + /** + * + */ + private static final long serialVersionUID = 4146762679753151490L; + + public ImpactTable(ImpactManager manager){ + super(new ImpactTableModel(manager)); + + setShowHorizontalLines(true); + setGridColor(Color.LIGHT_GRAY); + setTableHeader(null); + getColumnModel().getColumn(0).setCellRenderer(new OWLSyntaxTableCellRenderer()); + setRowHeight(getRowHeight() + 4); + + } + + + +} Copied: trunk/src/dl-learner/org/dllearner/tools/ore/ui/ImpactTableModel.java (from rev 1816, trunk/src/dl-learner/org/dllearner/tools/ore/ImpactTableModel.java) =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ui/ImpactTableModel.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/ImpactTableModel.java 2009-08-04 20:02:34 UTC (rev 1817) @@ -0,0 +1,71 @@ +package org.dllearner.tools.ore.ui; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import javax.swing.table.AbstractTableModel; + +import org.dllearner.tools.ore.ImpactManager; +import org.dllearner.tools.ore.ImpactManagerListener; +import org.semanticweb.owl.model.OWLAxiom; + +public class ImpactTableModel extends AbstractTableModel implements ImpactManagerListener +{ + + /** + * + */ + private static final long serialVersionUID = 6109818990550020196L; + private ImpactManager impMan; + private List<OWLAxiom> impact; + + public ImpactTableModel(ImpactManager impMan) + { + + impact = new ArrayList<OWLAxiom>(); + this.impMan = impMan; + impMan.addListener(this); + rebuildData(); + } + + private void rebuildData() + { + impact.clear(); + impact.addAll(impMan.getImpactForAxioms2Remove()); + Collections.sort(impact); + fireTableDataChanged(); + } + + + + public int getRowCount() + { + return impact.size(); + } + + public int getColumnCount() + { + return 1; + } + + public Object getValueAt(int rowIndex, int columnIndex) + { + return impact.get(rowIndex); + } + + + @Override + public void axiomForImpactChanged() { + rebuildData(); + + } + + @Override + public void repairPlanExecuted() { + rebuildData(); + + } + + +} Copied: trunk/src/dl-learner/org/dllearner/tools/ore/ui/OWLSyntaxTableCellRenderer.java (from rev 1816, trunk/src/dl-learner/org/dllearner/tools/ore/OWLSyntaxTableCellRenderer.java) =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ui/OWLSyntaxTableCellRenderer.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/OWLSyntaxTableCellRenderer.java 2009-08-04 20:02:34 UTC (rev 1817) @@ -0,0 +1,131 @@ +package org.dllearner.tools.ore.ui; + +import java.io.StringWriter; +import java.util.StringTokenizer; + +import javax.swing.table.DefaultTableCellRenderer; + +import org.dllearner.tools.ore.RepairManager; +import org.semanticweb.owl.model.OWLAxiom; + +import com.clarkparsia.explanation.io.manchester.Keyword; +import com.clarkparsia.explanation.io.manchester.ManchesterSyntaxObjectRenderer; +import com.clarkparsia.explanation.io.manchester.TextBlockWriter; + +public class OWLSyntaxTableCellRenderer extends DefaultTableCellRenderer { + + /** + * + */ + private static final long serialVersionUID = 6528440084244154347L; + + + private StringWriter buffer; + private TextBlockWriter writer; + private ManchesterSyntaxObjectRenderer renderer; + private RepairManager repMan; +// private List<String> oldAxioms; + + public OWLSyntaxTableCellRenderer(RepairManager repMan){ + super(); + this.repMan = repMan; + buffer = new StringWriter(); + writer = new TextBlockWriter(buffer); + renderer = new ManchesterSyntaxObjectRenderer(writer); + renderer.setWrapLines( false ); + renderer.setSmartIndent( true ); +// oldAxioms = new ArrayList<String>(); + + } + + public OWLSyntaxTableCellRenderer(){ + super(); + buffer = new StringWriter(); + writer = new TextBlockWriter(buffer); + renderer = new ManchesterSyntaxObjectRenderer(writer); + renderer.setWrapLines( false ); + renderer.setSmartIndent( true ); + } + + @Override + protected void setValue(Object value) { + + if(value instanceof OWLAxiom){ + boolean striked = false; + if(repMan != null && repMan.isSelected((OWLAxiom)value)){ + striked = true; + } + ((OWLAxiom)value).accept(renderer); + + writer.flush(); + String newAxiom = buffer.toString(); +// System.out.println("new axiom " + newAxiom); +// if(!oldAxioms.isEmpty()){ +// StringTokenizer st = new StringTokenizer(newAxiom); +// int index; +// String token = st.nextToken(); +// for(String s : oldAxioms){System.out.println("old axiom " + s); +// +// +// if(s.contains(token)){ +// index = s.indexOf(token); +// if(index>0){ +// StringBuffer bf = new StringBuffer(); +// for(int i = 0;i<=index+10;i++){ +// bf.append(" "); +// } +// bf.append(newAxiom); +// newAxiom = bf.toString(); +// break; +// } +// } +// +// } +// } + StringTokenizer st = new StringTokenizer(newAxiom); + + StringBuffer bf = new StringBuffer(); + bf.append("<html>"); + if(striked){ + bf.append("<strike>"); + } + + String token; + while(st.hasMoreTokens()){ + token = st.nextToken(); + String color = "black"; + boolean isReserved = false; + for(Keyword key : Keyword.values()){ + if(token.equals(key.getLabel())){ + color = key.getColor(); + isReserved = true;break; + } + } + if(isReserved){ + bf.append("<font color=" + color + ">" + token + " </font>"); + } else { + bf.append(" " + token + " "); + } + } + if(striked){ + bf.append("</strike>"); + } + bf.append("</html>"); + newAxiom = bf.toString(); + + setText(newAxiom); +// oldAxioms.add(buffer.toString()); + buffer.getBuffer().delete(0, buffer.toString().length()); + } else { + super.setValue(value); + } + +// ManchesterOWLSyntaxOWLObjectRendererImpl renderer = new ManchesterOWLSyntaxOWLObjectRendererImpl(); + + +//// DLSyntaxObjectRenderer renderer = new DLSyntaxObjectRenderer(); +// setText(renderer.render((OWLAxiom) value)); + + + } +} Copied: trunk/src/dl-learner/org/dllearner/tools/ore/ui/RepairDialog.java (from rev 1816, trunk/src/dl-learner/org/dllearner/tools/ore/RepairDialog.java) =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ui/RepairDialog.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/RepairDialog.java 2009-08-04 20:02:34 UTC (rev 1817) @@ -0,0 +1,388 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +package org.dllearner.tools.ore.ui; + +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Cursor; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Insets; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import javax.swing.Box; +import javax.swing.BoxLayout; +import javax.swing.JButton; +import javax.swing.JDialog; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JSeparator; +import javax.swing.border.EmptyBorder; + +import org.dllearner.core.owl.Description; +import org.dllearner.core.owl.Individual; +import org.dllearner.core.owl.NamedClass; +import org.dllearner.core.owl.ObjectQuantorRestriction; +import org.dllearner.core.owl.ObjectSomeRestriction; +import org.dllearner.tools.ore.ORE; +import org.dllearner.tools.ore.OntologyModifier; +import org.dllearner.tools.ore.ui.wizard.panels.ChangePanel; +import org.dllearner.tools.ore.ui.wizard.panels.ChangesPanel; +import org.dllearner.tools.ore.ui.wizard.panels.DescriptionPanel; +import org.dllearner.tools.ore.ui.wizard.panels.StatsPanel; +import org.semanticweb.owl.model.OWLOntologyChange; + +/** + * The repair dialog where the learned class description (including error parts), + * the statistics and the undo options are shown. + * @author Lorenz Buehmann + * + */ +public class RepairDialog extends JDialog implements ActionListener, MouseListener{ + + /** + * + */ + private static final long serialVersionUID = 1L; + + + public static final int CANCEL_RETURN_CODE = 1; + public static final int OK_RETURN_CODE = 2; + public static final int VALID_RETURN_CODE = 3; + + private int returncode; + + private StatsPanel statsPanel; + private DescriptionPanel descPanel; + private JPanel okCancelPanel; + private JPanel actionStatsPanel; + + private ChangesPanel changesPanel; + private JScrollPane changesScroll; + + private JButton okButton; + private JButton cancelButton; + + private String mode; + + private OntologyModifier modifier; + private ORE ore; + private Individual ind; + private Description actualDesc; + private Description newDesc; + private Set<OWLOntologyChange> allChanges; + private String baseURI; + private Map<String, String> prefixes; + + + public RepairDialog(Individual ind, JDialog dialog, final ORE ore, String mode){ + super(dialog, true); + final Component dialogd = this.getParent(); + setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); + addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent we) { + if(allChanges.size() > 0){ + if (JOptionPane.showConfirmDialog(dialogd, + "All changes will be lost!", "Warning!", + JOptionPane.YES_NO_OPTION) + == JOptionPane.YES_OPTION){ + + modifier.undoChanges(allChanges); + ore.updateReasoner(); + allChanges.clear(); + returncode = CANCEL_RETURN_CODE; + setVisible(false); + dispose(); + } + } else{ + returncode = CANCEL_RETURN_CODE; + setVisible(false); + dispose(); + } + + } + + }); + + + this.ind = ind; + this.ore = ore; + this.modifier = ore.getModifier(); + this.mode = mode; + allChanges = new HashSet<OWLOntologyChange>(); + + } + + /** + * Initializing and making dialog visible. + * @return integer value + */ + public int showDialog(){ + baseURI = ore.getBaseURI(); + prefixes = ore.getPrefixes(); + if(mode.equals("neg")){ + this.setTitle("Repair negative example"); + } else if(mode.equals("pos")){ + this.setTitle("Repair positive example"); + } + this.setSize(700, 700); + this.setLayout(new BorderLayout()); + + descPanel = new DescriptionPanel(ore, ind, this, mode); + JScrollPane descScroll = new JScrollPane(); + descScroll.setViewportView(descPanel); + + statsPanel = new StatsPanel(ore, ind); + statsPanel.init(); + JScrollPane statsScroll = new JScrollPane(); + statsScroll.setViewportView(statsPanel); + + + changesPanel = new ChangesPanel(); + changesScroll = new JScrollPane(); + changesScroll.setViewportView(changesPanel); + + actionStatsPanel = new JPanel(); + + GridBagLayout gbl = new GridBagLayout(); + gbl.rowWeights = new double[] {0.0, 0.1, 0.1}; + gbl.rowHeights = new int[] {64, 7, 7}; + gbl.columnWeights = new double[] {0.1}; + gbl.columnWidths = new int[] {7}; + actionStatsPanel.setLayout(gbl); + + + actionStatsPanel.add(descScroll, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0)); + actionStatsPanel.add(statsScroll, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 5, 0, 5), 0, 0)); + actionStatsPanel.add(changesScroll, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 5, 0, 5), 0, 0)); + + + JSeparator separator = new JSeparator(); + Box buttonBox = new Box(BoxLayout.X_AXIS); + + okCancelPanel = new JPanel(); + okCancelPanel.setLayout(new BorderLayout()); + okCancelPanel.add(separator, BorderLayout.NORTH); + okButton = new JButton("Ok"); + okButton.addActionListener(this); + cancelButton = new JButton("Cancel"); + cancelButton.addActionListener(this); + + + getContentPane().add(actionStatsPanel, java.awt.BorderLayout.CENTER); + + + buttonBox.setBorder(new EmptyBorder(new Insets(5, 10, 5, 10))); + buttonBox.add(okButton); + buttonBox.add(Box.createHorizontalStrut(10)); + buttonBox.add(cancelButton); + okCancelPanel.add(buttonBox, BorderLayout.EAST); + + getContentPane().add(okCancelPanel, BorderLayout.SOUTH); + + + this.setModal(true); + this.setVisible(true); + + return returncode; + + } + + /** + * Method controls action events triggered by clicking on red labels in class description at the top of the dialog. + */ + public void actionPerformed(ActionEvent e) { + + if(e.getSource() instanceof DescriptionMenuItem){ + DescriptionMenuItem item =(DescriptionMenuItem) e.getSource(); + actualDesc = item.getDescription(); + int action = item.getActionID(); + if(action == 4){ + Individual obj = new Individual(e.getActionCommand()); + + List<OWLOntologyChange> changes = modifier.addObjectProperty(ind, (ObjectQuantorRestriction) actualDesc, obj); + allChanges.addAll(changes); + + descPanel.updatePanel(); + + statsPanel.updatePanel(); + changesPanel.add(new ChangePanel("added property assertion " + ((ObjectQuantorRestriction) actualDesc).getRole().toKBSyntaxString(baseURI, prefixes) + + " to " + obj.toManchesterSyntaxString(baseURI, prefixes), changes, this)); + changesScroll.updateUI(); + } else if(action == 5){ + ObjectQuantorRestriction property = (ObjectQuantorRestriction) actualDesc; + List<OWLOntologyChange> changes = null; + for(Individual i : ore.getIndividualsInPropertyRange(property, ind)){ + changes = modifier.removeObjectPropertyAssertion(ind, property, i); + allChanges.addAll(changes); + } + + descPanel.updatePanel(); + statsPanel.updatePanel(); + changesPanel.add(new ChangePanel("removed property assertions " + + ((ObjectSomeRestriction) actualDesc).getRole().toKBSyntaxString(baseURI, prefixes) + + " to range " + ((ObjectSomeRestriction) actualDesc).getChild(0).toManchesterSyntaxString(baseURI, prefixes), changes, this)); + changesScroll.updateUI(); + } else if(action == 6){ + List<OWLOntologyChange> changes = modifier.deleteObjectProperty(ind, (ObjectQuantorRestriction) actualDesc); + allChanges.addAll(changes); + descPanel.updatePanel(); + statsPanel.updatePanel(); + changesPanel.add(new ChangePanel("deleted property " + ((ObjectQuantorRestriction) actualDesc).getRole().toKBSyntaxString(baseURI, prefixes), changes, this)); + changesScroll.updateUI(); + } else if(action == 0){ + newDesc = new NamedClass(item.getName()); + List<OWLOntologyChange> changes = modifier.moveIndividual(ind, actualDesc, newDesc); + allChanges.addAll(changes); + descPanel.updatePanel(); + statsPanel.updatePanel(); + changesPanel.add(new ChangePanel("moved class assertion from " + actualDesc.toManchesterSyntaxString(baseURI, prefixes) + + " to " + newDesc.toManchesterSyntaxString(baseURI, prefixes), changes, this)); + changesScroll.updateUI(); + } else if(action == 3){ + List<OWLOntologyChange> changes = modifier.removeClassAssertion(ind, actualDesc); + allChanges.addAll(changes); + descPanel.updatePanel(); + statsPanel.updatePanel(); + changesPanel.add(new ChangePanel("removed class assertion to " + actualDesc.toManchesterSyntaxString(baseURI, prefixes), changes, this)); + changesScroll.updateUI(); + } else if(action == 2){ + List<OWLOntologyChange> changes = modifier.addClassAssertion(ind, actualDesc); + allChanges.addAll(changes); + descPanel.updatePanel(); + statsPanel.updatePanel(); + changesPanel.add(new ChangePanel("added class assertion to " + actualDesc.toManchesterSyntaxString(baseURI, prefixes), changes, this)); + changesScroll.updateUI(); + } else if(action == 7){ + ObjectQuantorRestriction property = (ObjectQuantorRestriction) actualDesc; + List<OWLOntologyChange> changes = null; + for(Individual i : ore.getIndividualsNotInPropertyRange(property, ind)){ + changes = modifier.removeObjectPropertyAssertion(ind, property, i); + allChanges.addAll(changes); + } + + + descPanel.updatePanel(); + statsPanel.updatePanel(); + changesPanel.add(new ChangePanel("removed property assertion " + property.getRole().toKBSyntaxString(baseURI, prefixes) + + " to " + ind.toManchesterSyntaxString(baseURI, prefixes), changes, this)); + changesScroll.updateUI(); + } else if(action == 1){ + Description oldDesc = new NamedClass(item.getName()); + List<OWLOntologyChange> changes = modifier.moveIndividual(ind, oldDesc, actualDesc); + allChanges.addAll(changes); + descPanel.updatePanel(); + statsPanel.updatePanel(); + changesPanel.add(new ChangePanel("moved class assertion from " + oldDesc.toManchesterSyntaxString(baseURI, prefixes) + + " to " + actualDesc.toManchesterSyntaxString(baseURI, prefixes), changes, this)); + changesScroll.updateUI(); + } + } else if(e.getActionCommand().equals("Ok")){ + if(descPanel.isCorrect()){ + returncode = VALID_RETURN_CODE; + } else{ + returncode = OK_RETURN_CODE; + } + ore.updateReasoner(); + setVisible(false); + dispose(); + } else if(e.getActionCommand().equals("Cancel")){ + if(allChanges.size() > 0){ + if (JOptionPane.showConfirmDialog(this, + "All changes will be lost!", "Warning!", + JOptionPane.YES_NO_OPTION) + == JOptionPane.YES_OPTION){ + + modifier.undoChanges(allChanges); + ore.updateReasoner(); + allChanges.clear(); + returncode = CANCEL_RETURN_CODE; + setVisible(false); + dispose(); + } + } else{ + returncode = CANCEL_RETURN_CODE; + setVisible(false); + dispose(); + } + + } + + + } + + + public void mouseClicked(MouseEvent e) { + if(e.getSource() instanceof UndoLabel){ + List<OWLOntologyChange> changes = ((UndoLabel) e.getSource()).getChanges(); + modifier.undoChanges(changes); + allChanges.removeAll(changes); + descPanel.updatePanel(); + statsPanel.updatePanel(); + changesPanel.updatePanel(((UndoLabel) e.getSource()).getParent()); + setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); + + } + } + + public void mouseEntered(MouseEvent e) { + if(e.getSource() instanceof UndoLabel){ + ((UndoLabel) e.getSource()).setText("<html><u>Undo</u></html>"); + setCursor(new Cursor(Cursor.HAND_CURSOR)); + } + + } + + public void mouseExited(MouseEvent e) { + if(e.getSource() instanceof UndoLabel){ + ((UndoLabel) e.getSource()).setText("Undo"); + setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); + } + + } + + public void mousePressed(MouseEvent e) { + + } + + public void mouseReleased(MouseEvent e) { + + } + + public Set<OWLOntologyChange> getAllChanges() { + return allChanges; + } + + + + +} Copied: trunk/src/dl-learner/org/dllearner/tools/ore/ui/RepairTable.java (from rev 1816, trunk/src/dl-learner/org/dllearner/tools/ore/RepairTable.java) =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ui/RepairTable.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/RepairTable.java 2009-08-04 20:02:34 UTC (rev 1817) @@ -0,0 +1,25 @@ +package org.dllearner.tools.ore.ui; + +import java.awt.Color; + +import org.dllearner.tools.ore.RepairManager; +import org.jdesktop.swingx.JXTable; + +public class RepairTable extends JXTable { + + /** + * + */ + private static final long serialVersionUID = -621497634521668635L; + + public RepairTable(RepairManager manager){ + super(new RepairTableModel(manager)); + + setShowHorizontalLines(true); + setGridColor(Color.LIGHT_GRAY); + setTableHeader(null); + getColumnModel().getColumn(0).setCellRenderer(new OWLSyntaxTableCellRenderer()); + setRowHeight(getRowHeight() + 4); + + } +} Copied: trunk/src/dl-learner/org/dllearner/tools/ore/ui/RepairTableModel.java (from rev 1816, trunk/src/dl-learner/org/dllearner/tools/ore/RepairTableModel.java) =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/ui/RepairTableModel.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/tools/ore/ui/RepairTableModel.java 2009-08-04 20:02:34 UTC (rev 1817) @@ -0,0 +1,69 @@ +package org.dllearner.tools.ore.ui; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import javax.swing.table.AbstractTableModel; + +import org.dllearner.tools.ore.RepairManager; +import org.dllearner.tools.ore.RepairManagerListener; +import org.semanticweb.owl.model.OWLAxiom; + +public class RepairTableModel extends AbstractTableModel implements RepairManagerListener{ + + /** + * + */ + private static final long serialVersionUID = -5898900692701380258L; + private RepairManager repMan; + private List<OWLAxiom> axioms2Remove; + + public RepairTableModel(RepairManager impMan) + { + + axioms2Remove = new ArrayList<OWLAxiom>(); + this.repMan = impMan; + repMan.addListener(this); + rebuildData(); + } + + private void rebuildData() + { + axioms2Remove.clear(); + axioms2Remove.addAll(repMan.getAxioms2Remove()); + Collections.sort(axioms2Remove); + fireTableDataChanged(); + } + + + + public int getRowCount() + { + ... [truncated message content] |
From: <ku...@us...> - 2009-07-16 13:30:18
|
Revision: 1816 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1816&view=rev Author: kurzum Date: 2009-07-16 13:29:56 +0000 (Thu, 16 Jul 2009) Log Message: ----------- fix for empty filter list sparql component Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryMaker.java Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryMaker.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryMaker.java 2009-07-08 07:31:04 UTC (rev 1815) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryMaker.java 2009-07-16 13:29:56 UTC (rev 1816) @@ -192,7 +192,10 @@ String assembled = assembleTerms(terms, getOperator()); terms = new ArrayList<String>(); - terms.add(assembled); + // the next line could be removed as it is included in assemble terms + if(!assembled.isEmpty()){ + terms.add(assembled); + } if (!isLiterals()) { terms.add("!isLiteral(" + objectVariable + ")"); } @@ -216,7 +219,7 @@ if (terms.isEmpty()) return ""; else if (terms.size() == 1) - return brackets(terms.get(0)); + return (terms.get(0).isEmpty())?"": brackets(terms.get(0)); else { StringBuffer sbuf = new StringBuffer(1400); String first = terms.remove(0); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-07-08 07:31:10
|
Revision: 1815 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1815&view=rev Author: jenslehmann Date: 2009-07-08 07:31:04 +0000 (Wed, 08 Jul 2009) Log Message: ----------- save LGD matchings also as csv file for MySQL import Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java Modified: trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java =================================================================== --- trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java 2009-07-06 18:39:16 UTC (rev 1814) +++ trunk/src/dl-learner/org/dllearner/scripts/matching/DBpediaLinkedGeoData.java 2009-07-08 07:31:04 UTC (rev 1815) @@ -60,10 +60,11 @@ // chose between nt and dat private static String dbpediaFileFormat = "dat"; - static File dbpediaFile = new File("log/DBpedia_POIs." + dbpediaFileFormat); + static File dbpediaFile = new File("log/DBpedia_POIs." + dbpediaFileFormat); private static boolean regenerateFile = false; private static File matchingFile = new File("log/DBpedia_GeoData_Links.nt"); + private static File matchingFileMySQL = new File("log/DBpedia_POIs.csv"); private static File missesFile = new File("log/DBpedia_GeoData_Misses.dat"); private static double scoreThreshold = 0.85; private static StringDistance distance = new Jaro(); @@ -113,6 +114,7 @@ Files.clearFile(matchingFile); Files.clearFile(missesFile); FileOutputStream fos = new FileOutputStream(matchingFile, true); + FileOutputStream fosMySQL = new FileOutputStream(matchingFile, true); FileOutputStream fosMiss = new FileOutputStream(missesFile, true); // read file point by point BufferedReader br = new BufferedReader(new FileReader(dbpediaFile)); @@ -147,6 +149,17 @@ } else { String matchStr = "<" + dp.getUri() + "> <http://www.w3.org/2002/07/owl#sameAs> <" + matchURI + "> .\n"; fos.write(matchStr.getBytes()); + + // strip off http://dbpedia.org/resource/ + String dpName = dp.getUri().toString().substring(28); + String uriStr = matchURI.toString(); + String nodeWay = uriStr.contains("/node/") ? "node" : "way"; + String lgdID = uriStr.substring(uriStr.lastIndexOf("/")); + String matchStrMySQL = dpName + "\t" + nodeWay + "\t" + lgdID + "\n"; + fosMySQL.write(matchStrMySQL.getBytes()); + + System.out.println(matchStrMySQL); + matches++; matchPerClass.put(poiClass, matchPerClass.get(poiClass)+1); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <ku...@us...> - 2009-07-06 18:39:35
|
Revision: 1814 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1814&view=rev Author: kurzum Date: 2009-07-06 18:39:16 +0000 (Mon, 06 Jul 2009) Log Message: ----------- **hust, sch?\195?\164m** try again now Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryMaker.java Modified: trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryMaker.java =================================================================== --- trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryMaker.java 2009-07-06 13:01:57 UTC (rev 1813) +++ trunk/src/dl-learner/org/dllearner/kb/sparql/SparqlQueryMaker.java 2009-07-06 18:39:16 UTC (rev 1814) @@ -194,8 +194,6 @@ terms = new ArrayList<String>(); terms.add(assembled); if (!isLiterals()) { - System.out.println(isLiterals()+"true"); - System.exit(0); terms.add("!isLiteral(" + objectVariable + ")"); } return assembleTerms(terms, "&&"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-07-06 13:02:01
|
Revision: 1813 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1813&view=rev Author: jenslehmann Date: 2009-07-06 13:01:57 +0000 (Mon, 06 Jul 2009) Log Message: ----------- - EL learning algorithm changes - SPARQL test modified Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/algorithms/el/ELLearningAlgorithmDisjunctive.java trunk/src/dl-learner/org/dllearner/refinementoperators/Utility.java trunk/src/dl-learner/org/dllearner/tools/ore/SPARQLTest.java Modified: trunk/src/dl-learner/org/dllearner/algorithms/el/ELLearningAlgorithmDisjunctive.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/el/ELLearningAlgorithmDisjunctive.java 2009-07-06 11:39:13 UTC (rev 1812) +++ trunk/src/dl-learner/org/dllearner/algorithms/el/ELLearningAlgorithmDisjunctive.java 2009-07-06 13:01:57 UTC (rev 1813) @@ -105,12 +105,12 @@ private TreeSet<ELDescriptionTree> trees; // tree search - private int treeSearchTimeSeconds = 10; + private double treeSearchTimeSeconds = 1.0; // private double noise = 0; private List<ELDescriptionTree> currentSolution = new LinkedList<ELDescriptionTree>(); private EvaluatedDescription bestEvaluatedDescription; // how important not to cover negatives - private double posWeight = 1.5; // 2; + private double posWeight = 1.2; // 2; private int startPosExamplesSize; // private int startNegExamplesSize; private SortedSet<Individual> currentPosExamples; Modified: trunk/src/dl-learner/org/dllearner/refinementoperators/Utility.java =================================================================== --- trunk/src/dl-learner/org/dllearner/refinementoperators/Utility.java 2009-07-06 11:39:13 UTC (rev 1812) +++ trunk/src/dl-learner/org/dllearner/refinementoperators/Utility.java 2009-07-06 13:01:57 UTC (rev 1813) @@ -58,7 +58,8 @@ // specifies whether to do real disjoint tests or check that // two named classes do not have common instances - private boolean instanceBasedDisjoints = false; + // TODO: turn this into a parameter + private boolean instanceBasedDisjoints = true; // cache for reasoner queries private Map<Description,Map<Description,Boolean>> cachedDisjoints = new TreeMap<Description,Map<Description,Boolean>>(conceptComparator); Modified: trunk/src/dl-learner/org/dllearner/tools/ore/SPARQLTest.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/SPARQLTest.java 2009-07-06 11:39:13 UTC (rev 1812) +++ trunk/src/dl-learner/org/dllearner/tools/ore/SPARQLTest.java 2009-07-06 13:01:57 UTC (rev 1813) @@ -19,6 +19,8 @@ */ package org.dllearner.tools.ore; +import java.net.MalformedURLException; +import java.net.URL; import java.util.SortedSet; import java.util.TreeSet; @@ -31,55 +33,57 @@ import org.dllearner.kb.sparql.SPARQLTasks; import org.dllearner.kb.sparql.SparqlEndpoint; import org.dllearner.kb.sparql.SparqlKnowledgeSource; -import org.dllearner.learningproblems.PosOnlyLP; +import org.dllearner.learningproblems.ClassLearningProblem; import org.dllearner.reasoning.OWLAPIReasoner; import org.dllearner.utilities.examples.AutomaticNegativeExampleFinderSPARQL; import org.dllearner.utilities.examples.AutomaticPositiveExampleFinderSPARQL; /** * Test class for SPARQL mode. + * * @author Lorenz Buehmann - * + * */ -public class SPARQLTest{ - +public class SPARQLTest { + @SuppressWarnings("unused") - public static void main(String[] args){ - String example = "Angela_Merkel"; + public static void main(String[] args) throws MalformedURLException { + String exampleClass = "\"http://dbpedia.org/class/yago/LeadersOfPoliticalParties\""; ComponentManager cm = ComponentManager.getInstance(); - + SparqlEndpoint endPoint = SparqlEndpoint.getEndpointDBpedia(); - + SPARQLTasks task = new SPARQLTasks(endPoint); - + AutomaticPositiveExampleFinderSPARQL pos = new AutomaticPositiveExampleFinderSPARQL(task); - pos.makePositiveExamplesFromConcept(example); + pos.makePositiveExamplesFromConcept(exampleClass); SortedSet<String> posExamples = pos.getPosExamples(); - - AutomaticNegativeExampleFinderSPARQL neg = new AutomaticNegativeExampleFinderSPARQL(posExamples, task, new TreeSet<String>()); + System.out.println(posExamples); + + AutomaticNegativeExampleFinderSPARQL neg = new AutomaticNegativeExampleFinderSPARQL( + posExamples, task, new TreeSet<String>()); SortedSet<String> negExamples = neg.getNegativeExamples(20); System.out.println(negExamples); - - - - + + SortedSet<String> instances = new TreeSet<String>(posExamples); + instances.addAll(negExamples); + try { - - - - + SparqlKnowledgeSource ks = cm.knowledgeSource(SparqlKnowledgeSource.class); cm.applyConfigEntry(ks, "predefinedEndpoint", "DBPEDIA"); - ks.getConfigurator().setInstances(posExamples); + ks.getConfigurator().setInstances(instances); + ks.getConfigurator().setPredefinedFilter("YAGO"); ks.init(); ReasonerComponent reasoner = cm.reasoner(OWLAPIReasoner.class, ks); reasoner.init(); - PosOnlyLP lp = cm.learningProblem(PosOnlyLP.class, reasoner); - lp.getConfigurator().setPositiveExamples(posExamples); + ClassLearningProblem lp = cm.learningProblem(ClassLearningProblem.class, reasoner); +// lp.getConfigurator().setPositiveExamples(posExamples); + lp.getConfigurator().setClassToDescribe(new URL(exampleClass)); lp.init(); LearningAlgorithm la = cm.learningAlgorithm(CELOE.class, lp, reasoner); la.init(); - + la.start(); } catch (ComponentInitException e) { // TODO Auto-generated catch block This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lor...@us...> - 2009-07-06 11:39:16
|
Revision: 1812 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1812&view=rev Author: lorenz_b Date: 2009-07-06 11:39:13 +0000 (Mon, 06 Jul 2009) Log Message: ----------- sparql test case - actually not working Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/tools/ore/SPARQLTest.java Modified: trunk/src/dl-learner/org/dllearner/tools/ore/SPARQLTest.java =================================================================== --- trunk/src/dl-learner/org/dllearner/tools/ore/SPARQLTest.java 2009-07-01 15:14:16 UTC (rev 1811) +++ trunk/src/dl-learner/org/dllearner/tools/ore/SPARQLTest.java 2009-07-06 11:39:13 UTC (rev 1812) @@ -25,15 +25,13 @@ import org.dllearner.algorithms.celoe.CELOE; import org.dllearner.core.ComponentInitException; import org.dllearner.core.ComponentManager; -import org.dllearner.core.KnowledgeSource; import org.dllearner.core.LearningAlgorithm; -import org.dllearner.core.LearningProblem; import org.dllearner.core.LearningProblemUnsupportedException; import org.dllearner.core.ReasonerComponent; import org.dllearner.kb.sparql.SPARQLTasks; import org.dllearner.kb.sparql.SparqlEndpoint; import org.dllearner.kb.sparql.SparqlKnowledgeSource; -import org.dllearner.learningproblems.ClassLearningProblem; +import org.dllearner.learningproblems.PosOnlyLP; import org.dllearner.reasoning.OWLAPIReasoner; import org.dllearner.utilities.examples.AutomaticNegativeExampleFinderSPARQL; import org.dllearner.utilities.examples.AutomaticPositiveExampleFinderSPARQL; @@ -47,6 +45,7 @@ @SuppressWarnings("unused") public static void main(String[] args){ + String example = "Angela_Merkel"; ComponentManager cm = ComponentManager.getInstance(); SparqlEndpoint endPoint = SparqlEndpoint.getEndpointDBpedia(); @@ -54,7 +53,7 @@ SPARQLTasks task = new SPARQLTasks(endPoint); AutomaticPositiveExampleFinderSPARQL pos = new AutomaticPositiveExampleFinderSPARQL(task); - pos.makePositiveExamplesFromConcept("angela_merkel"); + pos.makePositiveExamplesFromConcept(example); SortedSet<String> posExamples = pos.getPosExamples(); AutomaticNegativeExampleFinderSPARQL neg = new AutomaticNegativeExampleFinderSPARQL(posExamples, task, new TreeSet<String>()); @@ -65,16 +64,18 @@ try { - String example = "http://dbpedia.org/resource/Angela_Merkel"; - KnowledgeSource ks = cm.knowledgeSource(SparqlKnowledgeSource.class); + + SparqlKnowledgeSource ks = cm.knowledgeSource(SparqlKnowledgeSource.class); cm.applyConfigEntry(ks, "predefinedEndpoint", "DBPEDIA"); + ks.getConfigurator().setInstances(posExamples); ks.init(); ReasonerComponent reasoner = cm.reasoner(OWLAPIReasoner.class, ks); reasoner.init(); - LearningProblem lp = cm.learningProblem(ClassLearningProblem.class, reasoner); + PosOnlyLP lp = cm.learningProblem(PosOnlyLP.class, reasoner); + lp.getConfigurator().setPositiveExamples(posExamples); lp.init(); LearningAlgorithm la = cm.learningAlgorithm(CELOE.class, lp, reasoner); la.init(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-07-01 15:14:17
|
Revision: 1811 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1811&view=rev Author: jenslehmann Date: 2009-07-01 15:14:16 +0000 (Wed, 01 Jul 2009) Log Message: ----------- - redundancy check for EL learning algorithm - adaptive heuristic for disjunctive tree learning Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/algorithms/el/ELLearningAlgorithmDisjunctive.java Modified: trunk/src/dl-learner/org/dllearner/algorithms/el/ELLearningAlgorithmDisjunctive.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/el/ELLearningAlgorithmDisjunctive.java 2009-06-26 14:11:46 UTC (rev 1810) +++ trunk/src/dl-learner/org/dllearner/algorithms/el/ELLearningAlgorithmDisjunctive.java 2009-07-01 15:14:16 UTC (rev 1811) @@ -66,8 +66,20 @@ * the algorithm is not really an anytime algorithm, since the solution is constructed * stepwise as a set of trees. * - * TODO redundancy check + * Parameter optimisation: + * - runtime per tree: 10 seconds + * - tradeoff pos/neg: 1.0 1.2 1.4 1.6. 1.8 2.0 + * - min score: 0 -2.5 -5 -7.5 -10 + * - tests: 30 + * - runtime per test: 200 seconds => 2000 seconds cross val => 60000 seconds overall * + * Next idea: + * - reduce tradeoff for each tree added (start with 2.0 and reduce by 0.1) + * - for the last tress it is not very important to cover less negatives + * - minimum is something between 0 and -1 (ensures that in the worst case as many + * positives as negatives are covered) + * - only high impact parameter is runtime (and maybe start tradeoff) + * * @author Jens Lehmann * */ @@ -89,22 +101,25 @@ private SearchTreeNode startNode; private ELHeuristic heuristic; private TreeSet<SearchTreeNode> candidates; + // all trees (for fast redundancy check) + private TreeSet<ELDescriptionTree> trees; // tree search - private double noise = 0; + private int treeSearchTimeSeconds = 10; +// private double noise = 0; private List<ELDescriptionTree> currentSolution = new LinkedList<ELDescriptionTree>(); private EvaluatedDescription bestEvaluatedDescription; // how important not to cover negatives - private double posWeight = 2; + private double posWeight = 1.5; // 2; private int startPosExamplesSize; - private int startNegExamplesSize; +// private int startNegExamplesSize; private SortedSet<Individual> currentPosExamples; private SortedSet<Individual> currentNegExamples; private SearchTreeNode bestCurrentNode; private double bestCurrentScore = 0; private long treeStartTime; // minimum score a tree must have to be part of the solution - private double minimumTreeScore = -8; + private double minimumTreeScore = -1; public ELLearningAlgorithmDisjunctive(PosNegLP problem, ReasonerComponent reasoner) { super(problem, reasoner); @@ -143,6 +158,7 @@ public void init() throws ComponentInitException { heuristic = new DisjunctiveHeuristic(); candidates = new TreeSet<SearchTreeNode>(heuristic); + trees = new TreeSet<ELDescriptionTree>(new ELDescriptionTreeComparator()); if(configurator.getStartClass() != null) { startClass = new NamedClass(configurator.getStartClass()); @@ -151,7 +167,7 @@ } operator = new ELDown2(reasoner); - noise = configurator.getNoisePercentage()/(double)100; +// noise = configurator.getNoisePercentage()/(double)100; baseURI = reasoner.getBaseURI(); prefixes = reasoner.getPrefixes(); @@ -240,8 +256,14 @@ logger.info("no tree found, which satisfies the minimum criteria - the best was: " + bestCurrentNode.getDescriptionTree().transformToDescription().toManchesterSyntaxString(baseURI, prefixes) + " with score " + bestCurrentNode.getScore()); } + logger.info(trees.size() + " trees checked"); + + // reduce importance of not covering negatives + posWeight = Math.max(1.0, posWeight-0.1); + // reset temporary variables candidates.clear(); + trees.clear(); treeCount++; } @@ -259,6 +281,12 @@ // evaluates a description in tree form private void addDescriptionTree(ELDescriptionTree descriptionTree, SearchTreeNode parentNode) { + // redundancy check + boolean nonRedundant = trees.add(descriptionTree); + if(!nonRedundant) { + return; + } + // create search tree node SearchTreeNode node = new SearchTreeNode(descriptionTree); @@ -340,7 +368,7 @@ long runTime = System.nanoTime() - treeStartTime; double runTimeSeconds = runTime / (double) 1000000000; - if(runTimeSeconds >= 10) { + if(runTimeSeconds >= treeSearchTimeSeconds) { return true; } else { return false; @@ -355,7 +383,7 @@ // we stop when the score of the last tree added is too low // (indicating that the algorithm could not find anything appropriate // in the timeframe set) - if(bestCurrentScore < minimumTreeScore) { + if(bestCurrentScore <= minimumTreeScore) { return true; } @@ -368,12 +396,13 @@ // set all values back to their default values (used for running // the algorithm more than once) candidates.clear(); + trees.clear(); currentSolution.clear(); bestEvaluatedDescription = learningProblem.evaluate(Thing.instance); currentPosExamples = getLearningProblem().getPositiveExamples(); currentNegExamples = getLearningProblem().getNegativeExamples(); startPosExamplesSize = currentPosExamples.size(); - startNegExamplesSize = currentNegExamples.size(); +// startNegExamplesSize = currentNegExamples.size(); } @Override This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-06-26 14:11:49
|
Revision: 1810 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1810&view=rev Author: jenslehmann Date: 2009-06-26 14:11:46 +0000 (Fri, 26 Jun 2009) Log Message: ----------- practical tests and enhancements Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/algorithms/el/ELLearningAlgorithmDisjunctive.java Modified: trunk/src/dl-learner/org/dllearner/algorithms/el/ELLearningAlgorithmDisjunctive.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/el/ELLearningAlgorithmDisjunctive.java 2009-06-25 16:56:18 UTC (rev 1809) +++ trunk/src/dl-learner/org/dllearner/algorithms/el/ELLearningAlgorithmDisjunctive.java 2009-06-26 14:11:46 UTC (rev 1810) @@ -45,6 +45,7 @@ import org.dllearner.core.owl.Union; import org.dllearner.learningproblems.PosNegLP; import org.dllearner.refinementoperators.ELDown2; +import org.dllearner.utilities.owl.DescriptionMinimizer; /** * A learning algorithm for EL, which will based on an @@ -79,6 +80,7 @@ Map<String,String> prefixes; private ELDown2 operator; + private DescriptionMinimizer minimizer; private boolean isRunning = false; private boolean stop = false; @@ -101,6 +103,8 @@ private SearchTreeNode bestCurrentNode; private double bestCurrentScore = 0; private long treeStartTime; + // minimum score a tree must have to be part of the solution + private double minimumTreeScore = -8; public ELLearningAlgorithmDisjunctive(PosNegLP problem, ReasonerComponent reasoner) { super(problem, reasoner); @@ -151,6 +155,8 @@ baseURI = reasoner.getBaseURI(); prefixes = reasoner.getPrefixes(); + + minimizer = new DescriptionMinimizer(reasoner); } @Override @@ -198,37 +204,41 @@ // System.out.println("=="); } - // we found a tree (partial solution) - currentSolution.add(bestCurrentNode.getDescriptionTree()); - Description bestDescription = bestCurrentNode.getDescriptionTree().transformToDescription(); - // form union of trees found so far with - if(treeCount==0) { - bestEvaluatedDescription = learningProblem.evaluate(bestDescription); - } else { - Union union = new Union(bestEvaluatedDescription.getDescription(), bestDescription); - bestEvaluatedDescription = learningProblem.evaluate(union); - } - - // remove already covered examples - Iterator<Individual> it = currentPosExamples.iterator(); - int posCov = 0; - while(it.hasNext()) { - Individual ind = it.next(); - if(reasoner.hasType(bestDescription, ind)) { - it.remove(); - posCov++; + if(bestCurrentScore > minimumTreeScore) { + // we found a tree (partial solution) + currentSolution.add(bestCurrentNode.getDescriptionTree()); + Description bestDescription = bestCurrentNode.getDescriptionTree().transformToDescription(); + // form union of trees found so far with + if(treeCount==0) { + bestEvaluatedDescription = learningProblem.evaluate(bestDescription); + } else { + Union union = new Union(bestEvaluatedDescription.getDescription(), bestDescription); + bestEvaluatedDescription = learningProblem.evaluate(union); } - } - it = currentNegExamples.iterator(); - int negCov = 0; - while(it.hasNext()) { - Individual ind = it.next(); - if(reasoner.hasType(bestDescription, ind)) { - it.remove(); - negCov++; + + // remove already covered examples + Iterator<Individual> it = currentPosExamples.iterator(); + int posCov = 0; + while(it.hasNext()) { + Individual ind = it.next(); + if(reasoner.hasType(bestDescription, ind)) { + it.remove(); + posCov++; + } } + it = currentNegExamples.iterator(); + int negCov = 0; + while(it.hasNext()) { + Individual ind = it.next(); + if(reasoner.hasType(bestDescription, ind)) { + it.remove(); + negCov++; + } + } + logger.info("tree found: " + bestDescription.toManchesterSyntaxString(baseURI, prefixes) + " (" + posCov + " pos covered, " + currentPosExamples.size() + " remaining, " + negCov + " neg covered, " + currentNegExamples.size() + " remaining, score: " + bestCurrentNode.getScore() + ")"); + } else { + logger.info("no tree found, which satisfies the minimum criteria - the best was: " + bestCurrentNode.getDescriptionTree().transformToDescription().toManchesterSyntaxString(baseURI, prefixes) + " with score " + bestCurrentNode.getScore()); } - logger.info("tree found: " + bestDescription.toManchesterSyntaxString(baseURI, prefixes) + " (" + posCov + " pos covered, " + currentPosExamples.size() + " remaining, " + negCov + " neg covered, " + currentNegExamples.size() + " remaining, score: " + bestCurrentNode.getScore() + ")"); // reset temporary variables candidates.clear(); @@ -236,6 +246,10 @@ treeCount++; } + // simplify solution (in particular necessary when start class is specified) + Description niceDescription = minimizer.minimizeClone(bestEvaluatedDescription.getDescription()); + bestEvaluatedDescription = learningProblem.evaluate(niceDescription); + // print solution logger.info("solution : " + bestEvaluatedDescription.getDescription().toManchesterSyntaxString(baseURI, prefixes) + "(acc: " + bestEvaluatedDescription.getAccuracy() + ")"); @@ -324,8 +338,9 @@ private boolean treeCriteriaSatisfied() { long runTime = System.nanoTime() - treeStartTime; - // more than one second has passed - if(runTime / (double) 1000000000 >= 10) { + double runTimeSeconds = runTime / (double) 1000000000; + + if(runTimeSeconds >= 10) { return true; } else { return false; @@ -337,8 +352,16 @@ // SearchTreeNode bestNode = candidates.last(); // return (bestNode.getCoveredNegatives() == 0); - // stop whan all positive examples have been covered - return (currentPosExamples.size()==0); + // we stop when the score of the last tree added is too low + // (indicating that the algorithm could not find anything appropriate + // in the timeframe set) + if(bestCurrentScore < minimumTreeScore) { + return true; + } + + // stop when almost all positive examples have been covered + int maxPosRemaining = (int) Math.ceil(startPosExamplesSize * 0.05d); + return (currentPosExamples.size()<=maxPosRemaining); } private void reset() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <jen...@us...> - 2009-06-25 16:56:22
|
Revision: 1809 http://dl-learner.svn.sourceforge.net/dl-learner/?rev=1809&view=rev Author: jenslehmann Date: 2009-06-25 16:56:18 +0000 (Thu, 25 Jun 2009) Log Message: ----------- disjunctive EL algorithm ctd. Modified Paths: -------------- trunk/src/dl-learner/org/dllearner/algorithms/el/DisjunctiveHeuristic.java trunk/src/dl-learner/org/dllearner/algorithms/el/ELLearningAlgorithmDisjunctive.java trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java Added Paths: ----------- trunk/src/dl-learner/org/dllearner/core/configurators/ELLearningAlgorithmDisjunctiveConfigurator.java Modified: trunk/src/dl-learner/org/dllearner/algorithms/el/DisjunctiveHeuristic.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/el/DisjunctiveHeuristic.java 2009-06-25 10:17:14 UTC (rev 1808) +++ trunk/src/dl-learner/org/dllearner/algorithms/el/DisjunctiveHeuristic.java 2009-06-25 16:56:18 UTC (rev 1809) @@ -8,8 +8,11 @@ double diff = tree1.getScore()-tree2.getScore(); if(diff < 0.00001 && diff > -0.00001) { return edt.compare(tree1.getDescriptionTree(), tree2.getDescriptionTree()); + } else if(diff > 0){ + return 1; +// return (int)Math.signum(diff); } else { - return (int)Math.signum(diff); + return -1; } } Modified: trunk/src/dl-learner/org/dllearner/algorithms/el/ELLearningAlgorithmDisjunctive.java =================================================================== --- trunk/src/dl-learner/org/dllearner/algorithms/el/ELLearningAlgorithmDisjunctive.java 2009-06-25 10:17:14 UTC (rev 1808) +++ trunk/src/dl-learner/org/dllearner/algorithms/el/ELLearningAlgorithmDisjunctive.java 2009-06-25 16:56:18 UTC (rev 1809) @@ -23,6 +23,7 @@ import java.util.Iterator; import java.util.LinkedList; import java.util.List; +import java.util.Map; import java.util.SortedSet; import java.util.TreeSet; @@ -33,12 +34,13 @@ import org.dllearner.core.LearningProblem; import org.dllearner.core.ReasonerComponent; import org.dllearner.core.configurators.Configurator; -import org.dllearner.core.configurators.ELLearningAlgorithmConfigurator; +import org.dllearner.core.configurators.ELLearningAlgorithmDisjunctiveConfigurator; import org.dllearner.core.options.CommonConfigOptions; import org.dllearner.core.options.ConfigOption; import org.dllearner.core.options.StringConfigOption; import org.dllearner.core.owl.Description; import org.dllearner.core.owl.Individual; +import org.dllearner.core.owl.NamedClass; import org.dllearner.core.owl.Thing; import org.dllearner.core.owl.Union; import org.dllearner.learningproblems.PosNegLP; @@ -71,32 +73,38 @@ public class ELLearningAlgorithmDisjunctive extends LearningAlgorithm { private static Logger logger = Logger.getLogger(ELLearningAlgorithmDisjunctive.class); - private ELLearningAlgorithmConfigurator configurator; + private ELLearningAlgorithmDisjunctiveConfigurator configurator; + String baseURI; + Map<String,String> prefixes; + private ELDown2 operator; private boolean isRunning = false; private boolean stop = false; + private Description startClass; private SearchTreeNode startNode; private ELHeuristic heuristic; private TreeSet<SearchTreeNode> candidates; // tree search + private double noise = 0; private List<ELDescriptionTree> currentSolution = new LinkedList<ELDescriptionTree>(); private EvaluatedDescription bestEvaluatedDescription; - // how important not cover - private double posWeight = 5; + // how important not to cover negatives + private double posWeight = 2; private int startPosExamplesSize; private int startNegExamplesSize; private SortedSet<Individual> currentPosExamples; private SortedSet<Individual> currentNegExamples; - private ELDescriptionTree bestCurrentTree; + private SearchTreeNode bestCurrentNode; private double bestCurrentScore = 0; private long treeStartTime; public ELLearningAlgorithmDisjunctive(PosNegLP problem, ReasonerComponent reasoner) { super(problem, reasoner); + configurator = new ELLearningAlgorithmDisjunctiveConfigurator(this); } public static String getName() { @@ -132,7 +140,17 @@ heuristic = new DisjunctiveHeuristic(); candidates = new TreeSet<SearchTreeNode>(heuristic); + if(configurator.getStartClass() != null) { + startClass = new NamedClass(configurator.getStartClass()); + } else { + startClass = Thing.instance; + } operator = new ELDown2(reasoner); + + noise = configurator.getNoisePercentage()/(double)100; + + baseURI = reasoner.getBaseURI(); + prefixes = reasoner.getPrefixes(); } @Override @@ -146,9 +164,9 @@ treeStartTime = System.nanoTime(); // create start node - ELDescriptionTree top = new ELDescriptionTree(reasoner, Thing.instance); - addDescriptionTree(top, null); - bestCurrentTree = top; + ELDescriptionTree startTree = new ELDescriptionTree(reasoner, startClass); + addDescriptionTree(startTree, null); +// bestCurrentTree = top; bestCurrentScore = Double.NEGATIVE_INFINITY; // main loop @@ -156,6 +174,8 @@ while(!stop && !treeCriteriaSatisfied()) { // pick the best candidate according to the heuristic SearchTreeNode best = candidates.pollLast(); +// System.out.println("best: " + best); + // apply operator List<ELDescriptionTree> refinements = operator.refine(best.getDescriptionTree()); // add all refinements to search tree, candidates, best descriptions @@ -169,11 +189,18 @@ logger.trace(startNode.getTreeString()); logger.trace("Loop " + loop + " completed."); } + +// for(SearchTreeNode node : candidates) { +// System.out.println(node); +// } +// System.out.println(candidates.last()); +// System.out.println(candidates.first()); +// System.out.println("=="); } // we found a tree (partial solution) - currentSolution.add(bestCurrentTree); - Description bestDescription = bestCurrentTree.transformToDescription(); + currentSolution.add(bestCurrentNode.getDescriptionTree()); + Description bestDescription = bestCurrentNode.getDescriptionTree().transformToDescription(); // form union of trees found so far with if(treeCount==0) { bestEvaluatedDescription = learningProblem.evaluate(bestDescription); @@ -201,13 +228,16 @@ negCov++; } } - logger.info("tree found: " + bestDescription + " (" + posCov + " pos covered, " + currentPosExamples.size() + " remaining, " + negCov + " neg covered, " + currentNegExamples.size() + " remaining"); + logger.info("tree found: " + bestDescription.toManchesterSyntaxString(baseURI, prefixes) + " (" + posCov + " pos covered, " + currentPosExamples.size() + " remaining, " + negCov + " neg covered, " + currentNegExamples.size() + " remaining, score: " + bestCurrentNode.getScore() + ")"); + // reset temporary variables + candidates.clear(); + treeCount++; } // print solution - logger.info("solution : " + bestEvaluatedDescription); + logger.info("solution : " + bestEvaluatedDescription.getDescription().toManchesterSyntaxString(baseURI, prefixes) + "(acc: " + bestEvaluatedDescription.getAccuracy() + ")"); isRunning = false; } @@ -231,12 +261,13 @@ // TODO: define "too weak" as a coverage on negative examples, which is // too high for the tree to be considered + if(score != Double.NEGATIVE_INFINITY) { + candidates.add(node); + } - candidates.add(node); - // check whether this is the best tree if(score > bestCurrentScore) { - bestCurrentTree = descriptionTree; + bestCurrentNode = node; bestCurrentScore = score; } } @@ -259,8 +290,11 @@ // penalty if a minimum coverage is not achieved (avoids too many trees where // each tree has only little impact) - if(startPosExamplesSize > 10 && posCovered<3 || posCovered < 1) { - score -= 10; + if((startPosExamplesSize > 10 && posCovered<3) || posCovered < 1) { +// score -= 100; + // further refining such a tree will not cover more positives + // => reject + return Double.NEGATIVE_INFINITY; } // test coverage on current negative examples @@ -273,16 +307,25 @@ } // double negPercentage = negCovered/(double)currentNegExamples.size(); + // remove - does not make sense + // check whether tree is too weak, i.e. covers more than noise % negatives +// int maxNegCov = (int) Math.round(noise * currentNegExamples.size()); +// if(negCovered > maxNegCov) { +// return Double.NEGATIVE_INFINITY; +// } + // length penalty score -= 0.1*tree.getSize(); +// System.out.println("score: " + score); + return score; } private boolean treeCriteriaSatisfied() { long runTime = System.nanoTime() - treeStartTime; // more than one second has passed - if(runTime / 1000000000 > 1) { + if(runTime / (double) 1000000000 >= 10) { return true; } else { return false; Modified: trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java 2009-06-25 10:17:14 UTC (rev 1808) +++ trunk/src/dl-learner/org/dllearner/core/configurators/ComponentFactory.java 2009-06-25 16:56:18 UTC (rev 1809) @@ -26,6 +26,7 @@ import org.dllearner.algorithms.RandomGuesser; import org.dllearner.algorithms.celoe.CELOE; import org.dllearner.algorithms.el.ELLearningAlgorithm; +import org.dllearner.algorithms.el.ELLearningAlgorithmDisjunctive; import org.dllearner.algorithms.gp.GP; import org.dllearner.algorithms.refinement.ROLearner; import org.dllearner.algorithms.refinement2.ROLComponent2; @@ -208,6 +209,16 @@ * @param learningProblem see LearningProblem * @param reasoningService see ReasoningService * @throws LearningProblemUnsupportedException see +* @return a component ready for initialization ELLearningAlgorithmDisjunctive +**/ +public static ELLearningAlgorithmDisjunctive getELLearningAlgorithmDisjunctive(LearningProblem learningProblem, ReasonerComponent reasoningService) throws LearningProblemUnsupportedException { +return ELLearningAlgorithmDisjunctiveConfigurator.getELLearningAlgorithmDisjunctive(learningProblem, reasoningService); +} + +/** +* @param learningProblem see LearningProblem +* @param reasoningService see ReasoningService +* @throws LearningProblemUnsupportedException see * @return a component ready for initialization GP **/ public static GP getGP(LearningProblem learningProblem, ReasonerComponent reasoningService) throws LearningProblemUnsupportedException { Added: trunk/src/dl-learner/org/dllearner/core/configurators/ELLearningAlgorithmDisjunctiveConfigurator.java =================================================================== --- trunk/src/dl-learner/org/dllearner/core/configurators/ELLearningAlgorithmDisjunctiveConfigurator.java (rev 0) +++ trunk/src/dl-learner/org/dllearner/core/configurators/ELLearningAlgorithmDisjunctiveConfigurator.java 2009-06-25 16:56:18 UTC (rev 1809) @@ -0,0 +1,105 @@ +/** + * Copyright (C) 2007-2008, Jens Lehmann + * + * This file is part of DL-Learner. + * + * DL-Learner is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * DL-Learner is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + */ + +package org.dllearner.core.configurators; + +import org.dllearner.algorithms.el.ELLearningAlgorithmDisjunctive; +import org.dllearner.core.ComponentManager; +import org.dllearner.core.LearningProblem; +import org.dllearner.core.LearningProblemUnsupportedException; +import org.dllearner.core.ReasonerComponent; + +/** +* automatically generated, do not edit manually. +* run org.dllearner.scripts.ConfigJavaGenerator to update +**/ +public class ELLearningAlgorithmDisjunctiveConfigurator implements Configurator { + +private boolean reinitNecessary = false; +@SuppressWarnings("unused") + +private ELLearningAlgorithmDisjunctive eLLearningAlgorithmDisjunctive; + +/** +* @param eLLearningAlgorithmDisjunctive see ELLearningAlgorithmDisjunctive +**/ +public ELLearningAlgorithmDisjunctiveConfigurator(ELLearningAlgorithmDisjunctive eLLearningAlgorithmDisjunctive){ +this.eLLearningAlgorithmDisjunctive = eLLearningAlgorithmDisjunctive; +} + +/** +* @param reasoningService see reasoningService +* @param learningProblem see learningProblem +* @throws LearningProblemUnsupportedException see +* @return ELLearningAlgorithmDisjunctive +**/ +public static ELLearningAlgorithmDisjunctive getELLearningAlgorithmDisjunctive(LearningProblem learningProblem, ReasonerComponent reasoningService) throws LearningProblemUnsupportedException{ +ELLearningAlgorithmDisjunctive component = ComponentManager.getInstance().learningAlgorithm(ELLearningAlgorithmDisjunctive.class, learningProblem, reasoningService); +return component; +} + +/** +* noisePercentage the (approximated) percentage of noise within the examples. +* mandatory: false| reinit necessary: true +* default value: 0.0 +* @return double +**/ +public double getNoisePercentage() { +return (Double) ComponentManager.getInstance().getConfigOptionValue(eLLearningAlgorithmDisjunctive, "noisePercentage") ; +} +/** +* startClass the named class which should be used to start the algorithm (GUI: needs a widget for selecting a class). +* mandatory: false| reinit necessary: true +* default value: null +* @return String +**/ +public String getStartClass() { +return (String) ComponentManager.getInstance().getConfigOptionValue(eLLearningAlgorithmDisjunctive, "startClass") ; +} + +/** +* @param noisePercentage the (approximated) percentage of noise within the examples. +* mandatory: false| reinit necessary: true +* default value: 0.0 +**/ +public void setNoisePercentage(double noisePercentage) { +ComponentManager.getInstance().applyConfigEntry(eLLearningAlgorithmDisjunctive, "noisePercentage", noisePercentage); +reinitNecessary = true; +} +/** +* @param startClass the named class which should be used to start the algorithm (GUI: needs a widget for selecting a class). +* mandatory: false| reinit necessary: true +* default value: null +**/ +public void setStartClass(String startClass) { +ComponentManager.getInstance().applyConfigEntry(eLLearningAlgorithmDisjunctive, "startClass", startClass); +reinitNecessary = true; +} + +/** +* true, if this component needs reinitializsation. +* @return boolean +**/ +public boolean isReinitNecessary(){ +return reinitNecessary; +} + + +} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |