# HG changeset patch # User mas01mj # Date 1255000751 0 # Node ID 901803e1305fa355a93168dc1086cef3c7f57b70 # Parent 2eaea1afd6b3340523abd4b49b9a804a9e49a4c7 First instance of audioDB browser code. diff -r 2eaea1afd6b3 -r 901803e1305f examples/browser/export/cat2rdf.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/browser/export/cat2rdf.py Thu Oct 08 11:19:11 2009 +0000 @@ -0,0 +1,152 @@ +#!/usr/bin/python + +import sys +import psycopg2 +import psycopg2.extras + +from rdflib.Graph import ConjunctiveGraph as Graph +from rdflib import Namespace, Literal, URIRef, BNode, RDF + +catalogue = sys.argv[1] + +foaf = Namespace("http://xmlns.com/foaf/0.1/") +mo = Namespace("http://purl.org/ontology/mo/") +mb_artist = Namespace("http://dbtune.org/musicbrainz/resource/artist/") +dc = Namespace("http://purl.org/dc/elements/1.1/") +default_graph_uri = "http://omras2.gold.ac.uk/catalogue/"+catalogue.lower() + +username = "USERNAME" +host = "HOST" +database = "DATABASE" + +counters = {} +namespaces = {} + +def loadCatalogue(catalogue): + try: + conn = psycopg2.connect("dbname='"+database+"' user='"+username+"' host='"+host+"'"); + except: + print "Unable to connect to the database" + + cursor = conn.cursor(cursor_factory=psycopg2.extras.DictCursor) + + cursor.execute("""SELECT * from media WHERE catalogue LIKE '"""+catalogue+"""'""") + + rows = cursor.fetchall() + + return rows + +def createGraph(rows): + albums = {} + + artists = { + 'Madonna': mb_artist['79239441-bfd5-4981-a70c-55c3f15c1287'], + 'John Coltrane': mb_artist['b625448e-bf4a-41c3-a421-72ad46cdb831'], + 'Miles Davis' : mb_artist['561d854a-6a28-4aa7-8c99-323e6ce46c2a']} + + counter = 1 + for row in rows: + graph = Graph(identifier = URIRef(default_graph_uri)) + + # Create all the relevant nodes (with the correct IDs) + + work = getNewNode('work') + composition = getNewNode('composition') + track = getNewNode('track') + signal = getNewNode('signal') + record = getNewNode('record') + performance = getNewNode('performance') + + # If we don't have an artist url, make a foaf Agent instead. + if row['artist']: + try: + artist = artists[row['artist']] + except KeyError: + artist = getNewNode('artist') + graph.add((artist, RDF.type, foaf['Agent'])) + graph.add((artist, foaf['name'], Literal(row['artist'].strip()))) + artists[row['artist']] = artist; + + if row['composer']: + try: + composer = artists[row['composer']] + except KeyError: + composer = getNewNode('artist') + graph.add((composer, RDF.type, foaf['Agent'])) + graph.add((composer, foaf['name'], Literal(row['composer'].strip()))) + artists[row['composer']] = composer; + else: + composer = artist + + + # Work + graph.add((work, RDF.type, mo['MusicalWork'])) + + # Composition + graph.add((composition, RDF.type, mo['Composition'])) + if composer: + graph.add((composition, mo['composer'], composer)) + graph.add((composition, mo['produced_work'], work)) + + # Track + graph.add((track, RDF.type, mo['Track'])) + if row['artist']: + graph.add((track, foaf['maker'], artist)) + if row['tracknum']: + graph.add((track, mo['track_number'], Literal(row['tracknum']))) + + # Album + try: + album = albums[row['album']] + except KeyError: + album = getNewNode('album') + graph.add((album, RDF.type, mo['Record'])) + graph.add((album, dc['title'], Literal(row['album'].strip()))) + graph.add((album, mo['release_type'], mo['album'])) + albums[row['album']] = album + graph.add((album, mo['track'], track)) + + # Signal + graph.add((signal, RDF.type, mo['Signal'])) + graph.add((signal, mo['published_as'], record)) + + if row['track']: + graph.add((signal, dc['title'], Literal(row['track'].strip()))) + if row['isrc']: + graph.add((signal, mo['isrc'], Literal(row['isrc'].strip()))) + + # Record + graph.add((record, RDF.type, mo['Record'])) + graph.add((record, mo['publication_of'], signal)) + graph.add((record, mo['track'], track)) + + # Performance + graph.add((performance, RDF.type, mo['Performance'])) + graph.add((performance, mo['performance_of'], work)) + if row['artist']: + graph.add((performance, mo['performer'], artist)) + graph.add((performance, mo['recorded_as'], signal)) + + #graph.close() + + graph.serialize(format='xml',destination="output/"+catalogue.lower()+"_"+str(counter)+".rdf") + counter += 1 + +def getNewNode(type): + try: + count = counters[type] + except KeyError: + counters[type] = 1 + count = counters[type] + + try: + namespace = namespaces[type] + except KeyError: + namespaces[type] = Namespace(default_graph_uri+"/"+type+"/") + namespace = namespaces[type] + + node = namespace[str(count)] + counters[type] += 1 + return node + +createGraph(loadCatalogue(catalogue)) diff -r 2eaea1afd6b3 -r 901803e1305f examples/browser/ontology/audiodb.owl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/browser/ontology/audiodb.owl Thu Oct 08 11:19:11 2009 +0000 @@ -0,0 +1,71 @@ + + + + + + + + + +]> + + + + + + + + AudioDB Ontology + AudioDB Ontology + Describes the contents of an AudioDB instance + Michael O. Jewell (mailto:mas01mj@gold.ac.uk) + 2009-10-07 + 0.1 + + + + AudioDB + Represents a collection of extracted features and information about their extraction. + + + + + Feature + Information about an audio feature + + + + Window Type + This property indicates that there is some no link between the named Expressions + + + + + + + Chromogram Feature + Information about an audio feature + + + + + MFCC Feature + Information about an audio feature + + + + + CQT Feature + Information about an audio feature + + + + diff -r 2eaea1afd6b3 -r 901803e1305f examples/browser/web/css/data_table.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/browser/web/css/data_table.css Thu Oct 08 11:19:11 2009 +0000 @@ -0,0 +1,447 @@ +/* + * File: demo_table.css + * CVS: $Id$ + * Description: CSS descriptions for DataTables demo pages + * Author: Allan Jardine + * Created: Tue May 12 06:47:22 BST 2009 + * Modified: $Date$ by $Author$ + * Language: CSS + * Project: DataTables + * + * Copyright 2009 Allan Jardine. All Rights Reserved. + * + * *************************************************************************** + * DESCRIPTION + * + * The styles given here are suitable for the demos that are used with the standard DataTables + * distribution (see www.datatables.net). You will most likely wish to modify these styles to + * meet the layout requirements of your site. + * + * Common issues: + * 'full_numbers' pagination - I use an extra selector on the body tag to ensure that there is + * no conflict between the two pagination types. If you want to use full_numbers pagination + * ensure that you either have "example_alt_pagination" as a body class name, or better yet, + * modify that selector. + * Note that the path used for Images is relative. All images are by default located in + * ../images/ - relative to this CSS file. + */ + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * DataTables features + */ + +.dataTables_wrapper { + position: relative; + min-height: 302px; + _height: 302px; + clear: both; +} + +.dataTables_processing { + position: absolute; + top: 0px; + left: 50%; + width: 250px; + margin-left: -125px; + border: 1px solid #ddd; + text-align: center; + color: #999; + font-size: 11px; + padding: 2px 0; +} + +.dataTables_length { + width: 40%; + float: left; +} + +.dataTables_filter { + width: 50%; + float: right; + text-align: right; +} + +.dataTables_info { + width: 60%; + float: left; +} + +.dataTables_paginate { + width: 44px; + * width: 50px; + float: right; + text-align: right; +} + +/* Pagination nested */ +.paginate_disabled_previous, .paginate_enabled_previous, .paginate_disabled_next, .paginate_enabled_next { + height: 19px; + width: 19px; + margin-left: 3px; + float: left; +} + +.paginate_disabled_previous { + background-image: url('../img/back_disabled.jpg'); +} + +.paginate_enabled_previous { + background-image: url('../img/back_enabled.jpg'); +} + +.paginate_disabled_next { + background-image: url('../img/forward_disabled.jpg'); +} + +.paginate_enabled_next { + background-image: url('../img/forward_enabled.jpg'); +} + + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * DataTables display + */ +table.display { + margin: 0 auto; + width: 100%; + clear: both; +} + +table.display thead th { + padding: 3px 18px 3px 10px; + border-bottom: 1px solid black; + font-weight: bold; + cursor: pointer; + * cursor: hand; +} + +table.display tfoot th { + padding: 3px 10px; + border-top: 1px solid black; + font-weight: bold; +} + +table.display tr.heading2 td { + border-bottom: 1px solid #aaa; +} + +table.display td { + padding: 3px 10px; +} + +table.display td.center { + text-align: center; +} + + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * DataTables sorting + */ + +.sorting_asc { + background: url('../img/sort_asc.jpg') no-repeat center right; +} + +.sorting_desc { + background: url('../img/sort_desc.jpg') no-repeat center right; +} + +.sorting { + background: url('../img/sort_both.jpg') no-repeat center right; +} + + + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * DataTables row classes + */ +table.display tr.odd.gradeA { + background-color: #ddffdd; +} + +table.display tr.even.gradeA { + background-color: #eeffee; +} + + + + +table.display tr.odd.gradeA { + background-color: #ddffdd; +} + +table.display tr.even.gradeA { + background-color: #eeffee; +} + +table.display tr.odd.gradeC { + background-color: #ddddff; +} + +table.display tr.even.gradeC { + background-color: #eeeeff; +} + +table.display tr.odd.gradeX { + background-color: #ffdddd; +} + +table.display tr.even.gradeX { + background-color: #ffeeee; +} + +table.display tr.odd.gradeU { + background-color: #ddd; +} + +table.display tr.even.gradeU { + background-color: #eee; +} + + +tr.odd { + background-color: #E2E4FF; +} + +tr.even { + background-color: white; +} + + + + + +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Misc + */ +.top, .bottom { + padding: 15px; + background-color: #F5F5F5; + border: 1px solid #CCCCCC; +} + +.top .dataTables_info { + float: none; +} + +.clear { + clear: both; +} + +.dataTables_empty { + text-align: center; +} + +tfoot input { + margin: 0.5em 0; + width: 100%; + color: #444; +} + +tfoot input.search_init { + color: #999; +} + +td.group { + background-color: #d1cfd0; + border-bottom: 2px solid #A19B9E; + border-top: 2px solid #A19B9E; +} + +td.details { + background-color: #d1cfd0; + border: 2px solid #A19B9E; +} + + +.example_alt_pagination div.dataTables_info { + width: 40%; +} + +.paging_full_numbers { + width: 400px; + height: 22px; + line-height: 22px; +} + +.paging_full_numbers span.paginate_button, + .paging_full_numbers span.paginate_active { + border: 1px solid #aaa; + -webkit-border-radius: 5px; + -moz-border-radius: 5px; + padding: 2px 5px; + margin: 0 3px; + cursor: pointer; + *cursor: hand; +} + +.paging_full_numbers span.paginate_button { + background-color: #ddd; +} + +.paging_full_numbers span.paginate_button:hover { + background-color: #ccc; +} + +.paging_full_numbers span.paginate_active { + background-color: #99B3FF; +} + +table.display tr.even.row_selected td { + background-color: #B0BED9; +} + +table.display tr.odd.row_selected td { + background-color: #9FAFD1; +} + + +/* + * Sorting classes for columns + */ +/* For the standard odd/even */ +tr.odd td.sorting_1 { + background-color: #D3D6FF; +} + +tr.odd td.sorting_2 { + background-color: #DADCFF; +} + +tr.odd td.sorting_3 { + background-color: #E0E2FF; +} + +tr.even td.sorting_1 { + background-color: #EAEBFF; +} + +tr.even td.sorting_2 { + background-color: #F2F3FF; +} + +tr.even td.sorting_3 { + background-color: #F9F9FF; +} + + +/* For the Conditional-CSS grading rows */ +/* + Colour calculations (based off the main row colours) + Level 1: + dd > c4 + ee > d5 + Level 2: + dd > d1 + ee > e2 + */ +tr.odd.gradeA td.sorting_1 { + background-color: #c4ffc4; +} + +tr.odd.gradeA td.sorting_2 { + background-color: #d1ffd1; +} + +tr.odd.gradeA td.sorting_3 { + background-color: #d1ffd1; +} + +tr.even.gradeA td.sorting_1 { + background-color: #d5ffd5; +} + +tr.even.gradeA td.sorting_2 { + background-color: #e2ffe2; +} + +tr.even.gradeA td.sorting_3 { + background-color: #e2ffe2; +} + +tr.odd.gradeC td.sorting_1 { + background-color: #c4c4ff; +} + +tr.odd.gradeC td.sorting_2 { + background-color: #d1d1ff; +} + +tr.odd.gradeC td.sorting_3 { + background-color: #d1d1ff; +} + +tr.even.gradeC td.sorting_1 { + background-color: #d5d5ff; +} + +tr.even.gradeC td.sorting_2 { + background-color: #e2e2ff; +} + +tr.even.gradeC td.sorting_3 { + background-color: #e2e2ff; +} + +tr.odd.gradeX td.sorting_1 { + background-color: #ffc4c4; +} + +tr.odd.gradeX td.sorting_2 { + background-color: #ffd1d1; +} + +tr.odd.gradeX td.sorting_3 { + background-color: #ffd1d1; +} + +tr.even.gradeX td.sorting_1 { + background-color: #ffd5d5; +} + +tr.even.gradeX td.sorting_2 { + background-color: #ffe2e2; +} + +tr.even.gradeX td.sorting_3 { + background-color: #ffe2e2; +} + +tr.odd.gradeU td.sorting_1 { + background-color: #c4c4c4; +} + +tr.odd.gradeU td.sorting_2 { + background-color: #d1d1d1; +} + +tr.odd.gradeU td.sorting_3 { + background-color: #d1d1d1; +} + +tr.even.gradeU td.sorting_1 { + background-color: #d5d5d5; +} + +tr.even.gradeU td.sorting_2 { + background-color: #e2e2e2; +} + +tr.even.gradeU td.sorting_3 { + background-color: #e2e2e2; +} + + +/* + * Row highlighting example + */ +.ex_highlight #example tbody tr.even:hover, #example tbody tr.even td.highlighted { + background-color: #ECFFB3; +} + +.ex_highlight #example tbody tr.odd:hover, #example tbody tr.odd td.highlighted { + background-color: #E6FF99; +} diff -r 2eaea1afd6b3 -r 901803e1305f examples/browser/web/css/jOWL.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/browser/web/css/jOWL.css Thu Oct 08 11:19:11 2009 +0000 @@ -0,0 +1,47 @@ +/** +* jOWL CSS Generic Style Settings. +* Creator - David Decraene +* Version 1.0 +* http://jowl.ontologyonline.org +*/ + +/** bordered box */ +.ui-widget-content {border:1px solid steelblue;text-align:center;} +/** shaded titlebar */ +.ui-dialog-titlebar {margin:0px;padding:3px;text-align:center;background-color:#F8F8FF} + +.jowl-content {padding:5px;min-height:200px;} + +/** jowl-navbar */ +.jowl-navbar span {margin-right:5px;cursor:pointer;} +.jowl-navbar div {margin-bottom:5px;} +.jowl-navbar .external {font-weight:bold;color:red;font-style:italic;} + +/** jowl_autocomplete */ +.jowl_autocomplete_results{ + display:none;min-height:20px;text-align:left;width:250px;z-index:20;position:absolute; + border: 1px solid WindowFrame; background-color: Window; + list-style-position: outside; list-style: none; margin: 0px;padding-left:0px; + } +.jowl_autocomplete_results li {margin: 0px;cursor: pointer;display: block;font: menu;font-size: 12px;padding: 2px 5px;margin-bottom:2px;} +.jowl_autocomplete_results .type{font-style:italic;float:right} +.jowl_autocomplete_results .termlabel{font-size:8px} +.jowl_autocomplete_results .name{font-weight:bold} + +/*Treeview*/ +.jowl-tree {text-align: left} +.jowl-treeview{list-style-type: none;} +.jowl-treeview .root > .name{ font-weight:bold;} +.jowl-treeview .focus>.name{font-weight:bold;color:steelblue} +.jowl-treeview ul.tv, .jowl-treeview .tv ul { list-style-image:none; list-style-position:outside; list-style-type:none; margin:0pt; padding:0pt; } +.jowl-treeview .tv li { margin:0pt; padding:1px 0pt 3px 20px; position:relative; z-index:10; } +.jowl-treeview .tvie .name, .jowl-treeview .tvic .name, .jowl-treeview .tvilc .name, .jowl-treeview .tvile .name, .jowl-treeview .root .name { cursor:pointer; position:relative;} +.jowl-treeview .tv li, .jowl-treeview .tv .tvi { background:transparent url(../img/treeView/dotted/tvi.gif) no-repeat scroll top left;} +.jowl-treeview .tv .tvic { background-image:url(../img/treeView/dotted/tvic.gif) ;} +.jowl-treeview .tv .tvie { background-image:url(../img/treeView/dotted/tvie.gif); } +.jowl-treeview .tv .tvil { background-image:url(../img/treeView/dotted/tvil.gif); } +.jowl-treeview .tv .tvilc { background-image:url(../img/treeView/dotted/tvilc.gif); } +.jowl-treeview .tv .tvile { background-image:url(../img/treeView/dotted/tvile.gif); } +.jowl-treeview .tvload { background-image:url(../img/treeView/dotted/tviload.gif);} + + diff -r 2eaea1afd6b3 -r 901803e1305f examples/browser/web/css/jq/custom-theme/images/ui-bg_flat_0_aaaaaa_40x100.png Binary file examples/browser/web/css/jq/custom-theme/images/ui-bg_flat_0_aaaaaa_40x100.png has changed diff -r 2eaea1afd6b3 -r 901803e1305f examples/browser/web/css/jq/custom-theme/images/ui-bg_glass_55_fbf9ee_1x400.png Binary file examples/browser/web/css/jq/custom-theme/images/ui-bg_glass_55_fbf9ee_1x400.png has changed diff -r 2eaea1afd6b3 -r 901803e1305f examples/browser/web/css/jq/custom-theme/images/ui-bg_glass_65_ffffff_1x400.png Binary file examples/browser/web/css/jq/custom-theme/images/ui-bg_glass_65_ffffff_1x400.png has changed diff -r 2eaea1afd6b3 -r 901803e1305f examples/browser/web/css/jq/custom-theme/images/ui-bg_glass_75_dadada_1x400.png Binary file examples/browser/web/css/jq/custom-theme/images/ui-bg_glass_75_dadada_1x400.png has changed diff -r 2eaea1afd6b3 -r 901803e1305f examples/browser/web/css/jq/custom-theme/images/ui-bg_glass_75_e6e6e6_1x400.png Binary file examples/browser/web/css/jq/custom-theme/images/ui-bg_glass_75_e6e6e6_1x400.png has changed diff -r 2eaea1afd6b3 -r 901803e1305f examples/browser/web/css/jq/custom-theme/images/ui-bg_glass_75_ffffff_1x400.png Binary file examples/browser/web/css/jq/custom-theme/images/ui-bg_glass_75_ffffff_1x400.png has changed diff -r 2eaea1afd6b3 -r 901803e1305f examples/browser/web/css/jq/custom-theme/images/ui-bg_highlight-soft_75_cccccc_1x100.png Binary file examples/browser/web/css/jq/custom-theme/images/ui-bg_highlight-soft_75_cccccc_1x100.png has changed diff -r 2eaea1afd6b3 -r 901803e1305f examples/browser/web/css/jq/custom-theme/images/ui-bg_inset-soft_95_fef1ec_1x100.png Binary file examples/browser/web/css/jq/custom-theme/images/ui-bg_inset-soft_95_fef1ec_1x100.png has changed diff -r 2eaea1afd6b3 -r 901803e1305f examples/browser/web/css/jq/custom-theme/images/ui-icons_222222_256x240.png Binary file examples/browser/web/css/jq/custom-theme/images/ui-icons_222222_256x240.png has changed diff -r 2eaea1afd6b3 -r 901803e1305f examples/browser/web/css/jq/custom-theme/images/ui-icons_2e83ff_256x240.png Binary file examples/browser/web/css/jq/custom-theme/images/ui-icons_2e83ff_256x240.png has changed diff -r 2eaea1afd6b3 -r 901803e1305f examples/browser/web/css/jq/custom-theme/images/ui-icons_454545_256x240.png Binary file examples/browser/web/css/jq/custom-theme/images/ui-icons_454545_256x240.png has changed diff -r 2eaea1afd6b3 -r 901803e1305f examples/browser/web/css/jq/custom-theme/images/ui-icons_888888_256x240.png Binary file examples/browser/web/css/jq/custom-theme/images/ui-icons_888888_256x240.png has changed diff -r 2eaea1afd6b3 -r 901803e1305f examples/browser/web/css/jq/custom-theme/images/ui-icons_cd0a0a_256x240.png Binary file examples/browser/web/css/jq/custom-theme/images/ui-icons_cd0a0a_256x240.png has changed diff -r 2eaea1afd6b3 -r 901803e1305f examples/browser/web/css/jq/custom-theme/jquery-ui-1.7.custom.css --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/browser/web/css/jq/custom-theme/jquery-ui-1.7.custom.css Thu Oct 08 11:19:11 2009 +0000 @@ -0,0 +1,408 @@ +/* +* jQuery UI CSS Framework +* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) +* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses. +*/ + +/* Layout helpers +----------------------------------*/ +.ui-helper-hidden { display: none; } +.ui-helper-hidden-accessible { position: absolute; left: -99999999px; } +.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; } +.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } +.ui-helper-clearfix { display: inline-block; } +/* required comment for clearfix to work in Opera \*/ +* html .ui-helper-clearfix { height:1%; } +.ui-helper-clearfix { display:block; } +/* end clearfix */ +.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); } + + +/* Interaction Cues +----------------------------------*/ +.ui-state-disabled { cursor: default !important; } + + +/* Icons +----------------------------------*/ + +/* states and images */ +.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; } + + +/* Misc visuals +----------------------------------*/ + +/* Overlays */ +.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } + +/* +* jQuery UI CSS Framework +* Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about) +* Dual licensed under the MIT (MIT-LICENSE.txt) and GPL (GPL-LICENSE.txt) licenses. +* To view and modify this theme, visit http://jqueryui.com/themeroller/?ctl=themeroller +*/ + + +/* Component containers +----------------------------------*/ +.ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; } +.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; } +.ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_glass_75_ffffff_1x400.png) 50% 50% repeat-x; color: #222222; } +.ui-widget-content a { color: #222222; } +.ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; } +.ui-widget-header a { color: #222222; } + +/* Interaction states +----------------------------------*/ +.ui-state-default, .ui-widget-content .ui-state-default { border: 1px solid #d3d3d3; background: #e6e6e6 url(images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #555555; outline: none; } +.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555; text-decoration: none; outline: none; } +.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus { border: 1px solid #999999; background: #dadada url(images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; outline: none; } +.ui-state-hover a, .ui-state-hover a:hover { color: #212121; text-decoration: none; outline: none; } +.ui-state-active, .ui-widget-content .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; outline: none; } +.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121; outline: none; text-decoration: none; } + +/* Interaction Cues +----------------------------------*/ +.ui-state-highlight, .ui-widget-content .ui-state-highlight {border: 1px solid #fcefa1; background: #fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x; color: #363636; } +.ui-state-highlight a, .ui-widget-content .ui-state-highlight a { color: #363636; } +.ui-state-error, .ui-widget-content .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_inset-soft_95_fef1ec_1x100.png) 50% bottom repeat-x; color: #cd0a0a; } +.ui-state-error a, .ui-widget-content .ui-state-error a { color: #cd0a0a; } +.ui-state-error-text, .ui-widget-content .ui-state-error-text { color: #cd0a0a; } +.ui-state-disabled, .ui-widget-content .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; } +.ui-priority-primary, .ui-widget-content .ui-priority-primary { font-weight: bold; } +.ui-priority-secondary, .ui-widget-content .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; } + +/* Icons +----------------------------------*/ + +/* states and images */ +.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); } +.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); } +.ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); } +.ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png); } +.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); } +.ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); } +.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); } +.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); } + +/* positioning */ +.ui-icon-carat-1-n { background-position: 0 0; } +.ui-icon-carat-1-ne { background-position: -16px 0; } +.ui-icon-carat-1-e { background-position: -32px 0; } +.ui-icon-carat-1-se { background-position: -48px 0; } +.ui-icon-carat-1-s { background-position: -64px 0; } +.ui-icon-carat-1-sw { background-position: -80px 0; } +.ui-icon-carat-1-w { background-position: -96px 0; } +.ui-icon-carat-1-nw { background-position: -112px 0; } +.ui-icon-carat-2-n-s { background-position: -128px 0; } +.ui-icon-carat-2-e-w { background-position: -144px 0; } +.ui-icon-triangle-1-n { background-position: 0 -16px; } +.ui-icon-triangle-1-ne { background-position: -16px -16px; } +.ui-icon-triangle-1-e { background-position: -32px -16px; } +.ui-icon-triangle-1-se { background-position: -48px -16px; } +.ui-icon-triangle-1-s { background-position: -64px -16px; } +.ui-icon-triangle-1-sw { background-position: -80px -16px; } +.ui-icon-triangle-1-w { background-position: -96px -16px; } +.ui-icon-triangle-1-nw { background-position: -112px -16px; } +.ui-icon-triangle-2-n-s { background-position: -128px -16px; } +.ui-icon-triangle-2-e-w { background-position: -144px -16px; } +.ui-icon-arrow-1-n { background-position: 0 -32px; } +.ui-icon-arrow-1-ne { background-position: -16px -32px; } +.ui-icon-arrow-1-e { background-position: -32px -32px; } +.ui-icon-arrow-1-se { background-position: -48px -32px; } +.ui-icon-arrow-1-s { background-position: -64px -32px; } +.ui-icon-arrow-1-sw { background-position: -80px -32px; } +.ui-icon-arrow-1-w { background-position: -96px -32px; } +.ui-icon-arrow-1-nw { background-position: -112px -32px; } +.ui-icon-arrow-2-n-s { background-position: -128px -32px; } +.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; } +.ui-icon-arrow-2-e-w { background-position: -160px -32px; } +.ui-icon-arrow-2-se-nw { background-position: -176px -32px; } +.ui-icon-arrowstop-1-n { background-position: -192px -32px; } +.ui-icon-arrowstop-1-e { background-position: -208px -32px; } +.ui-icon-arrowstop-1-s { background-position: -224px -32px; } +.ui-icon-arrowstop-1-w { background-position: -240px -32px; } +.ui-icon-arrowthick-1-n { background-position: 0 -48px; } +.ui-icon-arrowthick-1-ne { background-position: -16px -48px; } +.ui-icon-arrowthick-1-e { background-position: -32px -48px; } +.ui-icon-arrowthick-1-se { background-position: -48px -48px; } +.ui-icon-arrowthick-1-s { background-position: -64px -48px; } +.ui-icon-arrowthick-1-sw { background-position: -80px -48px; } +.ui-icon-arrowthick-1-w { background-position: -96px -48px; } +.ui-icon-arrowthick-1-nw { background-position: -112px -48px; } +.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; } +.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; } +.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; } +.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; } +.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; } +.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; } +.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; } +.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; } +.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; } +.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; } +.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; } +.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; } +.ui-icon-arrowreturn-1-w { background-position: -64px -64px; } +.ui-icon-arrowreturn-1-n { background-position: -80px -64px; } +.ui-icon-arrowreturn-1-e { background-position: -96px -64px; } +.ui-icon-arrowreturn-1-s { background-position: -112px -64px; } +.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; } +.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; } +.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; } +.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; } +.ui-icon-arrow-4 { background-position: 0 -80px; } +.ui-icon-arrow-4-diag { background-position: -16px -80px; } +.ui-icon-extlink { background-position: -32px -80px; } +.ui-icon-newwin { background-position: -48px -80px; } +.ui-icon-refresh { background-position: -64px -80px; } +.ui-icon-shuffle { background-position: -80px -80px; } +.ui-icon-transfer-e-w { background-position: -96px -80px; } +.ui-icon-transferthick-e-w { background-position: -112px -80px; } +.ui-icon-folder-collapsed { background-position: 0 -96px; } +.ui-icon-folder-open { background-position: -16px -96px; } +.ui-icon-document { background-position: -32px -96px; } +.ui-icon-document-b { background-position: -48px -96px; } +.ui-icon-note { background-position: -64px -96px; } +.ui-icon-mail-closed { background-position: -80px -96px; } +.ui-icon-mail-open { background-position: -96px -96px; } +.ui-icon-suitcase { background-position: -112px -96px; } +.ui-icon-comment { background-position: -128px -96px; } +.ui-icon-person { background-position: -144px -96px; } +.ui-icon-print { background-position: -160px -96px; } +.ui-icon-trash { background-position: -176px -96px; } +.ui-icon-locked { background-position: -192px -96px; } +.ui-icon-unlocked { background-position: -208px -96px; } +.ui-icon-bookmark { background-position: -224px -96px; } +.ui-icon-tag { background-position: -240px -96px; } +.ui-icon-home { background-position: 0 -112px; } +.ui-icon-flag { background-position: -16px -112px; } +.ui-icon-calendar { background-position: -32px -112px; } +.ui-icon-cart { background-position: -48px -112px; } +.ui-icon-pencil { background-position: -64px -112px; } +.ui-icon-clock { background-position: -80px -112px; } +.ui-icon-disk { background-position: -96px -112px; } +.ui-icon-calculator { background-position: -112px -112px; } +.ui-icon-zoomin { background-position: -128px -112px; } +.ui-icon-zoomout { background-position: -144px -112px; } +.ui-icon-search { background-position: -160px -112px; } +.ui-icon-wrench { background-position: -176px -112px; } +.ui-icon-gear { background-position: -192px -112px; } +.ui-icon-heart { background-position: -208px -112px; } +.ui-icon-star { background-position: -224px -112px; } +.ui-icon-link { background-position: -240px -112px; } +.ui-icon-cancel { background-position: 0 -128px; } +.ui-icon-plus { background-position: -16px -128px; } +.ui-icon-plusthick { background-position: -32px -128px; } +.ui-icon-minus { background-position: -48px -128px; } +.ui-icon-minusthick { background-position: -64px -128px; } +.ui-icon-close { background-position: -80px -128px; } +.ui-icon-closethick { background-position: -96px -128px; } +.ui-icon-key { background-position: -112px -128px; } +.ui-icon-lightbulb { background-position: -128px -128px; } +.ui-icon-scissors { background-position: -144px -128px; } +.ui-icon-clipboard { background-position: -160px -128px; } +.ui-icon-copy { background-position: -176px -128px; } +.ui-icon-contact { background-position: -192px -128px; } +.ui-icon-image { background-position: -208px -128px; } +.ui-icon-video { background-position: -224px -128px; } +.ui-icon-script { background-position: -240px -128px; } +.ui-icon-alert { background-position: 0 -144px; } +.ui-icon-info { background-position: -16px -144px; } +.ui-icon-notice { background-position: -32px -144px; } +.ui-icon-help { background-position: -48px -144px; } +.ui-icon-check { background-position: -64px -144px; } +.ui-icon-bullet { background-position: -80px -144px; } +.ui-icon-radio-off { background-position: -96px -144px; } +.ui-icon-radio-on { background-position: -112px -144px; } +.ui-icon-pin-w { background-position: -128px -144px; } +.ui-icon-pin-s { background-position: -144px -144px; } +.ui-icon-play { background-position: 0 -160px; } +.ui-icon-pause { background-position: -16px -160px; } +.ui-icon-seek-next { background-position: -32px -160px; } +.ui-icon-seek-prev { background-position: -48px -160px; } +.ui-icon-seek-end { background-position: -64px -160px; } +.ui-icon-seek-first { background-position: -80px -160px; } +.ui-icon-stop { background-position: -96px -160px; } +.ui-icon-eject { background-position: -112px -160px; } +.ui-icon-volume-off { background-position: -128px -160px; } +.ui-icon-volume-on { background-position: -144px -160px; } +.ui-icon-power { background-position: 0 -176px; } +.ui-icon-signal-diag { background-position: -16px -176px; } +.ui-icon-signal { background-position: -32px -176px; } +.ui-icon-battery-0 { background-position: -48px -176px; } +.ui-icon-battery-1 { background-position: -64px -176px; } +.ui-icon-battery-2 { background-position: -80px -176px; } +.ui-icon-battery-3 { background-position: -96px -176px; } +.ui-icon-circle-plus { background-position: 0 -192px; } +.ui-icon-circle-minus { background-position: -16px -192px; } +.ui-icon-circle-close { background-position: -32px -192px; } +.ui-icon-circle-triangle-e { background-position: -48px -192px; } +.ui-icon-circle-triangle-s { background-position: -64px -192px; } +.ui-icon-circle-triangle-w { background-position: -80px -192px; } +.ui-icon-circle-triangle-n { background-position: -96px -192px; } +.ui-icon-circle-arrow-e { background-position: -112px -192px; } +.ui-icon-circle-arrow-s { background-position: -128px -192px; } +.ui-icon-circle-arrow-w { background-position: -144px -192px; } +.ui-icon-circle-arrow-n { background-position: -160px -192px; } +.ui-icon-circle-zoomin { background-position: -176px -192px; } +.ui-icon-circle-zoomout { background-position: -192px -192px; } +.ui-icon-circle-check { background-position: -208px -192px; } +.ui-icon-circlesmall-plus { background-position: 0 -208px; } +.ui-icon-circlesmall-minus { background-position: -16px -208px; } +.ui-icon-circlesmall-close { background-position: -32px -208px; } +.ui-icon-squaresmall-plus { background-position: -48px -208px; } +.ui-icon-squaresmall-minus { background-position: -64px -208px; } +.ui-icon-squaresmall-close { background-position: -80px -208px; } +.ui-icon-grip-dotted-vertical { background-position: 0 -224px; } +.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; } +.ui-icon-grip-solid-vertical { background-position: -32px -224px; } +.ui-icon-grip-solid-horizontal { background-position: -48px -224px; } +.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; } +.ui-icon-grip-diagonal-se { background-position: -80px -224px; } + + +/* Misc visuals +----------------------------------*/ + +/* Corner radius */ +.ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; } +.ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; } +.ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; } +.ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; } +.ui-corner-top { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; } +.ui-corner-bottom { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; } +.ui-corner-right { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; } +.ui-corner-left { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; } +.ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; } + +/* Overlays */ +.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); } +.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -webkit-border-radius: 8px; }/* Resizable +----------------------------------*/ +.ui-resizable { position: relative;} +.ui-resizable-handle { position: absolute;font-size: 0.1px;z-index: 99999; display: block;} +.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; } +.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0px; } +.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0px; } +.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0px; height: 100%; } +.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0px; height: 100%; } +.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; } +.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; } +.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; } +.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}/* Accordion +----------------------------------*/ +.ui-accordion .ui-accordion-header { cursor: pointer; position: relative; margin-top: 1px; zoom: 1; } +.ui-accordion .ui-accordion-li-fix { display: inline; } +.ui-accordion .ui-accordion-header-active { border-bottom: 0 !important; } +.ui-accordion .ui-accordion-header a { display: block; font-size: 1em; padding: .5em .5em .5em 2.2em; } +.ui-accordion .ui-accordion-header .ui-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; } +.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; margin-top: -2px; position: relative; top: 1px; margin-bottom: 2px; overflow: auto; display: none; } +.ui-accordion .ui-accordion-content-active { display: block; }/* Dialog +----------------------------------*/ +.ui-dialog { position: relative; padding: .2em; width: 300px; } +.ui-dialog .ui-dialog-titlebar { padding: .5em .3em .3em 1em; position: relative; } +.ui-dialog .ui-dialog-title { float: left; margin: .1em 0 .2em; } +.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; } +.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; } +.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; } +.ui-dialog .ui-dialog-content { border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; } +.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; } +.ui-dialog .ui-dialog-buttonpane button { float: right; margin: .5em .4em .5em 0; cursor: pointer; padding: .2em .6em .3em .6em; line-height: 1.4em; width:auto; overflow:visible; } +.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; } +.ui-draggable .ui-dialog-titlebar { cursor: move; } +/* Slider +----------------------------------*/ +.ui-slider { position: relative; text-align: left; } +.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; } +.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; } + +.ui-slider-horizontal { height: .8em; } +.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; } +.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; } +.ui-slider-horizontal .ui-slider-range-min { left: 0; } +.ui-slider-horizontal .ui-slider-range-max { right: 0; } + +.ui-slider-vertical { width: .8em; height: 100px; } +.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; } +.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; } +.ui-slider-vertical .ui-slider-range-min { bottom: 0; } +.ui-slider-vertical .ui-slider-range-max { top: 0; }/* Tabs +----------------------------------*/ +.ui-tabs { padding: .2em; zoom: 1; } +.ui-tabs .ui-tabs-nav { list-style: none; position: relative; padding: .2em .2em 0; } +.ui-tabs .ui-tabs-nav li { position: relative; float: left; border-bottom-width: 0 !important; margin: 0 .2em -1px 0; padding: 0; } +.ui-tabs .ui-tabs-nav li a { float: left; text-decoration: none; padding: .5em 1em; } +.ui-tabs .ui-tabs-nav li.ui-tabs-selected { padding-bottom: 1px; border-bottom-width: 0; } +.ui-tabs .ui-tabs-nav li.ui-tabs-selected a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-state-processing a { cursor: text; } +.ui-tabs .ui-tabs-nav li a, .ui-tabs.ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-selected a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */ +.ui-tabs .ui-tabs-panel { padding: 1em 1.4em; display: block; border-width: 0; background: none; } +.ui-tabs .ui-tabs-hide { display: none !important; } +/* Datepicker +----------------------------------*/ +.ui-datepicker { width: 17em; padding: .2em .2em 0; } +.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; } +.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; } +.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; } +.ui-datepicker .ui-datepicker-prev { left:2px; } +.ui-datepicker .ui-datepicker-next { right:2px; } +.ui-datepicker .ui-datepicker-prev-hover { left:1px; } +.ui-datepicker .ui-datepicker-next-hover { right:1px; } +.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; } +.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; } +.ui-datepicker .ui-datepicker-title select { float:left; font-size:1em; margin:1px 0; } +.ui-datepicker select.ui-datepicker-month-year {width: 100%;} +.ui-datepicker select.ui-datepicker-month, +.ui-datepicker select.ui-datepicker-year { width: 49%;} +.ui-datepicker .ui-datepicker-title select.ui-datepicker-year { float: right; } +.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; } +.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; } +.ui-datepicker td { border: 0; padding: 1px; } +.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; } +.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; } +.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; } +.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; } + +/* with multiple calendars */ +.ui-datepicker.ui-datepicker-multi { width:auto; } +.ui-datepicker-multi .ui-datepicker-group { float:left; } +.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; } +.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; } +.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; } +.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; } +.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; } +.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; } +.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; } +.ui-datepicker-row-break { clear:both; width:100%; } + +/* RTL support */ +.ui-datepicker-rtl { direction: rtl; } +.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; } +.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; } +.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; } +.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; } +.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; } +.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; } +.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; } +.ui-datepicker-rtl .ui-datepicker-group { float:right; } +.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; } +.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; } + +/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */ +.ui-datepicker-cover { + display: none; /*sorry for IE5*/ + display/**/: block; /*sorry for IE5*/ + position: absolute; /*must have*/ + z-index: -1; /*must have*/ + filter: mask(); /*must have*/ + top: -4px; /*must have*/ + left: -4px; /*must have*/ + width: 200px; /*must have*/ + height: 200px; /*must have*/ +}/* Progressbar +----------------------------------*/ +.ui-progressbar { height:2em; text-align: left; } +.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; } + +#search_options ul { display:table} +#search_options li { display:table-cell; padding: 5px} diff -r 2eaea1afd6b3 -r 901803e1305f examples/browser/web/img/back_disabled.jpg Binary file examples/browser/web/img/back_disabled.jpg has changed diff -r 2eaea1afd6b3 -r 901803e1305f examples/browser/web/img/back_enabled.jpg Binary file examples/browser/web/img/back_enabled.jpg has changed diff -r 2eaea1afd6b3 -r 901803e1305f examples/browser/web/img/forward_disabled.jpg Binary file examples/browser/web/img/forward_disabled.jpg has changed diff -r 2eaea1afd6b3 -r 901803e1305f examples/browser/web/img/forward_enabled.jpg Binary file examples/browser/web/img/forward_enabled.jpg has changed diff -r 2eaea1afd6b3 -r 901803e1305f examples/browser/web/img/sort_asc.jpg Binary file examples/browser/web/img/sort_asc.jpg has changed diff -r 2eaea1afd6b3 -r 901803e1305f examples/browser/web/img/sort_both.jpg Binary file examples/browser/web/img/sort_both.jpg has changed diff -r 2eaea1afd6b3 -r 901803e1305f examples/browser/web/img/sort_desc.jpg Binary file examples/browser/web/img/sort_desc.jpg has changed diff -r 2eaea1afd6b3 -r 901803e1305f examples/browser/web/img/spinner.gif Binary file examples/browser/web/img/spinner.gif has changed diff -r 2eaea1afd6b3 -r 901803e1305f examples/browser/web/img/tooltip/Thumbs.db Binary file examples/browser/web/img/tooltip/Thumbs.db has changed diff -r 2eaea1afd6b3 -r 901803e1305f examples/browser/web/img/tooltip/arrow_left.gif Binary file examples/browser/web/img/tooltip/arrow_left.gif has changed diff -r 2eaea1afd6b3 -r 901803e1305f examples/browser/web/img/tooltip/arrow_right.gif Binary file examples/browser/web/img/tooltip/arrow_right.gif has changed diff -r 2eaea1afd6b3 -r 901803e1305f examples/browser/web/img/tooltip/loader.gif Binary file examples/browser/web/img/tooltip/loader.gif has changed diff -r 2eaea1afd6b3 -r 901803e1305f examples/browser/web/img/treeView/Thumbs.db Binary file examples/browser/web/img/treeView/Thumbs.db has changed diff -r 2eaea1afd6b3 -r 901803e1305f examples/browser/web/img/treeView/dotted/Thumbs.db Binary file examples/browser/web/img/treeView/dotted/Thumbs.db has changed diff -r 2eaea1afd6b3 -r 901803e1305f examples/browser/web/img/treeView/dotted/tvi.gif Binary file examples/browser/web/img/treeView/dotted/tvi.gif has changed diff -r 2eaea1afd6b3 -r 901803e1305f examples/browser/web/img/treeView/dotted/tvic.gif Binary file examples/browser/web/img/treeView/dotted/tvic.gif has changed diff -r 2eaea1afd6b3 -r 901803e1305f examples/browser/web/img/treeView/dotted/tvie.gif Binary file examples/browser/web/img/treeView/dotted/tvie.gif has changed diff -r 2eaea1afd6b3 -r 901803e1305f examples/browser/web/img/treeView/dotted/tvil.gif Binary file examples/browser/web/img/treeView/dotted/tvil.gif has changed diff -r 2eaea1afd6b3 -r 901803e1305f examples/browser/web/img/treeView/dotted/tvilc.gif Binary file examples/browser/web/img/treeView/dotted/tvilc.gif has changed diff -r 2eaea1afd6b3 -r 901803e1305f examples/browser/web/img/treeView/dotted/tvile.gif Binary file examples/browser/web/img/treeView/dotted/tvile.gif has changed diff -r 2eaea1afd6b3 -r 901803e1305f examples/browser/web/img/treeView/dotted/tviload.gif Binary file examples/browser/web/img/treeView/dotted/tviload.gif has changed diff -r 2eaea1afd6b3 -r 901803e1305f examples/browser/web/index.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/browser/web/index.html Thu Oct 08 11:19:11 2009 +0000 @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + +
+
Search Options
+
+
+
    +
  • Artist:
  • +
  • Track:
  • +
  • +
