Thursday, March 30, 2017

Processing TechJobs to JSON

(1) Extracting the keys of the object is easy.
(2) Mapping the keys to a ontology predicate is easy for small numbers of keys.
(3) Extracting relevant keywords from the job descriptions is harder

(for 3) At a crude level mapping the words to keywords could be done through tokenization and manual mapping. But what about something fancier like Apache Stanbol? https://stanbol.apache.org/docs/trunk/components/enhancer/nlp/

Techjobs to JSON via *nix tools

Early experiments dumping https://jobs.techlahoma.org/jobs/ as a json object:

curl https://jobs.techlahoma.org/jobs/  | \
grep -o "window.REACT_INITIAL_PROPS = {.*}" | \
sed 's/window.REACT_INITIAL_PROPS = //g'

Tuesday, March 28, 2017

Notes from Setting up Virtuoso for PowerAqua (pt1)

Per conversation with Vanessa Lopez, it is easier to set up Virtuoso with PowerAqua (as it provides its own index) than it is to set up PowerAqua with Sesame (as it does not provide its own index and needs to be indexed by Lucene).

The question I have naturally, is how do I get virtuoso running?

I followed installation instructions for  installation virtuoso open-source with aptitude:


https://virtuoso.openlinksw.com/dataspace/doc/dav/wiki/Main/VOSUbuntuNotes

sudo aptitude install  virtuoso-opensource


 I did not set the password. I need to move virtuoso.ini from /etc/virtuoso-opensource-6.1 ?

I need to feed the virtuoso.ini file to this somehow.(follow the instructions here)

Revert to Getting Started in the VOSUbuntuNotes

https://github.com/dbpedia/dbpedia-docs/wiki/Loading-Data-Virtuoso


Also see the last paragraph in the installation section:

"dpkg / rpm installation provide init.d scripts (that may not be enabled by default) and can be invoked by sudo service virtuoso-opensource {start|stop|force-stop|restart}. Compiled installations can reuse the existing script or start with {install-dir}/bin/virtuoso-t -f <virtuoso.ini file>"

https://github.com/dbpedia/dbpedia-docs/wiki/Loading-Data-Virtuoso


If that does not work follow the instructions here:
https://github.com/openlink/virtuoso-opensource

Monday, March 27, 2017

Dokieli exploration log ( cont . ) ...

PUT
XHR
https://bshambaugh.databox.me/acbb6d44-e31e-4f7f-8a3d-6e65cc97a379 [HTTP/2.0 201 Created 171ms]

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
        <meta charset="utf-8" />
        <title>https://bshambaugh.databox.me/acbb6d44-e31e-4f7f-8a3d-6e65cc97a379</title>
    </head>
    <body>
        <main>
<article id="acbb6d44-e31e-4f7f-8a3d-6e65cc97a379" about="i:" typeof="oa:Annotation" prefix="rdf: http://www.w3.org/1999/02/22-rdf-syntax-ns# schema: http://schema.org/ dcterms: http://purl.org/dc/terms/ oa: http://www.w3.org/ns/oa# as: https://www.w3.org/ns/activitystreams# i: https://bshambaugh.databox.me/acbb6d44-e31e-4f7f-8a3d-6e65cc97a379">
  <h1 property="schema:name">Brent Shambaugh <span rel="oa:motivatedBy" resource="oa:replying">replies</span></h1>
  <dl class="author-name"><dt>Authors</dt><dd><span rel="schema:creator"><span about="https://bshambaugh.databox.me/profile/card#me" typeof="schema:Person"><img alt="" height="48" rel="schema:image" src="https://www.gravatar.com/avatar/44ddb1f95dd88538aba49334131c4295?d=404&s=300" width="48" /> <a href="https://bshambaugh.databox.me/profile/card#me"><span about="https://bshambaugh.databox.me/profile/card#me" property="schema:name">Brent Shambaugh</span></a></span></span></dd></dl>
  <dl class="published"><dt>Published</dt><dd><a href="https://bshambaugh.databox.me/acbb6d44-e31e-4f7f-8a3d-6e65cc97a379"><time datetime="2017-03-27T15:15:42.068Z" datatype="xsd:dateTime" property="schema:datePublished" content="2017-03-27T15:15:42.068Z">2017-03-27 15:15:42</time></a></dd></dl>
  <dl class="rights"><dt>Rights</dt><dd><a href="https://creativecommons.org/licenses/by/4.0/" rel="dcterms:rights" title="Creative Commons Attribution">CC BY 4.0</a></dd></dl>
  <dl class="canonical"><dt>Canonical</dt><dd about="i:" rel="oa:canonical" resource="urn:uuid:2f8abc99-0e7d-4849-8a9f-7d28f9121365">2f8abc99-0e7d-4849-8a9f-7d28f9121365</dd></dl>
  <dl class="target"><dt><a href="https://bshambaugh.databox.me/Public/ed42bcb8-8a9d-48bf-a150-6c9247998c0c#introduction" rel="oa:hasTarget">In reply to</a> (<a about="https://bshambaugh.databox.me/Public/ed42bcb8-8a9d-48bf-a150-6c9247998c0c#introduction" href="https://bshambaugh.databox.me/Public/ed42bcb8-8a9d-48bf-a150-6c9247998c0c" rel="oa:hasSource" typeof="oa:SpecificResource">part of</a>)</dt><dd><blockquote about="https://bshambaugh.databox.me/Public/ed42bcb8-8a9d-48bf-a150-6c9247998c0c#introduction" cite="https://bshambaugh.databox.me/Public/ed42bcb8-8a9d-48bf-a150-6c9247998c0c#introduction"><span rel="oa:hasSelector" resource="i:#fragment-selector" typeof="oa:FragmentSelector"><meta property="rdf:value" content="#introduction" xml:lang="" lang="" rel="dcterms:conformsTo" resource="https://tools.ietf.org/html/rfc3987" /><span rel="oa:refinedBy" resource="i:#text-quote-selector" typeof="oa:TextQuoteSelector"><span property="oa:prefix" xml:lang="en" lang="en">ation, while others are free to </span><mark property="oa:exact" xml:lang="en" lang="en">selectively (dis-)trust certain sources using any mechanism they desire</mark><span property="oa:suffix" xml:lang="en" lang="en">.</span></span></span></blockquote></dd></dl><dl class="renderedvia"><dt>Rendered via</dt><dd><a about="https://bshambaugh.databox.me/Public/ed42bcb8-8a9d-48bf-a150-6c9247998c0c#introduction" href="https://dokie.li/" rel="oa:renderedVia">dokieli</a></dd></dl>
  <section id="note-acbb6d44-e31e-4f7f-8a3d-6e65cc97a379" rel="oa:hasBody" resource="i:#note-acbb6d44-e31e-4f7f-8a3d-6e65cc97a379"><h2 property="schema:name">Note</h2><div datatype="rdf:HTML" property="rdf:value schema:description" resource="i:#note-acbb6d44-e31e-4f7f-8a3d-6e65cc97a379" typeof="oa:TextualBody">Fake News!</div><dl class="rights"><dt>Rights</dt><dd><a href="https://creativecommons.org/licenses/by/4.0/" rel="dcterms:rights" title="Creative Commons Attribution">CC BY 4.0</a></dd></dl></section>
