cwrc / HuViz

LOD visualization tool for humanities datasets
8 stars 1 forks source link

Make the matching box prompt completions SPARQL query #187

Open wolfmaul opened 5 years ago

wolfmaul commented 5 years ago

Expected Behaviour

  1. I type in the name “Bodley Head Publishing House”
  2. As I type it provides me with a list of the entities that match what I’ve put in
  3. Once I make a selection from the list of entities that match what I’ve typed, HuViz “Activate”s the node
  4. HuViz renders the resulting graph on the canvas with all nodes selected and the central node activated
smurp commented 5 years ago
  1. Find the subjects which labels which contain the sought string (the user picks the url for CharlotteBronte)
  2. Get all the triples which have http://sparql.cwrc.ca/ontologies/cwrc#CharlotteBronte as the subject
  3. Then process results from 1) and when the object is a uri perform another query for the rdf:type and rdfs:label and foaf:name for those uris Query 1) gives us all the edges (and tells us the labels and types for Charlotte) Query 2) gives us all the labels and types for the nodes she is connected to

Convert results like this:

{
      "p" : {
        "type" : "uri",
        "value" : "http://sparql.cwrc.ca/ontologies/cwrc#hasBrother"
      },
      "obj" : {
        "type" : "uri",
        "value" : "http://sparql.cwrc.ca/ontologies/cwrc#BranwellBronte"
      }
    }

into quads like this:

{s: "http://sparql.cwrc.ca/ontologies/cwrc#CharlotteBronte", 
 p: "http://sparql.cwrc.ca/ontologies/cwrc#hasBrother", 
 o: {type: "http://www.w3.org/1999/02/22-rdf-syntax-ns#object", 
      value "http://sparql.cwrc.ca/ontologies/cwrc#BranwellBronte"}
}

and pass them to add_quad()