+
+
Searching...
+
+
+ +
+
Search Results
+
+
+ + + + + + + + + + + +
Artist NameTrack NameTrack #Album Name
+
+
+
+
Current Query
+ + + + diff -r 2eaea1afd6b3 -r 901803e1305f examples/browser/web/js/browser.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/browser/web/js/browser.js Thu Oct 08 11:19:11 2009 +0000 @@ -0,0 +1,130 @@ +var sparqler = new SPARQL.Service("http://harrison/sparql/"); + +sparqler.setPrefix("mo", "http://purl.org/ontology/mo/"); +sparqler.setPrefix("foaf", "http://xmlns.com/foaf/0.1/"); +sparqler.setPrefix("dc", "http://purl.org/dc/elements/1.1/"); + +sparqler.setRequestHeader("Accept", "application/json"); + +var resultsTable; + +$(document).ready(function() { + $("#search").click(search) + $("#spinner").hide(); + resultsTable = $('#results').dataTable({"bFilter":false,"bLengthChange":false,"bPaginate":true, + "fnRowCallback": function(nRow, aData, iDisplayIndex) + { + $(nRow).attr("typeof", "mo:Track"); + return nRow; + }, + "fnDrawCallback": function () + { + $(".artist_name").click(function(event) { searchArtist($(this).attr("href")); return false; }); + $(".album_name").click(function(event) { searchAlbum($(this).attr("href")); return false; }); + } + }); + + $("#results tbody").click(function(event) { + $(resultsTable.fnSettings().aoData).each(function (){ + $(this.nTr).removeClass('row_selected'); + }); + $(event.target.parentNode).addClass('row_selected'); + }); + +}); + +function search(event) { + + var trackSearchString = $("#tracksearch").val(); + var artistSearchString = $("#artistsearch").val(); + + if(trackSearchString.length == 0 && artistSearchString.length == 0) + { + resultsTable.fnClearTable(); + return; + } + + var queryString = "SELECT ?maker ?album ?album_title ?tracknum ?artist_name ?track_title WHERE {"; + + queryString += " ?track a mo:Track; mo:track_number ?tracknum; foaf:maker ?maker. ?album mo:track ?track; dc:title ?album_title. ?maker foaf:name ?artist_name"; + + if(artistSearchString.length > 0) + { + queryString += ' FILTER regex(?artist_name, "'+artistSearchString+'", "i")'; + } + else + { + queryString += "."; + } + + queryString += " ?record mo:track ?track; mo:publication_of ?signal. ?signal dc:title ?track_title"; + + if(trackSearchString.length > 0) + { + queryString += ' FILTER regex(?track_title, "'+trackSearchString+'", "i")'; + } + else + { + queryString += "."; + } + + queryString += " }"; + + performSearch(queryString); +} + +function searchArtist(id) { + var queryString = "SELECT ?maker ?album ?album_title ?tracknum ?artist_name ?track_title WHERE {"; + queryString += " ?track a mo:Track; mo:track_number ?tracknum; foaf:maker ?maker. ?album mo:track ?track; dc:title ?album_title. ?maker foaf:name ?artist_name"; + queryString += " ?record mo:track ?track; mo:publication_of ?signal. ?signal dc:title ?track_title."; + queryString += " FILTER(sameTerm(?maker, <"+id+">))"; + queryString += " }"; + performSearch(queryString); +} + +function searchAlbum(id) { + var queryString = "SELECT ?maker ?album ?album_title ?tracknum ?artist_name ?track_title WHERE {"; + queryString += " ?track a mo:Track; mo:track_number ?tracknum; foaf:maker ?maker. ?album mo:track ?track; dc:title ?album_title. ?maker foaf:name ?artist_name"; + queryString += " ?record mo:track ?track; mo:publication_of ?signal. ?signal dc:title ?track_title."; + queryString += " FILTER(sameTerm(?album, <"+id+">))"; + queryString += " }"; + performSearch(queryString); +} + + +function performSearch(queryString) { + $("#spinner").show(); + $("#query").text(queryString); + var query = sparqler.createQuery(); + query.query(queryString, {failure: function(xhr) { alert("Bad response! "+xhr.responseText) }, success: displayResults}); +} + +function displayResults(json) { + resultsTable.fnClearTable(); + if(json) { + + var bindings = json.results.bindings; + for(var i=0; i'); + var artistLink = $(''); + artistEl.append(artistLink); + artistLink.attr("href", bindings[i].maker.value); + artistLink.attr("rel", "foaf:maker"); + artistLink.addClass("artist_name"); + artistLink.append(bindings[i].artist_name.value); + + var albumEl = $('
'); + var albumLink = $(''); + albumEl.append(albumLink); + albumLink.attr("href", bindings[i].album.value); + albumLink.attr("rel", "dc:title"); + albumLink.addClass("album_name"); + albumLink.append(bindings[i].album_title.value); + + resultsTable.fnAddData([artistEl.html(), bindings[i].track_title.value, bindings[i].tracknum.value, albumEl.html()]); + } + + } + $("#spinner").hide(); +} diff -r 2eaea1afd6b3 -r 901803e1305f examples/browser/web/js/jOWL.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/examples/browser/web/js/jOWL.js Thu Oct 08 11:19:11 2009 +0000 @@ -0,0 +1,2242 @@ +/** +* jOWL - a jQuery plugin for traversing and visualizing OWL-DL documents. +* Creator - David Decraene +* Version 1.0 +* Website: +* http://Ontologyonline.org +* Licensed under the MIT license +* http://www.opensource.org/licenses/mit-license.php +* Verified with JSLint +* http://www.jslint.com/ +*/ + +jOWL = window.jOWL = function( resource, options ){ return jOWL.getResource( resource, options ); }; +jOWL.version = "1.0"; + +/** for debugging compatibility */ + try { console.log('...'); } catch(e) { console = window.console = { log: function() {} } } + if ($.browser.opera && opera.postError) { console = window.console = { log : function(){opera.postError(arguments); } }; } + + + +(function($){ + +/** +* if no param: @return string of main namespaces +* if 1 param: assume a documentElement, parse namespaces +* if prefix & URI: Bind prefix to namespace URI +*/ +jOWL.NS = function(prefix, URI){ + if(!arguments.length) + { return "xmlns:"+jOWL.NS.owl.prefix+"='"+jOWL.NS.owl()+"' xmlns:"+jOWL.NS.rdf.prefix+"='"+jOWL.NS.rdf()+"' xmlns:"+jOWL.NS.rdfs.prefix+"='"+jOWL.NS.rdfs()+"' xmlns:"+jOWL.NS.xsd.prefix+" ='"+jOWL.NS.xsd()+"'";} + + if(arguments.length == 1){ + var attr = prefix.get(0).attributes; + for(var i=0;i 0 ){ return xItems[0];} else { return null;} + }; + Element.prototype.selectSingleNode = function(cXPathString){ + if(this.ownerDocument.selectSingleNode) { return this.ownerDocument.selectSingleNode(cXPathString, this);} + else{throw "For XML Elements Only";} + }; +} + +/** @return A jQuery array of xml elements */ +jOWL.Xpath = function(selector, elem){ + var node = null; + if(elem){ if(elem.each){ node = elem.get(0);} else { node = elem;} } + var arr = node ? node.selectNodes(selector) : jOWL.document.selectNodes(selector); + if($.browser.msie){ return $($.makeArray(arr));} return $(arr); //this is needed for IE, it returns a length of 1 on empty node array +}; + +/** @return a String array of class references */ +jOWL.Xpath.classes = function(jnode){ + var cl = []; + jOWL.Xpath(__.rdfs("subClassOf"), jnode) + .each(function(){ + var res = $(this).RDF_Resource(); + if(res){ cl.push(res);} + }); + + jOWL.Xpath(__.owl("intersectionOf")+"/"+__.owl("Class"), jnode) + .each(function(){ + var p = $(this).RDF_About(); if(p){ cl.push(p);} + }); + return cl; +}; + +/** Functions stored in jOWL.priv are intended for local access only, to avoid a closure function */ +jOWL.priv = { + /** Arrray functions */ + Array : { + isArray : function(array){ + return Object.prototype.toString.call(array) === '[object Array]'; + }, + pushUnique : function(array, item){ + if(jOWL.priv.Array.getIndex(array, item) === -1){ array.push(item); return true;} + return false; + }, + getIndex : function(array, item){ + for (var i=0; i 0){ targetMatch = true;} + } + } + else if(restriction.property.isDatatypeProperty){ + targetMatch = restriction.property.assert(restriction.target, target); + } + else { targetMatch = (target == restriction.target);} + } + if(propertyMatch && targetMatch){ results.pushUnique(restriction);} + + }); + if(options.inherited){ + var clRestrictions = this.owlClass().sourceof(property, target, options) + .each(function(){ + //target can be a class, null, a duplicate individual... + var clRestr = this; + if(options.valuesOnly && clRestr.target === null){return;} + var clTarget = this.getTarget(); + if(clTarget.isClass && options.ignoreClasses){ return;} + + var containsProperty = false; + for(var i = 0;i 0;} }); +jOWL.Ontology.Datatype(__.xsd()+"decimal", {base: __.xsd()+"integer" }); +jOWL.Ontology.Datatype(__.xsd()+"float", {base: __.xsd()+"integer" }); +jOWL.Ontology.Datatype(__.xsd()+"double", {base: __.xsd()+"integer" }); +jOWL.Ontology.Datatype(__.xsd()+"negativeInteger", {base: __.xsd()+"integer", assert : function(x){ return x < 0;} }); +jOWL.Ontology.Datatype(__.xsd()+"nonNegativeInteger", {base: __.xsd()+"integer", assert : function(x){ return x >= 0;} }); +jOWL.Ontology.Datatype(__.xsd()+"nonPositiveInteger", {base: __.xsd()+"integer", assert : function(x){ return x <= 0;} }); +jOWL.Ontology.Datatype(__.xsd()+"string"); + +var URIPattern = /^([a-z0-9+.\-]+):(?:\/\/(?:((?:[a-z0-9-._~!$&'()*+,;=:]|%[0-9A-F]{2})*)@)?((?:[a-z0-9-._~!$&'()*+,;=]|%[0-9A-F]{2})*)(?::(\d*))?(\/(?:[a-z0-9-._~!$&'()*+,;=:@\/]|%[0-9A-F]{2})*)?|(\/?(?:[a-z0-9-._~!$&'()*+,;=:@]|%[0-9A-F]{2})+(?:[a-z0-9-._~!$&'()*+,;=:@\/]|%[0-9A-F]{2})*)?)(?:\?((?:[a-z0-9-._~!$&'()*+,;=:\/?@]|%[0-9A-F]{2})*))?(?:#((?:[a-z0-9-._~!$&'()*+,;=:\/?@]|%[0-9A-F]{2})*))?$/i; + +jOWL.Ontology.Datatype(__.xsd()+"anyURI", {base: __.xsd()+"string", pattern : URIPattern }); +jOWL.Ontology.Datatype(__.xsd()+"boolean", {sanitize : function(x){ + if(typeof x == 'boolean'){ return x;} + if(x == 'true'){ return true;} + if(x == 'false'){ return false;} + }, assert : function(x){ + return typeof x == 'boolean'; + }, match: function(a, b){ + if(a === "false"){ a = false;} + if(a === "true"){ a = true;} + return (a === b); +}}); + +/** 'superclass' for Properties */ +jOWL.Ontology.Property = function(jnode){ + var r = this.parseProperty(jnode); + if(r){ return r;} +}; + +jOWL.Ontology.Property.prototype = $.extend({}, jOWL.Ontology.Thing.prototype,{ + isProperty : true, + parseProperty : function(jnode){ + if(!jnode || typeof jnode == 'string'){ + this.domain = this.range = null; + this.parse(jnode); + return; + } + if(jOWL.options.cacheProperties && jOWL.indices.IDs){ + var res = jnode.RDF_ID() || jnode.RDF_About(); + var c = jOWL.index('property').get(res); + if(c){ return c;} + } + this.parse(jnode); + this.domain= $(this.jnode.get(0).selectSingleNode(__.rdfs('domain'))).RDF_Resource(); + this.range = $(this.jnode.get(0).selectSingleNode(__.rdfs('range'))).RDF_Resource(); + } +}); + +/** access to Datatype properties */ +jOWL.Ontology.DatatypeProperty = function(jnode){ + var r = this.parseProperty(jnode); + if(r){ return r;} + if(this.type == __.owl("AnnotationProperty")){ this.range = __.xsd()+"string";} +}; + +jOWL.Ontology.DatatypeProperty.prototype = $.extend({}, jOWL.Ontology.Thing.prototype, jOWL.Ontology.Property.prototype, { + isDatatypeProperty : true, + /** check datatype values against this */ + assert : function(targetValue, value){ + var self = this; + var dt = jOWL.Ontology.Datatype[this.range]; + if(!dt){ + console.log(this.range+" datatype reasoning not implemented"); + return true; + } + if(value === undefined){ return dt.assert(targetValue);} + else {return dt.match(value, targetValue);} + } +}); + +/** access to Object properties */ +jOWL.Ontology.ObjectProperty = function(jnode){ + var r = this.parseProperty(jnode); + if(r){ return r;} + var self = this; + jOWL.Xpath(__.rdf('type'), this.jnode).each(function(){ + if($(this).RDF_Resource() == __.owl()+"TransitiveProperty"){ self.isTransitive = true;} + }); + if(this.jnode.get(0).nodeName == __.owl("TransitiveProperty")){ self.isTransitive = true;} +}; + +jOWL.Ontology.ObjectProperty.prototype = $.extend({}, jOWL.Ontology.Thing.prototype, jOWL.Ontology.Property.prototype, { + isObjectProperty : true +}); + +/** access to an owl:Class */ +jOWL.Ontology.Class = function(jnode){ + this.parse(jnode); +}; + +/** @return jOWL Array of Restrictions */ +jOWL.Xpath.restrictions = function(jnode){ + var result = new jOWL.Ontology.Array(); + jOWL.Xpath(__.rdfs("subClassOf")+"/"+__.owl("Restriction"), jnode) + .add(jOWL.Xpath(__.owl("intersectionOf")+"/"+__.owl("Restriction"), jnode)) + .each(function(){ + result.push(new jOWL.Ontology.Restriction($(this))); + }); + return result; +}; + +/** Internal Use */ +jOWL.Ontology.Intersection = function(jnode){ + var self = this; + this.jnode = jnode; + this._arr = []; + this.URI = this.jnode.parent().RDF_ID(); + this.matches = {}; + jOWL.Xpath(__.owl("Restriction"), jnode).each(function(){ + var restr = new jOWL.Ontology.Restriction($(this)); + if(restr.isValueRestriction){self._arr.push(restr);} + }); + jOWL.Xpath(__.owl('Class'), jnode).each(function(){ + var uri = $(this).RDF_About(); + if(uri){ self._arr.push(jOWL(uri));} + }); +}; + +jOWL.Ontology.Intersection.prototype = { + isIntersection : true, + jOWL : jOWL.version, + match : function(id, cls, clRestr){ + if(id == this.URI){ return false;} + if(this.matches[id] !== undefined){ return this.matches[id]; }//local cache + + for(var i =0;i 1){ oParents.filter(function(){return this.name != ('Thing');});} //Remove Thing reference if other parents exist + jOWL.data(this.name, "parents", oParents); + return oParents; + }, +/** @return ancestors to the class in a jOWL.Ontology.Array */ + ancestors : function(){ + return this.hierarchy(false).flatindex; + }, +/** +Constructs the entire (parent) hierarchy for a class +@return a jOWL.Ontology.Array containing top nodes (classes directly subsumed by 'owl:Thing') +@param addInverse add a variable invParents (jOWL.Ontology.Array of child references) to each node with exception of the leaves (original concept) +*/ + hierarchy : function(addInverse){ + var endNodes = new jOWL.Ontology.Array(); + var self = this; + endNodes.flatindex = new jOWL.Ontology.Array(); + + function URIARR(p_arr, obj){ + var add = true; + if(!obj){ obj = {}; add = false;} + if(p_arr.each){ + p_arr.each(function(){ + if(obj[this.URI]){return;} + if(this.URI == __.owl()+'Thing'){ return;} + if(add){ obj[this.URI] = true;} + if(this.parents){ URIARR(this.parents(), obj);} + }); + } + return obj; + } + + function traverse(concept){ + var parents = concept.parents(); + if(parents.length == 1 && parents.contains(__.owl()+'Thing')){ endNodes.pushUnique(concept); return;} + else + { + var asso = jOWL.options.reason ? URIARR(parents) : {}; + parents.filter(function(){ return (!asso[this.URI]);}); //throw out redundancies + parents.each(function(){ + var item = endNodes.flatindex.pushUnique(this); + if(addInverse){ + if(!item.invParents){ item.invParents = new jOWL.Ontology.Array();} + item.invParents.pushUnique(concept); + } + traverse(item); + }); + concept.setParents(parents); + } + } + + traverse(this); + return endNodes; + + }, + /** + @param level depth to fetch children, Default 5 + @return jOWL array of classes that are descendant + */ + descendants : function(level){ + level = (typeof level == 'number') ? level : 5; + var oDescendants = jOWL.data(this.name, "descendants"); + if(oDescendants && oDescendants.level >= level){ return oDescendants;} + oDescendants = new jOWL.Ontology.Array(); + oDescendants.level = level; + + function descend(concept, i){ + if(i <= level){ + i++; + var ch = concept.children(); + oDescendants.concat(ch); + ch.each(function(item){ descend(item, i);}); + } + } + + descend(this, 1); + jOWL.data(this.name, "descendants", oDescendants); + return oDescendants; + }, + /** @return jOWL.Array of Restrictions, target is an individual, not a class or undefined (unless includeAll is specified) - deprecated */ + valueRestrictions : function(includeAll, array){ + return this.sourceof(null, null, {ignoreClasses : !includeAll}); + }, + /** + get all restrictions that satisfy the arguments + @param property property or array of properties, or null + @param target class, individuals of array of them, or null + @return jOWL.Array of Restrictions + */ + sourceof : function(property, target, options){ + options = $.extend({ + inherited : true, // add restrictions specified on parents as well + transitive : true, //expand on transitive relations too + ignoreGenerics : true, //if a parent has an identical property, with another target 'Thing', skip that restriction + ignoreClasses : false, //only individuals should return + valuesOnly : true //do not return valueless criteria + }, options); + var self = this; + var crit = jOWL.data(this.name, "sourceof"); + var jnode = this.jnode; + + if(!crit){ + crit = new jOWL.Ontology.Array(); + var arr = jOWL.Xpath(__.rdfs("subClassOf")+"/"+__.owl("Restriction"), jnode) + .add(jOWL.Xpath(__.owl("intersectionOf")+"/"+__.owl("Restriction"), jnode)); + arr.each(function(index, entry){ + var cr = new jOWL.Ontology.Restriction($(entry)); + var dupe = false; + crit.each(function(item, i){ + if(this.property.name == cr.property.name){ dupe = item;} + }); + if(dupe){ if(!dupe.merge(cr)){ crit.push(cr);} } + else { crit.push(cr);} + }); + jOWL.data(self.name, "sourceof", crit); + } + var results = new jOWL.Ontology.Array(); + + crit.each(function(){ + + var propertyMatch = property ? false : true; + var targetMatch = target ? false : true; + + if(!propertyMatch){ + if(property.isArray){ propertyMatch = property.contains(this.property);} + else { propertyMatch = (property.URI == this.property.URI);} + } + + if(!target){ + if(options.transitive && this.property.isTransitive){ + var rTarget = this.getTarget(); + var transitives = rTarget.sourceof(this.property, null, options); + results.concat(transitives); + } + } + + if(!targetMatch && !this.target){ + targetMatch = !options.valuesOnly; + } + + if(!targetMatch){ + var targ = this.getTarget(); + if(targ.isClass && options.ignoreClasses){ return;} + targetMatch = jOWL.priv.testObjectTarget(target, this.target); + if(!targetMatch && options.transitive && propertyMatch && this.property.isTransitive){ + if(targ.isThing){ + if(targ.sourceof(property, target).length){ targetMatch = true;} + } + } + } + + if(propertyMatch && targetMatch){ results.pushUnique(this);} + }); + + if(!options.inherited){ return results;} + + this.parents().each(function(){ + if(this.sourceof){ + this.sourceof(property, target, options).each(function(parentsource){ + var ptarget = this.getTarget(); + var containsProperty = false; + var tempArray = new jOWL.Ontology.Array(); + results.filter(function(){ + var restr = this, keep = true; + if(restr.property.URI == parentsource.property.URI){ + containsProperty = true; + if(!options.ignoreGenerics){ + if(parentsource.target != restr.target){ tempArray.push(parentsource);} + } else { + if(ptarget.isThing){ + keep = restr.getTarget().isThing && parentsource.target != restr.target; + tempArray.push(parentsource); + } + } + } + return keep; + }); + if(!containsProperty){ results.push(parentsource);} + results.concat(tempArray); + }); + } + }); + return results; + } +}); + +/** Utility object */ +jOWL.Ontology.Array = function(arr, isXML){ + var self = this; + this.items = []; + if(arr){ + if(isXML){ $.each(arr, function(){ + var entry = this.jOWL ? this : jOWL($(this)); + self.items.push(entry);}); + } + else { this.items = arr;} + } + this.length = this.items.length; +}; + +jOWL.Ontology.Array.prototype = { + jOWL : jOWL.version, + isArray : true, + bind : function(listitem, fn){ + return this.map(function(){ + var syntax = listitem ? listitem.clone(true) : $(''); + var html = this.bind(syntax).append(document.createTextNode(' ')); + if(fn){ fn.call(html, html, this);} + return html.get(0); + }); + }, + concat : function(arr, ignoreUnique){ + var self = this; + if(arr.each){ arr.each(function(){ + if(ignoreUnique){ self.push(this); } + else { self.pushUnique(this); } + }); + } + else { self.items = self.items.concat(arr.items); this.length = self.items.length;} + return this; + }, + contains : function(o){ + return this.get(o) ? true: false; + }, + each : function(fn, reverse){ + var i, self = this; + var stop = false; + if(reverse){ + for(i=this.items.length - 1; i>=0;i--){ + if(stop){ break;} + (function(){ + var item = self.eq(i); + if(fn.call(item, item, i) === false){ stop = true;} + })(); + } + } + else { + for(i=0;i this.items.length -1){ return null;} + return this.items[index]; + }, + filter : function(fn){ + var self = this; + this.each(function(item, i){ + var q = fn.call(item, item, i); + if(!q){ self.items.splice(i, 1);} + }, true); + this.length = this.items.length; + return this; + }, + getIndex : function(o){ + var found = -1; + if(o.equals){ + this.each(function(a, i){ + if(this.equals && this.equals(o)){ found = i; return false;} + }); + } + else { + if(typeof o == 'number'){ return o;} + var name = typeof o == "string" ? o : o.name; + var URI = o.URI || name; + + this.each(function(a, i){ + if(this.URI){ if(this.URI == URI){ found = i;}} + else if(this.name == name){ found = i;} + }); + } + return found; + }, + get : function(o){ + return this.eq(this.getIndex(o)); + }, + map : function(fn){ + var arr = []; + this.each(function(){ arr.push(fn.call(this, this));}); + return arr; + }, + push : function(o){ + this.items.push(o); + this.length = this.items.length; + return this; + }, + pushUnique : function(o){ + return this.get(o) || this.push(o).get(o); + }, + toString : function(){ + return this.map(function(){return this.URI;}).join(', '); + }, + /** Convert this array into an associative array with key = URI */ + associative : function(){ + var arr = {}; + this.each(function(){ + if(this.URI){ arr[this.URI] = this;} + }); + return arr; + } +}; + + +jOWL.options = {reason: true, locale:false, defaultlocale: 'en', + dictionary : { create: true, addID : true }, + onParseError : function(msg){alert("jOWL parseError: "+msg);}, cacheProperties : true, niceClassLabels : true}; +jOWL.document = null; +jOWL.namespace = null; +jOWL.indices = { //internal indices + P : null, //jOWL array + data : {}, + IDs : null, + I : null, //Intersection + T : null, //Thing + D : null, //dictionary + reset : function(){var i = jOWL.indices; i.data = {}; i.P = null; i.T = null; i.IDs = null; i.I = null;i.D = null;} +}; + +jOWL.index = function(type, wipe){ + var i = jOWL.indices; + switch (type) + { + /**jOWL indexes all elements with rdf:ID, and first order ontology elements specified with rdf:about + @return Associative array with key = URI and value = jOWL object. + */ + case "ID": + if(i.IDs === null || wipe){ + if(wipe){ i.reset();} + i.IDs = {}; + i.T = {}; + var start = new Date(); + + var rID = jOWL.Xpath("//*[@"+__.rdf("ID")+"]").each(function(){ + var jowl = jOWL.getResource($(this)); + if(jowl){ + i.IDs[jowl.URI] = jowl; + if(jowl.isThing){ + if(!i.T[jowl.Class]){ i.T[jowl.Class] = new jOWL.Ontology.Array();} + i.T[jowl.Class].push(jowl); + } + } + }); + + var rAbout = jOWL.Xpath("/"+__.rdf("RDF")+"/*[@"+__.rdf("about")+"]").each(function(){ + var jnode = $(this); + var jowl = jOWL.getResource($(this)); + if(!jowl){ return;} + if(jowl.isClass || jowl.isProperty || jowl.isThing){ + if(i.IDs[jowl.URI]){ jnode.children().appendTo(i.IDs[jowl.URI].jnode); return;} + i.IDs[jowl.URI] = jowl; + if(jowl.isThing){ + if(!i.T[jowl.Class]){ i.T[jowl.Class] = new jOWL.Ontology.Array();} + i.T[jowl.Class].push(jowl); + } + return; + } + }); + console.log("Loaded in "+(new Date().getTime() - start.getTime())+"ms"); + } + return i.IDs; + /** Generated together with ID index. + * @return Associative Array, key = class, value = jOWL Array of individuals. + */ + case "Thing": + return i.T; + case "intersection": + if(i.I === null || wipe){ + var temp = new jOWL.Ontology.Array(); + i.I = {}; + jOWL.Xpath("//"+__.owl("intersectionOf")).each(function(){ + var isect = new jOWL.Ontology.Intersection($(this)); + if(!isect.URI){return;} + var dupe = temp.get(isect); + if(dupe){ + console.log("duplicate intersection found between : (Ignoring) "+isect.URI+" and "+dupe.URI); + } else { + if(!i.I[isect.URI]){i.I[isect.URI] = new jOWL.Ontology.Array();} + temp.push(isect); + i.I[isect.URI].push(isect); + } + }); + } + return i.I; + case "property": + if(i.P === null || wipe) + { + jOWL.options.cacheProperties = false; + i.P = new jOWL.Ontology.Array(); + for(x in i.IDs){ + var jowl = i.IDs[x]; + if(jowl.isProperty){ i.P.push(jowl);} + } + jOWL.options.cacheProperties = true; + } + return i.P; + case "dictionary": + /**Dictionary: Array of Arrays, where secondary array is of form: [0] = term, [1] = rdfID, [2] = locale */ + if(i.D === null || wipe) + { + i.D = []; + for(x in i.IDs){ + var entry = i.IDs[x]; + i.D = i.D.concat(entry.terms()); + } + } + return i.D; + } +}; + +/** Internal Function, storing data in associative array (JSON), +jquery data function cannot be used as expando data does not work in IE for ActiveX XMLhttprequest*/ +jOWL.data = function(rdfID, dtype, data){ + var d = jOWL.indices.data; + if(!d[rdfID]){ d[rdfID] = {};} + if(!data){ return d[rdfID][dtype];} + d[rdfID][dtype] = data; +}; + +/** +* Initialize jOWL with an OWL-RDFS document. +* @param path relative path to xml document +* @param callback callback function to be called when loaded. +* @options : optional settings: +* onParseError : function(msg){} function to ba called when parsing fails +* reason : true/false, turns on additional reasoning at the expense of performance +* locale: set preferred language (if available), examples en, fr... +*/ +jOWL.load = function(path, callback, options){ + var that = this; + if($.browser.msie && location.toString().indexOf('file') === 0){ //IE won't load local xml files otherwise + var xml = document.createElement("xml"); + xml.validateOnParse = false; //IE throws DTD errors (for 'rdf:') on perfectly defined OWL files otherwise + xml.src = path; + xml.onreadystatechange = function(){ + if(xml.readyState == "interactive"){ var xmldoc = xml.XMLDocument; document.body.removeChild(xml);callback(that.parse(xmldoc, options));} + }; + document.body.appendChild(xml); + } + else { + $.get(path, function(xml){callback(that.parse(xml, options));}); + } +}; + +/** +* initialize jOWL with some OWL-RDFS syntax +* @param doc Either an xmlString or an xmlDocument +* @param options optional, onParseError(msg) : function to execute when parse fails +* @returns false on failure, or the jOWL object +*/ +jOWL.parse = function(doc, options){ + jOWL.document = null; + this.options = $.extend(jOWL.options, options); + if(typeof doc == 'string'){ doc = jOWL.fromString(doc);} + jOWL.document = doc; + if($.browser.msie){ + if(doc.parseError.errorCode !== 0){ jOWL.options.onParseError(doc.parseError.reason); return false;} + } + else if(doc.documentElement.nodeName == 'parsererror'){jOWL.options.onParseError(doc.documentElement.firstChild.nodeValue); return false;} + var root = $(doc.documentElement); + jOWL.NS(root); + if($.browser.msie){ + jOWL.document.setProperty("SelectionLanguage", "XPath"); + jOWL.document.setProperty("SelectionNamespaces", __()); + } + this.index('ID', true); + if(jOWL.options.cacheProperties){ this.index('property', true);} + if(jOWL.options.dictionary.create){ jOWL.index("dictionary");} + jOWL.Thing = new jOWL.Ontology.Thing($(jOWL.create(__.owl, "Class").attr(__.rdf, 'about', __.owl()+'Thing').node)); + jOWL.Thing.type = false; + return this; +}; + +/** +* A String representation of the OWL-RDFS document +* @param xmlNode optional, node to generate a string from, when unspecified the entire document +*/ +jOWL.toString = function(xmlNode){ + if(!xmlNode){ return jOWL.toString(jOWL.document);} + if($.browser.msie){ return xmlNode.xml;} + return new XMLSerializer().serializeToString(xmlNode);// Gecko-based browsers, Safari, Opera. +}; + +/** create a document from string */ +jOWL.fromString = function(doc){ + var owldoc; + if(document.implementation.createDocument){ owldoc = new DOMParser().parseFromString(doc, "text/xml");} // Mozilla and Netscape browsers + else if(window.ActiveXObject){ // MSIE + var xmldoc = new ActiveXObject("Microsoft.XMLDOM"); + xmldoc.async="false"; + xmldoc.validateOnParse = false; + xmldoc.loadXML(doc); + owldoc = xmldoc; + } + return owldoc; +}; + +/** @return false if belongs to this namespace, or an array with length two, arr[0] == url, arr[1] == id */ +jOWL.isExternal = function(resource){ + var r = jOWL.resolveURI(resource, true); + return r[0] != jOWL.namespace ? r : false; +}; + +/** +if a URI belongs to the loaded namespace, then strips the prefix url of, else preserves URI +also able to parse and reference html (or jquery) elements for their URI. +*/ +jOWL.resolveURI = function(URI, array){ + if(typeof URI != "string"){ + var node = URI.jquery ? URI.get(0) : URI; + URI = node.localName || node.baseName; + if(node.namespaceURI){ URI = node.namespaceURI + URI;} + return jOWL.resolveURI(URI, array); + } + var rs = URI, ns = jOWL.namespace; + if(URI.indexOf('http') === 0){ + var tr = URI.indexOf('#'); + if(tr <= 0){ tr = URI.lastIndexOf('/');} + if(tr > 0) + { + ns = URI.substring(0, tr+1); + rs = URI.substring(tr+1); + } + } else if(URI.charAt(0) == '#'){ return URI.substring(1);} + if(array){ return [ns, rs];} + if(ns == jOWL.namespace){ return rs;} + return URI; +}; + +/** +Main method to get an Ontology Object, access via jOWL(>String>, options); +resource: rdfID/rdfResource or jQuery node. +*/ +jOWL.getResource = function(resource, options){ + if(!jOWL.document){ throw "You must successfully load an ontology before you can find anything";} + if(!resource){ throw "No resource specified";} + var node; + var opts = $.extend({}, options); + if(typeof resource == 'string'){ + resource = jOWL.resolveURI(resource); + if(resource == 'Thing' || resource == __.owl()+'Thing'){ return jOWL.Thing;} + if(opts.type == 'property' && jOWL.options.cacheProperties){ + var c = jOWL.index('property').get(resource); + if(c){ return c;} + if(jOWL.isExternal(resource)){ console.log("undeclared resource: "+resource); return new jOWL.Ontology.Property(resource);} + } + var match = jOWL.index("ID")[resource]; + if(!match){ //try case insensitive + for(caseIns in jOWL.index("ID")){ + if(caseIns.toLowerCase() == resource.replace(/ /g, "").toLowerCase()){ match = jOWL.index("ID")[caseIns]; break;} + } + } + if(!match){ + if(jOWL.isExternal(resource)){ + console.log("undeclared resource: "+resource); + return new jOWL.Ontology.Thing(resource); + } + console.log(resource+" not found"); + return null; + } + return match; + } + node = resource.jquery ? resource : $(resource); + var jj = jOWL.type(node); if(!jj){ return null;} + return new (jj)(node); +}; + +/** +* @param node jquery or html element. +* @return the ontology type of the object. +*/ +jOWL.type = function(node){ + var xmlNode = node.jquery ? node.get(0) : node; + switch(xmlNode.nodeName){ + case __.owl("Class") : return jOWL.Ontology.Class; + case __.rdfs("Class") : return jOWL.Ontology.Class; //test + case __.owl("Ontology") : return jOWL.Ontology; + case __.owl("ObjectProperty") : return jOWL.Ontology.ObjectProperty; + case __.owl("DatatypeProperty") : return jOWL.Ontology.DatatypeProperty; + case __.owl("FunctionalProperty") : return jOWL.Ontology.Property; + case __.rdf("Property") : return jOWL.Ontology.Property; + case __.owl("InverseFunctionalProperty") : return jOWL.Ontology.ObjectProperty; + case __.owl("TransitiveProperty") : return jOWL.Ontology.ObjectProperty; + case __.owl("SymmetricProperty") : return jOWL.Ontology.ObjectProperty; + //jOWL currently treats annotationproperties as string datatypeproperties. + case __.owl("AnnotationProperty") : return jOWL.Ontology.DatatypeProperty; + default : + switch(xmlNode.namespaceURI){ + case __.owl(): if(xmlNode.nodeName == __.owl("Thing") ){ return jOWL.Ontology.Individual;} return false; + case __.rdf(): return false; + case __.rdfs(): return false; + default : return jOWL.Ontology.Individual; + } + } +}; + +/** +@param rdfID or Array +@return Array of DOM (xml) Nodes +*/ +jOWL.getXML = function(rdfID){ + var node = []; + function fetchFromIndex(rdfID){ + var el = jOWL.index("ID")[rdfID]; + return el ? el : null; + } + + if(typeof rdfID == 'string'){ var q = fetchFromIndex(rdfID); if(q){ node.push(q);} } + else if(jOWL.priv.Array.isArray(rdfID)){ //assume an array of string rdfIDs + $.each(rdfID, function(){ + var el = fetchFromIndex(this); if(el){ node.push(el);} + }); + } + return node; +}; + +/** Create new ontology elements */ +jOWL.create = function(namespace, name, document){ + var doc = document ? document : jOWL.document; + + var el = { + attr : function(namespace, name, value){ + if($.browser.msie){ + var attribute = doc.createNode(2, namespace(name), namespace()); + attribute.nodeValue = value; + this.node.setAttributeNode(attribute); + } + else { this.node.setAttributeNS(namespace(), namespace(name), value);} + return this; + }, + appendTo : function(node){ + var n = node.node ? node.node : node; + n.appendChild(this.node); + return this; + }, + text : function(text, cdata){ + var txt = cdata ? doc.createCDATASection(text) : doc.createTextNode(text); + this.node.appendChild(txt); + return this; + } + }; + + if($.browser.msie){ el.node = doc.createNode(1, namespace(name), namespace());} + else { el.node = doc.createElementNS(namespace(), namespace(name));} + return el; +}; + +/** Create a blank ontology document */ +jOWL.create.document = function(href){ + var owl = []; + var base = href || window.location.href+"#"; + owl.push(''); + owl.push('<'+__.rdf('RDF')+' xml:base="'+base+'" xmlns="'+base+'" '+__()+'>'); + owl.push(' <'+__.owl('Ontology')+' '+__.rdf('about')+'=""/>'); + owl.push(''); + return jOWL.fromString(owl.join('\n')); +}; + +/** Extracts RDFa syntax from current page and feeds it to jOWL, simple implementation, only classes for the time being */ +jOWL.parseRDFa = function(fn, options){ + var entries = options.node ? $("[typeof]", options.node) : $("[typeof]"); + var doc = jOWL.create.document(); + + function property(p, node){ + var arr = []; + $("[property="+p+"]", node).each(function(){ arr.push($(this).attr('content') || $(this).html());}); + if(node.attr('property') === p){ arr.push(node.attr('content') || node.html());} + return arr; + } + + function rel(p, node){ + var arr = []; + $("[rel="+p+"]", node).each(function(){ arr.push($(this).attr('resource'));}); + if(node.attr("rel") === p){ arr.push(node.attr('resource'));} + return arr; + } + + function makeClass(node, ID){ + var cl = jOWL.create(__.owl, "Class", doc).attr(__.rdf, 'about', ID).appendTo(doc.documentElement); + + var parents = property(__.rdfs("subClassOf"), node).concat(rel(__.rdfs("subClassOf"), node)); + for(var i = 0;i +Used for term searches, intend to (partially) replace it by a sparql-dl query later on +options: + filter: filter on a specific type, possible values: Class, Thing, ObjectProperty, DatatypeProperty + exclude: exclude specific types, not fully implemented +*/ +jOWL.query = function(match, options){ + options = $.extend({exclude : false}, options); + if(options.filter == 'Class'){ options.filter = __.owl("Class");} + var that = this; + //filter : [], exclude : false + var items = new jOWL.Ontology.Array(); + var jsonobj = {}; + var test = jOWL.index("dictionary"); + + function store(item){ + var include = false, i = 0; + if(options.filter){ + if(typeof options.filter == 'string'){ include = (options.filter == item[3]);} + else { for(i = 0;i -1){ + if(options.locale){ if(options.locale == item[2]){ store(item);} } + else { store(item);} + } + } + return jsonobj; +}; + +/** +allows asynchronous looping over arrays (prevent bowser freezing). +arr the array to loop asynchonrously over. +options.modify(item) things to do with each item of the array +options.onUpdate array the size of chewsize or smaller, containing processed entries +options.onComplete(array of results) function triggered when looping has completed +*/ +jOWL.throttle =function(array, options){ + options = $.extend({ + modify : function(result){}, + //onUpdate : function(arr){}, + onComplete : function(arr){}, + async : true, + chewsize : 5, + startIndex : 0, + timing : 5 + }, options); + var temp = array.jOWL ? array.items : (array.jquery) ? $.makeArray(array) : array; + var items = options.startIndex ? temp.slice(startIndex) : temp.concat(); //clone the array + var results = []; + + (function(){ + var count = options.chewsize; + var a = []; + while (count > 0 && items.length > 0) + { + var item = items.shift(); count--; + var result = options.modify.call(item, item); + if(result){ results.push(result); a.push(result);} + } + if(options.onUpdate){ options.onUpdate(a);} + + if(items.length> 0){ + if(options.async){ setTimeout(arguments.callee, options.timing);} + else {arguments.callee();} + } + else{ options.onComplete(results);} + })(); +}; + +/** Creates a new resultobj for the SPARQL-DL functionality */ +jOWL.SPARQL_DL_Result = function(){ + this.assert = undefined; + this.head = {}; //associative array of query parameters, with value jOWL Array of results + this.results = []; //sparql-dl bindings + this.isBound = false; +}; + +jOWL.SPARQL_DL_Result.prototype = { + sort : function(param){ + if(!param){ throw "parameter must be defined for sort function";} + function sortResults(a, b){ + var o = a[param].name || a[param]; + var p = b[param].name || b[param]; + return (o < p) ? -1 : 1; + } + if(this.results){ this.results.sort(sortResults); } + }, + jOWLArray : function(param){ + if(!param){ throw "parameter must be defined for jOWLArray function";} + var arr = new jOWL.Ontology.Array(); + for(var i=0;i=0;i--){ + var valueX = this.results[i][x]; + if(valueX){ + if(!results.mappings[x].contains(valueX)){ + this.results.splice(i, 1); + continue; + } + if(multimapping){ + var keyArr= otherKeys[valueX.URI]; + //ignoring the opposite for now (assuming original key x is unique (limits statements)) + //TODO: improve these result merging methods/flexibility + for(var oK = 0; oK < keyArr.length;oK++){ + var obj = (oK === 0) ? this.results[i] : {}; + var valueY = keyArr[oK]; + obj[x] = valueX; + for(yK in valueY){ obj[yK] = valueY[yK]; } + toAdd.push(obj); + } + this.results.splice(i, 1); + } + } + } + } + this.results = this.results.concat(toAdd); + } +}; +/** Creates a new query for the SPARQL-DL functionality */ +jOWL.SPARQL_DL_Query = function(syntax, parameters){ + this.parse(syntax); + this.fill(parameters); + this.entries = this.entries.sort(this.sort); +}; + +jOWL.SPARQL_DL_Query.prototype = { + parse : function(syntax){ + var r2 = /(\w+)[(]([^)]+)[)]/; + var entries = syntax.match(/(\w+[(][^)]+[)])/g); + if(!entries){ this.error = "invalid abstract sparql-dl syntax"; return;} + entries = jOWL.priv.Array.unique(entries); + for(var i = 0;i=0;i--){ + if(this.arr[i][keyX]){ + if(!arr[this.arr[i][keyX].URI]){ arr[this.arr[i][keyX].URI] = []; } + arr[this.arr[i][keyX].URI].push(this.arr[i]); + } + } + return arr; + }, + get : function(key) + { + return (this.mappings[key]) ? this.mappings[key] : new jOWL.Ontology.Array(); + }, + getArray : function(){ + //check mappings for presence, discard arr entries based on that, return remainder. + for(var i = this.arr.length - 1;i>=0;i--){ + var binding = this.arr[i], splice = false; + for(key in binding){ + if(!splice){ + splice = (!this.mappings[key] || !this.mappings[key].contains(binding[key])); + } + } + if(splice){ + this.arr.splice(i, 1); + } + } + return this; + } +}; + +/** +Support for abstract SPARQl-DL syntax +options.onComplete: function triggered when all individuals have been looped over +options.childDepth: depth to fetch children, default 5, impacts performance +options.chewsize: arrays will be processed in smaller chunks (asynchronous), with size indicated by chewsize, default 10 +options.async: default true, query asynchronously +parameters: prefill some sparql-dl parameters with jOWL objects +execute: start query, results are passed through options.onComplete +*/ +jOWL.SPARQL_DL = function(syntax, parameters, options){ + if(!(this instanceof arguments.callee)){ return new jOWL.SPARQL_DL(syntax, parameters, options);} + var self = this; + this.parameters = $.extend({}, parameters); + this.query = new jOWL.SPARQL_DL_Query(syntax, this.parameters).entries; + this.result = new jOWL.SPARQL_DL_Result(); + this.options = $.extend({onComplete: function(results){}}, options); +}; + +jOWL.SPARQL_DL.prototype = { + error: function(msg){ this.result.error = msg; return this.options.onComplete(this.result);}, + /** + if(options.async == false) then this method returns the result of options.onComplete, + no matter what, result is always passed in options.onComplete + */ + execute : function(options){ + var self = this; + this.options = $.extend(this.options, options); + if(this.query.error){ return this.error(this.query.error);} + + var resultobj = this.result; + var i = 0; + var loopoptions = $.extend({}, this.options); + loopoptions.onComplete = function(results){ i++; resultobj = results; loop(i);}; + + if(!this.query.length){ + resultobj.error = "no query found or query did not parse properly"; + return self.options.onComplete(resultobj); + } + + function loop(i){ + if(i < self.query.length){ + self.process(self.query[i], resultobj, loopoptions ); + } + else { + for(var j =0;j 0){ match = true;} + return; + } + if(!restrictions.length){ return;} + restrictions.each(function(){ + var binding = new _Binding(results); + if(options.filterSource){ + binding.bind(options.filterSource, source); + if(!options.filterProperty && !options.filterTarget){ results.add(binding); return false;} + } + if(options.filterProperty){ + binding.bind(options.filterProperty, this.property); + } + if(options.filterTarget){ + binding.bind(options.filterTarget, this.getTarget()); + } + results.add(binding); + }); + return true; + }); + if(options.assert){ + resultobj.assert = match; + return resultobj.assert; + } + if(options.filterSource){ resultobj.filter(options.filterSource, results.get(options.filterSource));} + if(options.filterProperty){ resultobj.filter(options.filterProperty, results.get(options.filterProperty));} + if(options.filterTarget) { resultobj.filter(options.filterTarget, results.get(options.filterTarget));} + resultobj.bind(results.getArray()); + }, + hasClassID: function(match, classID){ + if(Object.prototype.toString.call(classID) === '[object Array]'){ + for(var i =0;i').appendTo(this.content); + this.focus = $('
').addClass(options.focusClass).appendTo(this.content); + this.children = $('
').appendTo(this.content); + var listnode = $('').click(function(){ + var node = $(this); + var res = jOWL(node.attr('title')); + if(options.onSelect.call(node, res) === false) { return; } + if(res && res.isClass) { self.propertyChange.call(res, res); self.broadcast(res); } + }); + + jOWL.UI.asBroadcaster(this); + + this.propertyChange = function(item){ + if(options.onPropertyChange.call(this, item) === false) { return; } + if(item.isClass){ + item.bind(self.focus); + if(jOWL.options.reason) { item.hierarchy();} + self.parents.empty().append(item.parents().bind(listnode)); + self.children.empty().append(item.children().bind(listnode)); + } + }; + return this; + }, +/** +autocomplete field. +*/ + owl_autocomplete : function(options){ + options = $.extend({ + time:500, //responsetime to check for new keystrokes, default 500 + chars:3, //number of characters needed before autocomplete starts searching + focus:false, //put cursor on the input field when loading + limit:10, //limit size of result list to given amount + contentClass : "ui-widget-content", + focusClass : jOWL.UI.defaults.focusClass, + hintClass : "ui-autocomplete-hint", + hint: false, //Message (if any) to show when unfocused. + onSelect : function(item){}, //function that can be overridden + formatListItem : function(listitem, type, identifier, termarray){ //formatting of results, can be overridden + if(type){ listitem.append($('
').text(type)); } + listitem.append($('
').text(identifier)); + if(termarray.length) { listitem.append($('
').text(termarray.join(', ')) + .prepend($('').addClass('termlabel').text("Terms: "))); + } + }}, options); + jOWL.UI.asBroadcaster(this); + + this.showHint = function(){ + this.hinted = true; + if(options.hint){ + this.addClass(options.hintClass).val(options.hint); + } + else {this.val(''); } + }; + this.showHint(); + + var self = this; var old = ''; var open = false; self.val(''); + var results = $('