</article>

        </main>
    </body>
</html>

POST
XHR
https://linkedresearch.org/inbox/csarven.ca/dokieli-rww/ [HTTP/2.0 201 Created 191ms]

@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix as: <https://www.w3.org/ns/activitystreams#> .
@prefix oa: <http://www.w3.org/ns/oa#> .
@prefix schema: <http://schema.org/> .
<> a as:Announce
  ; as:object <https://bshambaugh.databox.me/acbb6d44-e31e-4f7f-8a3d-6e65cc97a379>
  ; as:target <https://bshambaugh.databox.me/Public/ed42bcb8-8a9d-48bf-a150-6c9247998c0c#introduction>
  ; as:updated "2017-03-27T15:15:42.717Z"^^xsd:dateTime
  ; as:actor <https://bshambaugh.databox.me/profile/card#me>
  ; schema:license <https://creativecommons.org/licenses/by/4.0/>
  .
<https://bshambaugh.databox.me/acbb6d44-e31e-4f7f-8a3d-6e65cc97a379> a oa:Annotation
  ; oa:motivation oa:replying

Interesting functions:

positionInteraction: function(noteIRI, containerNode) {...}

But it was this:

createNoteDataHTML: function(n) { .. }

For PUT ( https://github.com/linkeddata/dokieli/blob/master/scripts/do.js ) it is in:
2514 - 2517 :

if (inbox.length > 0) {
inbox = inbox[0];
var notificationStatements = '<' + noteIRI + '> a oa:Annotation\n\
; oa:motivation ' + motivatedBy + '\n\
.';
var notificationData = {
"type": ['as:Announce'],
"inbox": inbox,
"object": noteIRI,
"target": iri,
"license": noteData.license["iri"],
"statements": notificationStatements
};

Dokieli exploration log ... (edited)

Brent Shambaugh
@bshambaugh
Mar 26 20:39
Screenshot from 2017-03-26 20:35:07.png


Brent Shambaugh
@bshambaugh
Mar 26 20:45
Screenshot from 2017-03-26 20:41:59.png


PUT
XHR
http://linkeddata.github.io/warp/#/list/https/bshambaugh.databox.me/ [HTTP/1.1 405 Method Not Allowed 421ms]
saving

Brent Shambaugh
@bshambaugh
Mar 26 20:52
https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/405 (PUT is disabled on my databox server so I cannot assign it an owner, My WebID and a randomly created key??) The hash is my annotation in dokieli.



Brent Shambaugh
@bshambaugh
Mar 26 20:57
This PUT 405 happens the second time I touch the LDP resource. The first time I get 419bb2de-ad36-46e4-98b4-ffa7ee92e59d and it creates 419bb2de-ad36-46e4-9 8b4-ffa7ee92e59d,acl .
maybe this is how it is supposed to work. I recall that each thing (resource?) in solid needed an .acl .
I was expecting to see my annotations on http://csarven.ca/dokieli-rww after I gave a read permission in the .acl.
I'm new at setting permissions for appearing in dokieli.

Brent Shambaugh
@bshambaugh
Mar 26 21:21
Thinking I could annotate a copy... I just saved it to https://bshambaugh.databox.me/Public/20fc35a8-2cda-4d63-8a60-f1ab82613aaf . It looks like a 1995 website. Some of the styling is failing per the browser dev tools. Trying another browser.
(also connection is not secure warning when loading copy due to images)

Brent Shambaugh
@bshambaugh
Mar 26 21:28
Interesting chrome errors:

margin
border
padding

ConsoleSearchEmulationRendering

Preserve log
.
20fc35a8-2cda-4d63-8a60-f1ab82613aaf:7 Mixed Content: The page at 'https://bshambaugh.databox.me/Public/20fc35a8-2cda-4d63-8a60-f1ab82613aaf' was loaded over HTTPS, but requested an insecure stylesheet 'http://csarven.ca/media/css/index.css'. This request has been blocked; the content must be served over HTTPS.
20fc35a8-2cda-4d63-8a60-f1ab82613aaf:1 Mixed Content: The page at 'https://bshambaugh.databox.me/Public/20fc35a8-2cda-4d63-8a60-f1ab82613aaf' was loaded over HTTPS, but requested an insecure image 'http://csarven.ca/media/images/articles/dokieli-architecture-relations.png
'. This content should also be served over HTTPS.
20fc35a8-2cda-4d63-8a60-f1ab82613aaf:1 Mixed Content: The page at 'https://bshambaugh.databox.me/Public/20fc35a8-2cda-4d63-8a60-f1ab82613aaf' was loaded over HTTPS, but requested an insecure image 'http://www.gravatar.com/avatar/0ca0a18603cbd049900ebea3a3bb29d4?size=48'. This content should also be served over HTTPS.
20fc35a8-2cda-4d63-8a60-f1ab82613aaf:1 Mixed Content: The page at 'https://bshambaugh.databox.me/Public/20fc35a8-2cda-4d63-8a60-f1ab82613aaf' was loaded over HTTPS, but requested an insecure image 'http://csarven.ca/media/images/articles/graph-dokieli-rww.png
'. This content should also be served over HTTPS.
20fc35a8-2cda-4d63-8a60-f1ab82613aaf:1 Mixed Content: The page at 'https://bshambaugh.databox.me/Public/20fc35a8-2cda-4d63-8a60-f1ab82613aaf' was loaded over HTTPS, but requested an insecure image 'http://www.gravatar.com/avatar/5f21466d48da7c7e27b882e530ffff50?size=48'. This content should also be served over HTTPS.
20fc35a8-2cda-4d63-8a60-f1ab82613aaf:1 Mixed Content: The page at 'https://bshambaugh.databox.me/Public/20fc35a8-2cda-4d63-8a60-f1ab82613aaf' was loaded over HTTPS, but requested an insecure image 'http://www.gravatar.com/avatar/0ca0a18603cbd049900ebea3a3bb29d4?size=48'. This content should also be served over HTTPS.
20fc35a8-2cda-4d63-8a60-f1ab82613aaf:1 Mixed Content: The page at 'https://bshambaugh.databox.me/Public/20fc35a8-2cda-4d63-8a60-f1ab82613aaf' was loaded over HTTPS, but requested an insecure image 'http://csarven.ca/media/images/sarven-capadisli.jpg
'. This content should also be served over HTTPS.
20fc35a8-2cda-4d63-8a60-f1ab82613aaf:211 Mixed Content: The page at 'https://bshambaugh.databox.me/Public/20fc35a8-2cda-4d63-8a60-f1ab82613aaf' was loaded over HTTPS, but requested an insecure image 'http://csarven.ca/media/images/articles/dokieli-architecture-relations.png
'. This content should also be served over HTTPS.
20fc35a8-2cda-4d63-8a60-f1ab82613aaf:436 Mixed Content: The page at 'https://bshambaugh.databox.me/Public/20fc35a8-2cda-4d63-8a60-f1ab82613aaf' was loaded over HTTPS, but requested an insecure image 'http://www.gravatar.com/avatar/0ca0a18603cbd049900ebea3a3bb29d4?size=48'. This content should also be served over HTTPS.
20fc35a8-2cda-4d63-8a60-f1ab82613aaf:438 Mixed Content: The page at 'https://bshambaugh.databox.me/Public/20fc35a8-2cda-4d63-8a60-f1ab82613aaf' was loaded over HTTPS, but requested an insecure image 'http://csarven.ca/media/images/articles/graph-dokieli-rww.png
'. This content should also be served over HTTPS.
20fc35a8-2cda-4d63-8a60-f1ab82613aaf:442 Mixed Content: The page at 'https://bshambaugh.databox.me/Public/20fc35a8-2cda-4d63-8a60-f1ab82613aaf' was loaded over HTTPS, but requested an insecure image 'http://www.gravatar.com/avatar/5f21466d48da7c7e27b882e530ffff50?size=48'. This content should also be served over HTTPS.
.
++++++++++++++++
Warp ==> SoliD is only accessible over HTTPS ... http://bshambaugh.databox.me/Public/20fc35a8-2cda-4d63-8a60-f1ab82613aaf
redirects to https://bshambaugh.databox.me/Public/20fc35a8-2cda-4d63-8a60-f1ab82613aaf

Brent Shambaugh
@bshambaugh
Mar 26 21:34
curl http://bshambaugh.databox.me/Public/20fc35a8-2cda-4d63-8a60-f1ab82613aaf
curl: (7) Failed to connect to bshambaugh.databox.me port 80: Connection refused
Can I get http://csarven.ca/dokieli-rww over https?
https://csarven.ca/dokieli-rww resolves
Saving https://csarven.ca/dokieli-rww to https://bshambaugh.databox.me/Public/ed42bcb8-8a9d-48bf-a150-6c9247998c0c resolves the styling .
Brent Shambaugh
@bshambaugh
Mar 26 21:45


Screenshot from 2017-03-26 21:41:27.png
I was expecting to see my profile picture, but instead I see :

    https://linkedresearch.org/annotation/csarven.ca/dokieli-rww/51e9dcb1-55fb-4151-8372-1f37c9639acd#agent

    2017-03-27 02:40:25

This is an annotation. I think that the Linked Data Platform is very cool!


so I need to log in
So I put in my webID and the profile image appears. (NB: there needs to be a way to keep me logged in across browser windows. I was already logged into WARP)


replace: https://bshambaugh.databox.me/profile/card#me


Brent Shambaugh
@bshambaugh
Mar 26 21:52
I added another annotation, and it appears at the parent LDP container. Feature request: save in target LDP container..say Public.


Brent Shambaugh
@bshambaugh
10:41
(For my record) When I do an annotation to my personal storage:
GET
https://csarven.ca/media/css/index.css [HTTP/2.0 200 OK 0ms]
PUT
XHR
https://bshambaugh.databox.me/acbb6d44-e31e-4f7f-8a3d-6e65cc97a379 [HTTP/2.0 201 Created 171ms]
GET
XHR
https://bshambaugh.databox.me/acbb6d44-e31e-4f7f-8a3d-6e65cc97a379 [HTTP/2.0 200 OK 101ms]
OPTIONS
XHR
https://linkedresearch.org/inbox/csarven.ca/dokieli-rww/ [HTTP/2.0 204 No Content 207ms]
OPTIONS
XHR
https://linkedresearch.org/inbox/csarven.ca/dokieli-rww/ [HTTP/2.0 204 No Content 254ms]
OPTIONS
XHR
https://linkedresearch.org/inbox/csarven.ca/dokieli-rww/ [HTTP/2.0 204 No Content 161ms]
POST
XHR
https://linkedresearch.org/inbox/csarven.ca/dokieli-rww/ [HTTP/2.0 201 Created 191ms]
... The payloads for PUT and POST are ... the corresponding code in dokieli is .. dokieli/do.js (?) need to find a place to log this ..

positionInteraction: function(noteIRI, containerNode) { ...}

but for PUT it looks to be: createNoteDataHTML: function(n) { .. }

Thinking out loud. In summary it looks like I need to access dokieli via https, and any saved version over https. Annotations saved in warp get an associated .acl . Once the .acl is created further modifications to the annotation when saved return HTTP status 405. Annotations do not save to a specified container, instead a top level one (I was digging in the code to see if this can be changed).

Thursday, March 23, 2017

linkDistance - D3 study

Understanding D3.js Force Layout - 4: linkDistance

http://bl.ocks.org/sathomas/83515b77c2764837aac2

Tuesday, March 21, 2017

Preparing a pull request for an outdated fork

I have a directory on github at : http://github.com/bshambaugh/ovn

It was behind http://github/valueflows/valueflows.

So I needed to first configure a remote for a fork:

https://help.github.com/articles/configuring-a-remote-for-a-fork/

then sync it by branch with valueflows/valueflows:

https://help.github.com/articles/syncing-a-fork/

Now I want to do a Pull Request with the json file created with owl2vowl?

well at least it is at:

https://github.com/bshambaugh/ovn/blob/master/release-doc-in-process/all_vf.json

Friday, March 17, 2017

Loading Data in node-arc-d3

Starting from the top of the flowchart in https://github.com/bshambaugh/node-arc-d3 :

I have issues:
https://github.com/bshambaugh/node-arc-d3/issues/7
(SPARQL Queries)
https://github.com/bshambaugh/node-arc-d3/issues/13
(Have a box to load ldp containers, turtle files, and perform sparql queries)

And excerpts from the EISPP wireframes (http://bshambaugh.org/eispp):

Loading RDF files and LDP containers

Loading RDF Files

Save data/load data

 Save data
SPARQL Queries



These wireframe screenshots involve both GET and POST. For now I will use GET. I will also do disambiguation as mentioned in Issue 13.
https://github.com/bshambaugh/node-arc-d3/tree/master/js/tests/sparqlldpfiledisambig


Use URIjs to show the query parameter and the path, and follow a flowchart like:

Eventually, it is hoped, that NLQ will also be a data source:


Like In the EISPP wireframe:


To get this is I am reading the PowerAqua Thesis, to use it to extract relevant facts, which I believe are triples. PowerAqua helped build Miriam Fernandez' Thesis:


(A thesis presented for the degree of Doctor of Philosophy in Computer SciencePowerAqua:Open Question Answeringon the Semantic Web, V. Lopez)
http://technologies.kmi.open.ac.uk/poweraqua/thesis-master-viva.pdf


Tuesday, March 14, 2017

Link Labels in D3 at Midpoint:

Adding a Label to the Links (StackOverflow):

http://stackoverflow.com/questions/23470330/adding-label-to-the-links-in-d3-force-directed-graph

Labels to avoid overlap:

http://stackoverflow.com/questions/17425268/d3js-automatic-labels-placement-to-avoid-overlaps-force-repulsion

Meh.. (place a node at the midpoint where the node label should be somehow)

???

 var linknodes = svgContainer.append("g")
                  .attr("class","nodes")
                  .selectAll("circles")
                  .data(graph.links)
                  .enter().append("circle").attr("r",20)
                  .attr("fill", function(d) { return color(d.group); })
                  .call(d3.drag()
                  .on("start", dragstarted)
                  .on("drag", dragged)
                  .on("end", dragended));

function ticked() {

    linknodes
        .attr("x", function(d) { return (d.source.x + d.target.x)/2; })
        .attr("y", function(d) { return (d.source.y + d.target.y)/2; });

}

simulation
      .nodes("brents midpoint nodes")
      .on("tick", ticked);

but this does not work....I need to figure out how to create nodes on the fly

http://stackoverflow.com/questions/9539294/adding-new-nodes-to-force-directed-layout

references : https://bl.ocks.org/mbostock/1095795

http://stackoverflow.com/questions/17529522/transparent-color-in-javascript-d3-js

D3 Force Directed Graph with Fit Node Labels and Collision Detection

Key code:

.force("collide", d3.forceCollide(60));

       .enter().append("ellipse")
       .attr("rx", function(d) { return d.id.length * 4 })
       .attr("ry", 15)
      .attr("fill", function(d) { return color(d.group); })

Full code
(seeAlso: https://github.com/bshambaugh/node-arc-d3/blob/master/js/d3sketch.js) :

function draw(width,height,graph) {

 // see https://bl.ocks.org/mbostock/4062045

 var svgContainer = d3.select("body").append("svg")
                                       .attr("width",width)
                                       .attr("height",height);

  var color = d3.scaleOrdinal(d3.schemeCategory20);

  var simulation = d3.forceSimulation()
//    .force("link", d3.forceLink().id(function(d) { return d.id; }).distance(300).strength(0.5))
    .force("link", d3.forceLink().id(function(d) { return d.id; }))
    .force("charge", d3.forceManyBody())
    .force("center", d3.forceCenter(width / 2, height / 2))
    .force("collide", d3.forceCollide(60));

  var link = svgContainer.append("g")
      .attr("class", "links")
    .selectAll("line")
    .data(graph.links)
    .enter().append("line")
      .attr("stroke-width", function(d) { return Math.sqrt(d.value); });

    // Extended d3 force directed graphs with link labels

    var linklabel = svgContainer.append("g")
                  .attr("class","links")
                  .selectAll("text")
                  .data(graph.links)
                  .enter().append("text");

var linklabels = linklabel
                    .text( function(d) { return d.label; })
                    .attr("font-family","sans-serif")
                    .attr("font-size","10px")
                    .attr("fill","black");


  var nodevar = svgContainer.append("g")
      .attr("class", "nodes")
    .selectAll("circle")
    .data(graph.nodes)
//    .enter().append("circle")
//      .attr("r", 5)
       .enter().append("ellipse")
       .attr("rx", function(d) { return d.id.length * 4 })
       .attr("ry", 15)
      .attr("fill", function(d) { return color(d.group); })
      .call(d3.drag()
          .on("start", dragstarted)
          .on("drag", dragged)
          .on("end", dragended));

    // Extended d3 dforce directed graph with node labels

    var nodelabel = svgContainer.append("g")
                   .attr("class","nodes")
                   .selectAll("text")
                   .data(graph.nodes)
                   .enter()
                   .append("text")
                   .call(d3.drag()
                       .on("start", dragstarted)
                       .on("drag", dragged)
                       .on("end", dragended));

   var nodelabels = nodelabel
                  //  .attr("x", function(d) { return d.x; })
                  //  .attr("y", function(d) { return d.y; })
                    .text( function(d)  { return d.id; })
                    .attr("font-family","sans-serif")
                    .attr("font-size","10px")
                    .attr("fill","black")
                    .attr("text-anchor", "middle");


   nodevar.append("title")
      .text(function(d) { return d.id; });

  simulation
      .nodes(graph.nodes)
      .on("tick", ticked);

  simulation.force("link")
      .links(graph.links);

  function ticked() {
    link
        .attr("x1", function(d) { return d.source.x; })
        .attr("y1", function(d) { return d.source.y; })
        .attr("x2", function(d) { return d.target.x; })
        .attr("y2", function(d) { return d.target.y; });

    // extended with link labels

    linklabels
        .attr("x", function(d) { return (d.source.x + d.target.x)/2; })
        .attr("y", function(d) { return (d.source.y + d.target.y)/2; });

    nodevar
        .attr("cx", function(d) { return d.x; })
        .attr("cy", function(d) { return d.y; });

      // extended with node labels

     nodelabels
        .attr("x", function(d) { return d.x; })
        .attr("y", function(d) { return d.y; });
  }


  function dragstarted(d) {
  if (!d3.event.active) simulation.alphaTarget(0.3).restart();
  d.fx = d.x;
  d.fy = d.y;
}

function dragged(d) {
  d.fx = d3.event.x;
  d.fy = d3.event.y;
}

function dragended(d) {
  if (!d3.event.active) simulation.alphaTarget(0);
  d.fx = null;
  d.fy = null;
}

};

======================================

TODO: Express edge labels as transparent nodes centered at the midpoint of the edge, so that the force collide method applies?




Sunday, March 12, 2017

D3 mindmaps and tutorials

Mindmaps with D3:

http://thomasrickard.uk/articles/d3---mindmaps-%28v4%29-13-08-2016.html

D3 Force Directed Graph (curved edges) http://jsfiddle.net/skysigal/gp0u5rLu/
I will need these if there are two or more triples that share the same subject and object.

D3 Tutorials from Slideshare:

https://www.slideshare.net/josdirksen/learn-d3js-in-90-minutes

https://www.slideshare.net/YoungHoKim6/a-quick-and-dirty-d3js-tutorial?next_slideshow=1

https://www.slideshare.net/miconi/d3introduction?next_slideshow=2

Collision Detection:

http://fwz.github.io/2013/09/15/learn-d3-the-hard-way-(1)----collision-detection/

related to: https://bl.ocks.org/mbostock/1747543
https://bl.ocks.org/mbostock/3231298

Nodes and edges:

http://stackoverflow.com/questions/17920704/avoid-collision-between-nodes-and-edges-in-d3-force-layout

I suppose the collision between nodes and edges is like the collision between a node and a line of nodes. Think Analytical Geometry! You also need to worry about the labels as well.

Link Length:

https://gist.github.com/sathomas/83515b77c2764837aac2

Questions about Sigmajs

See: http://sigmajs.org/
Build from: https://github.com/jacomyal/sigma.js

Is it possible to draw a graph without providing node positions? Answer, provide random initial node positions or provide positions on a circle and then run ForceAtlas2 layout engine?
https://github.com/jacomyal/sigma.js/issues/336

Then the question is, how do you stop the ForceAtlas2 layout engine?


How do you show edge labels?
http://stackoverflow.com/questions/19401147/show-edge-label-in-sigma-jsHow do I click on edges and have something happen?

https://github.com/jacomyal/sigma.js/wiki/Events-API

Thursday, March 9, 2017

Modify d3 force directed graph


    .force("link", d3.forceLink().id(function(d) { return d.id; }).distance(300).strength(0.5))
//    .force("link", d3.forceLink().id(function(d) { return d.id; }))



http://stackoverflow.com/questions/39244186/how-do-you-set-a-fixed-link-distance-with-d3-v4

https://github.com/d3/d3-force



change the lines in " var nodevar"

//    .enter().append("circle")
//      .attr("r", 5)
     .enter().append("ellipse")
      .attr("rx", 60)
      .attr("ry", 15)

//    .enter().append("circle")


Tuesday, March 7, 2017

Getting PowerAqua Running with Tomcat 7 - NLQ for Semantic Search

I navigated to the PowerAqua site:
http://technologies.kmi.open.ac.uk/poweraqua/

Then I navigated to SourceForge

https://sourceforge.net/projects/poweraqua/files/code/webapps-tomcat/poweraqualinked.zip

I dumped the unzipped PowerAquaLinked folder into my tomcat7/webapps/ROOT directory, but it does not initiate with the init.jsp script like I think it should from index.html.

The sample app works https://tomcat.apache.org/tomcat-7.0-doc/appdev/sample/ and a static index.html file work. Perhaps it is a configuration option.
I did not touch anything. It just 404s now.

Investigation of the file service_properties.xml shows a lot of paths with the prefix http://kmi-web03.open.ac.uk . ping http://kmi-web03.open.ac.uk gives
ping: http://kmi-web03.open.ac.uk unknown host. The same for port 8080.
ping: unknown host http://kmi-web03.open.ac.uk:8080

service_properties.xml contains the host kmi-web15.open.ac.uk on port 8890, which also does not exist. (ping: unknown host kmi-web15.open.ac.uk:8890) .

multi_index_properties.xml contains installation specific code like:
/Applications/apache-tomcat-5.5.23/webapps/poweraqualinked/LuceneIndexes/

so does indexproperties: index_properties.xml .

--------------------------------------------

so I need to derive a list of services that I need to set up, and then I need to reference them:

First I know I need a sql database:
https://sourceforge.net/projects/poweraqua/files/mysql%20indexes%20backup/

From service_properties.xml :

See: https://sourceforge.net/projects/sesame/

<PLUGIN_MANAGER>/Applications/apache-tomcat-5.5.23/webapps/poweraqualinked/WEB-INF/aquaplugins</PLUGIN_MANAGER>

<SERVER>http://kmi-web03.open.ac.uk:8080/sesame</SERVER>

cat service_properties.xml | grep -o "<REPOSITORY_NAME>http://[a-z0-9.\/:-]*" | grep -o "/[a-z]*" | grep -o "[a-z]*" | sort | uniq

academia
agent
aktivesa
angioplasty
animals
apocalypse
autos
baberuth
baltimoremayor
beavers
beer
bengal
biomedical
biopax
biosphere
biozen
calcium
census
chevrolet
children
coastalontology
conclusions
cyclic
danchundogs
dbpedia
deer
diseases
doap
dog
earthrealm
eculture
eldorado
elements
fao
fasting
fearlus
filmfestival
finance
flows
foaf
food
formdemo
functions
fungalv
galen
geneontology
gps
gutenberg
helmet
human
hunger
imdb
infrastructure
jackierobinson
jamendo
jennifer
kanzakimusic
kappaalphapsi
kimo
kmi
koala
ksw
lavalamps
lighbulb
lod
magnatude
material
mensa
mid
moses
moviedatabase
music
mygrid
ncioncology
newport
ontoworld
parkinson
peergynt
people
periodictable
person
phenomena
phenomenon
pizza
plainmoor
premises
process
property
rosebowl
royalcaribbean
russia
semanticconferences
sesame
skoda
space
sparql
stconcepts
steinbach
sweetjplnasa
tapfull
tartan
taxonomy
time
tiposcomida
tmj
traffic
travel
trees
upm
utexas
wave
wildlife
zirconium

Virtuoso Properties (virtuoso_properties.xml):

<?xml version="1.0" encoding="UTF-8"?>
<CONFIGURATION>

<SERVER>
    <URL>kmi-web15.open.ac.uk</URL>
    <PORT>8890</PORT>
    <LOGIN>dba</LOGIN>
    <PASSWORD>dba</PASSWORD>
    <GRAPHS>
        <GRAPH>
            <IRI>http://dbpedia.org</IRI>
            <TYPE>OWL</TYPE>
        </GRAPH>
    </GRAPHS>
</SERVER>

</CONFIGURATION>

Multi-Index Properties ():

<CONFIGURATION>
    <WATSON>true</WATSON>
   <POWERMAP>true</POWERMAP>
   <VIRTUOSO>true</VIRTUOSO>     <REMOTESPARQLVIRTUOSO>false</REMOTESPARQLVIRTUOSO><ONTOLOGY_INDEX_DB>
jdbc:mysql://localhost:3306/ontologyindexrelation
</ONTOLOGY_INDEX_DB>
<ONTOLOGY_INDEX_DB_LOGIN>
root
</ONTOLOGY_INDEX_DB_LOGIN>
<ONTOLOGY_INDEX_DB_PASSWORD/>
<INDEX_GLOBAL_PATH>
/Applications/apache-tomcat-5.5.23/webapps/poweraqualinked/LuceneIndexes/</INDEX_GLOBAL_PATH>
 <INDEX_INFO_FOLDER>
 ./indexListInformation/indexkmiweb07-philips/
 </INDEX_INFO_FOLDER>
</CONFIGURATION>

cat index_properties.xml | grep -o "<METADATA_INDEX_TABLE>[a-z0-9.\/:-]*" |  grep -o "[a-z0-9.\/:-]*" | sort | uniq

<INDEX_DIRECTORY>
indexkmiweb07linkedata/index
indexkmiweb07mysql/index
indexkmiweb07pg/index
indexkmiweb07trec/index
indexkmiweb07uam/index

compare to: /poweraqualinked/LuceneIndexes$

indexkmiweb07linkedata
indexkmiweb07mysql
indexkmiweb07pg
indexkmiweb07trec
indexkmiweb07-trec
indexkmiweb07uam

<SPELL_INDEX_DIRECTORY>
indexkmiweb07linkedata/spell
indexkmiweb07mysql/spell
indexkmiweb07pg/spell
indexkmiweb07trec/spell
indexkmiweb07uam/spell

<METADATA_INDEX_TABLE>
indexkmiweb07linkedata
indexkmiweb07mysql
indexkmiweb07pg
indexkmiweb07trec
indexkmiweb07uam

----------------------
The next step should be to look at the database backup. I don't know where all of the repositories come from for sesame. I was unable to find them in the downloaded files (excluding the database backup).

backup-ontologyindexrelation_2012-01-03_19.13.03.sql
backup-metadataindex-jul09_2012-01-03_19.13.34.sql

https://forums.mysql.com/read.php?10,195091,195097

I get something like:
ERROR 1045: Access denied for user: 'root@localhost' (Using 
password: NO)
 
 
metadataindex

    indexkmiweb07eculturedirectclasses

       id  ontologyId  entityURI  classURI  classLabel
    indexkmiweb07eculturedirectsubclasses
    indexkmiweb07eculturedirectsuperclasses
    indexkmiweb07ecultureequivalent
    indexkmiweb07eculturesubclasses
    indexkmiweb07eculturesuperclasses
    indexkmiweb07fiatdirectclasses
    indexkmiweb07fiatdirectsubclasses
    indexkmiweb07fiatdirectsuperclasses
    indexkmiweb07fiatequivalent
    indexkmiweb07fiatsubclasses
    indexkmiweb07fiatsuperclasses
    indexkmiweb07linkedatadirectclasses
    indexkmiweb07linkedatadirectsubclasses
    indexkmiweb07linkedatadirectsuperclasses
    indexkmiweb07linkedataequivalent
    indexkmiweb07linkedatasubclasses
    indexkmiweb07linkedatasuperclasses
    indexkmiweb07mysqldirectclasses
    indexkmiweb07mysqldirectsubclasses
    indexkmiweb07mysqldirectsuperclasses
    indexkmiweb07mysqlequivalent
    indexkmiweb07mysqlsubclasses
    indexkmiweb07mysqlsuperclasses
    indexkmiweb07pgdirectclasses
    indexkmiweb07pgdirectsubclasses
    indexkmiweb07pgdirectsuperclasses
    indexkmiweb07pgequivalent
    indexkmiweb07pgsubclasses
    indexkmiweb07pgsuperclasses
    indexkmiweb07swdirectclasses
    indexkmiweb07swdirectsubclasses
    indexkmiweb07swdirectsuperclasses
    indexkmiweb07swequivalent
    indexkmiweb07swsubclasses
    indexkmiweb07swsuperclasses
    indexkmiweb07trecdirectclasses
    indexkmiweb07trecdirectsubclasses
    indexkmiweb07trecdirectsuperclasses
    indexkmiweb07trecequivalent
    indexkmiweb07trecsubclasses
    indexkmiweb07trecsuperclasses
 
ontologyindexrelation

    ontologyindextable
 
    id ontologyId indexManagerId  

https://help.ubuntu.com/community/MysqlPasswordReset

Useful References: (PowerAqua: supporting users in querying and exploring the Semantic Web)
http://www.semantic-web-journal.net/sites/default/files/swj102_2.pdf

(A thesis presented for the degree of Doctor of Philosophy in Computer SciencePowerAqua:Open Question Answeringon the Semantic Web, V. Lopez)
http://technologies.kmi.open.ac.uk/poweraqua/thesis-master-viva.pdf

Tomcat Web Application Deployment link

https://tomcat.apache.org/tomcat-7.0-doc/deployer-howto.html

Sparql with JavaScript Research

I looked at:

http://biohackathon.org/d3sparql/

http://notes.3kbo.com/javascript-sparql

https://github.com/RubenVerborgh/SPARQL.js

https://ruben.verborgh.org/blog/2014/08/22/writing-a-sparql-parser-in-javascript/

http://dailyjs.com/post/linked-data-and-javascript

http://kidehen.typepad.com/kingsley_idehens_typepad/2011/01/sparql-guide-for-the-javascript-developer.html

http://docs.publishmydata.com/developers/270_example_using_javascript_to_request_data_from_sparql_endpoint.html

In the end, this jquery script based on the last link works:

https://github.com/bshambaugh/node-arc-d3/blob/master/js/tests/jquerysparql/index2.html

Sunday, March 5, 2017

Quotes from PowerAqua

 From: "PowerAqua: Fishing the Semantic Web"

 " The system takes as input a natural language query, translates it into a set of logical queries, which are then answered by consulting and aggregating information derived from multiple heterogeneous semantic sources."

"Hence, to perform effective QA on the semantic web,we need a system which is able to locate and aggregate information, without any pre-formulated assumption about the ontological structure of the relevant information"

https://pdfs.semanticscholar.org/c529/c0c7c61504bb9023636b00ea88c803cf604c.pdf

Adding labels to edges that share the same two nodes

Today I had a problem with edges between the same two nodes overlapping, so that the labels also overlapped. I thought that the solution would be to use a d3 graph with curved edges (https://bl.ocks.org/mbostock/4600693).

I am not sure at this point how to add labels to a graph with curved edges. The syntax looks quite different.

Thus, I also investigated sigma.js which offers more functionality.
https://github.com/jacomyal/sigma.js

Saturday, March 4, 2017

Explorations for including a custom library

https://addyosmani.com/writing-modular-js/

I found this interesting for module definition with define and possible module retrieval with require.