A plugin for the Mindtouch platform to enable semantic web notation
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.

You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.


A Plugin For Mindtouch platform to enable semantic web notation
by Kyle Ellrott (kellrott@gmail.com)


- Build SemanticNote C# project and copy SemanticNote.dll to the 
/var/www/dekiwiki/bin/services/ directory.
- Restart dekiwiki and configure new extention with 
SID:'sid://topsan.org/2010/07/extension/note', add configuration 
key 'semantic-config-uri' with URI of configuration XML file.

Basic Configuration

semantic-config-uri (REQUIRED): The URI to the configuration file
plug-name (optional): The user name to the account through which the 
SemanticNote plugin will access the Deki content
plug-pass (optional) : The password to the Deki account
sparql-uri (optional) : The URI to the SPARQL endpoint that will be used
for accessing Semantic Information

Configuration File Format

The following samples is taken from www.topsan.org
Thisconfiguration file adds several namespace base names, including:

<!-- xmlns entries are used to add to accessable base name spaces -->

<!-- user arguments to note.link are automatically defined in the 
defaultPredicateNS namespace -->

<!-- pageAlias defines how Deki Page IDs will be formatted to produce 
aliases -->

<!-- The defaultSubjectNS is used to define the default subject of 
note.link calls. This is combined with the pageAlias to produce the full
subject URI. So for deki pageID=47 the default subject would be 
http://topsan.org/purl/TPS47 -->

<!-- The default subject of a page will be linked it's alias by this 
predicate -->

<!-- altNS namespaces will override the default default predicate. So 
for the following example, the note.link predicate call for 'sameAs' 
will go to the owl namespace, rather then the default core namespace -->

<!-- clickMap maps the displayed hyperlink to a URL different then the 
one listed in the semantic notation -->
	<clickMap ns="PFAM">http://pfam.janelia.org/family?acc=</clickMap>

<!-- importMap defines an import mapping that allows for users to 
request additional data to be imported into the semantic database.
The example below enabled calls like note.import( "UNIPROT:P04637" )

SemanticNote Dekiscript Usage

note.this : Get the default subject for the current page.

note.link : Create a link with embedded semantic information
 - string rel : The predicate of the relationship
 - string value : The value of the object (either link or data value)
 - bool visible : Set to false if link should be invisible
 - string about : Optional definition of link subject 
   (by default note.this())
 - bool rev : set to true if the relationship should be reversed 

note.idea : Create complex idea by unwrapping dekiscript data 
 - hashtable value : the hash table to unwrap
 - string about : Optional definition of link subject 
   (by default note.this())
 - bool visible : Set to true if text should be visible	                

note.import : Request data to be imported into Semantic Database
 - string request : CURIE of requested data

note.lookup : Change CURIE or URI to full URI
 - string curie : Input CURIE
note.lookupClick : Change CURIE or URI to clickable URL
 - string curie : Input CURIE

note.query : Make a sparql query to the backend semantic database
  - string queryStr : The sparql query to be run against the database

note.endpoint : Get the URL for the SPARQL endpoint proxy.

Sample Dekiscript note.link call

When called from the Deki page 47:
{{note.link( 'classifiedWith', 'GO:0030246') }}

Produces the HTML:
<span about="http://topsan.org/purl/TPS47" 
<a rel="external nofollow" 
target="_blank" class=" external">GO:0030246</a></span>

Sample Dekiscript SPARQL query

{{var queryStr="PREFIX core:&lt;http://purl.uniprot.org/core/&gt; PREFIX mind:&lt;http://mindtouch.com/schema#&gt; SELECT * WHERE { ?prot a core:Protein . ?prot mind:pageID ?page_id } LIMIT 10";}}</p>
			<td>Page URI</td>
			<td>Page Deki ID</td>
		<tr foreach="var tag in note.query(queryStr)">

Sample Deki/Ajax SPARQL query
<input id="endpoint" type="hidden" value="{{note.endpoint();}}" />
<input id="subject" type="hidden" value="{{note.this();}}" />
<pre class="script-jem">
var endpoint = $("#endpoint").val();
var subject  = $("#subject").val();

function tableRender() {
   var queryStr = "SELECT * FROM &lt;" + subject + ".extras&gt; WHERE { 
?s ?p ?o }";
   $.get( endpoint, { "output":"json", "query" : queryStr },
     function(json) {
       for (var y in json.results.bindings) {
         var url = json.results.bindings[y]['s']['value'];
         var obj = json.results.bindings[y]['o']['value'];
         $("#dstTable").append( url + " " + obj + "&lt;br/&gt;" );

function titleInput() {
   var newTitle = $("#title_text").val();
   var queryStr = "INSERT INTO &lt;" + subject + ".extras&gt; { &lt;" + 
subject + "&gt; &lt;http://purl.uniprot.org/core/title&gt; '" + newTitle 
+ "' } ";

   $.get( endpoint, { "output":"json", "query" : queryStr },
     function(json) {
       //$("#dstTable").append( json );

jQuery().ready( tableRender );

<p><span id="dstTable">&nbsp;</span></p>
<p><input id="title_text" type="text" /><input onclick="titleInput();" 
type="button" value="Search" /></p>

Semantic Note Services

RDFa : This provides a lightweight pure XML version of the page, 
To get the RDFa version of pageID=47

RDF : This provides a pure RDF version of the semantic information 
embedded in the page
To get the RDFa version of pageID=47

Sparql Proxy : A proxy to the configured SPARQL endpoint, primarly used 
as a access point for AJAX based queries.

Advanced Configuration

Working with Virtuoso Authenticated sparql interface:
- Adjust the sparql configurations as well.  For the authenticated 
virtuoso server add 
‘sparql-name’ (virtuoso user name) 
‘sparql-pass’ (virtuoso password)

Note: deki plug interface only supports ‘BASIC’ authentication 
(not ‘DIGEST’, so the security on the authenitcated sparql page will 
need to be down graded, see Virtuoso Installation instructions)