Home > SemanticNote

SemanticNote

SemanticNote is a project mainly written in C#, it's free.

A plugin for the Mindtouch platform to enable semantic web notation

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 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

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

============ SemanticNote

A Plugin For Mindtouch platform to enable semantic web notation by Kyle Ellrott ([email protected])

============ BUILD Notes

  • 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: GO, PFAM, UNIPROT, and CORE.

<config xmlns:core="http://purl.uniprot.org/core/" xmlns:TPS="http://topsan.org/purl/" xmlns:GO="http://purl.uniprot.org/go/" xmlns:PFAM="http://purl.uniprot.org/pfam/" xmlns:UNIPROT="http://purl.uniprot.org/uniprot/" xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns:xs="http://www.w3.org/2001/XMLSchema#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:mind="http://mindtouch.com/schema#"

<defaultPredicateNS>core</defaultPredicateNS>
<pageAlias>TPS{0}</pageAlias>
<defaultSubjectNS>TPS</defaultSubjectNS>
<aliasPredicate>core:alias</aliasPredicate>
<altNS>
    <sameAs>owl</sameAs>
</altNS>
<clickMap ns="PFAM">http://pfam.janelia.org/family?acc=</clickMap>
<importMap>
    <UNIPROT>
        <source>
            <graph>http://purl.uniprot.org/uniprot/{0}</graph>
            <url>http://www.uniprot.org/uniprot/{0}.rdf</url>
        </source>
    </UNIPROT>
</importMap>

============ 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" rel="http://purl.uniprot.org/core/classifiedWith" href="http://purl.uniprot.org/go/0030246"> <a rel="external nofollow" href="http://amigo.geneontology.org/cgi-bin/amigo/term-details.cgi?term=GO:0030246" title="http://amigo.geneontology.org/cgi-bin/amigo/term-details.cgi?term=GO:0030246" target="_blank" class=" external">GO:0030246

============ Sample Dekiscript SPARQL query

{{var queryStr="PREFIX core:<http://purl.uniprot.org/core/&gt; PREFIX mind:<http://mindtouch.com/schema#&gt; SELECT * WHERE { ?prot a core:Protein . ?prot mind:pageID ?page_id } LIMIT 10";}}

Page URI Page Deki ID
{{tag['prot']}} {{tag['page_id']}}

============ Sample Deki/Ajax SPARQL query

var endpoint = $("#endpoint").val();
var subject  = $("#subject").val();

function tableRender() {
   var queryStr = "SELECT * FROM <" + subject + ".extras> WHERE { 
?s ?p ?o }";
   $.get( endpoint, { "output":"json", "query" : queryStr },
     function(json) {
       $("#dstTable").empty();
       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 + "<br/>" );
        }
      }
     );
}

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

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

jQuery().ready( tableRender );

 

============ Semantic Note Services

RDFa : This provides a lightweight pure XML version of the page, To get the RDFa version of pageID=47 /@api/deki/site/services/=note/proxy/rdfa?id=47

RDF : This provides a pure RDF version of the semantic information embedded in the page To get the RDFa version of pageID=47 /@api/deki/site/services/=note/proxy/rdf?id=47

Sparql Proxy : A proxy to the configured SPARQL endpoint, primarly used as a access point for AJAX based queries. /@api/deki/site/services/=note/proxy/sparql

============ 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) and ‘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)