Navigate *All* the Knowledge

Getting started with ConceptMap.io

James L. Weaver
Developer Advocate
 

 

Twitter: @JavaFXpert
Email: jweaver@pivotal.io
http://JavaFXpert.com
http://CulturedEar.com

@JavaFXpert

About the Presenter

Java Champion, JavaOne Rockstar, plays well with others, etc :-)

Author of several Java/JavaFX/RaspPi books

@JavaFXpert

Mission: "Transform how the world builds software"

Mission: "Transform how the world builds software"

App is live at ConceptMap.io

ConceptMap.io source code for services and UI:  https://github.com/JavaFXpert/wikibrowser-service

Open source, licensed under the Apache License, Version 2.0

 

Note: These Technical Presentation slides are available at

http://slides.com/javafxpert/conceptmap-technical​

as well as by clicking the Help            button in ConceptMap.io

@JavaFXpert

Wikimedia has many projects

Graphic from presentation by Lynda Pintscher

@JavaFXpert

... the most famous is Wikipedia

Graphic from 2013 presentation by Lynda Pintscher

@JavaFXpert

Graphic from 2013 presentation by Lynda Pintscher

Wikimedia Commons

Media files leveraged by Wikimedia projects

@JavaFXpert

Graphic from 2013 presentation by Lynda Pintscher

Wikidata

Central storage for the structured data of Wikimedia projects

@JavaFXpert

Graphic from 2013 presentation by Lynda Pintscher

Wikidata

Provides semantic structure for Wikipedia articles in any language

@JavaFXpert

Wikipedia + Wikidata

Wikipedia articles and their relationships to each other

@JavaFXpert

The Big Idea: ConceptMap.io

Navigate/pin Wikipedia articles via links and Wikidata relationships

@JavaFXpert

Designed to facilitate:

  • Learning


     
  • Teaching


     
  • Research
     

Learning/Teaching Scenario

Search for an item and pin it to the concept map

Learning/Teaching Scenario

Select a link in the Wikipedia article

Learning/Teaching Scenario

Pin the item to the concept map

Learning/Teaching Scenario

Select an item in the map, expand a relationship, and select an item

Learning/Teaching Scenario

Pin the item to the concept map

Learning/Teaching Scenario

Select an item in the map, and click the [x1] button for a relationship

Learning/Teaching Scenario

The [x1] button pinned the items found at the first level of the relationship

Learning/Teaching Scenario

Select an item in the concept map, and select an item From Related Items

Learning/Teaching Scenario

Pin the item to the concept map

Learning/Teaching Scenario

Continue selecting items from Wikipedia articles and Wikidata Relationships

Learning/Teaching Scenario

... and pin them to the concept map

Learning/Teaching Scenario

Edit relationships for an item by selecting Wikidata icon

Learning/Teaching Scenario

Wikidata page appears with which anyone may edit the item's info

Learning/Teaching Scenario

Select the Link icon to create a link to the concept map

Learning/Teaching Scenario

Share the link to your concept map with a colleague or student

High-level view of distributed architecture

Use case: Search for Earth

Use case: Pin Earth to graph

http://example/graph?items=Q2,Q405,Q525

MATCH (a:Item), (b:Item)
WHERE a.itemId IN ['Q2', 'Q405', 'Q525'] 
  AND b.itemId IN ['Q2', 'Q405', 'Q525']
WITH a, b
OPTIONAL MATCH (a)-[rel]-(b)
RETURN a, b, collect(rel)

Neo4j Cypher query

(find all relationships between pinned items)

Resource controller

http://example/visgraph?items=Q2,Q405,Q525

Note: Because Jackson 2 is on the classpath, Spring’s MappingJackson2HttpMessageConverter is automatically chosen to convert the GraphResponseNear instance to JSON

@RestController
public class WikiGraphController {
  @RequestMapping(value = "/graph", method = RequestMethod.GET, 
                  produces = MediaType.APPLICATION_JSON_VALUE
  public ResponseEntity<Object> search(@RequestParam(value = "items", defaultValue="") 
                                       String items) {
    GraphResponseNear graphResponseNear = null;
    ...
    return Optional.ofNullable(graphResponseNear)
        .map(cr -> new ResponseEntity<>((Object)cr, HttpStatus.OK))
        .orElse(new ResponseEntity<>("Graph query unsuccessful", 
                                     HttpStatus.INTERNAL_SERVER_ERROR));
  }
}

To learn more, see Building a RESTful Web Service Spring Guide

Resource representation

public class Item {
  private String type;
  private String id;

  public Item() {
  }

  public String getType() {
    return type;
  }

  public void setType(String type) {
    this.type = type;
  }

  public String getId() {
    return id;
  }

  public void setId(String id) {
    this.id = id;
  }
}

Use case: Change language

Use case: Share link

Use case: Breadth-first search

(expand items related by a given property to a given depth)

Use case: Items in common

Text

(all shortest paths, two hops or less)

Neo4j Cypher query

http://example/visshortpaths?id=Q111&target=Q313

MATCH p=allShortestPaths( 
  (a:Item {itemId:'Q111'})-[*..2]-(b:Item {itemId:'Q313'}) 
)
RETURN p

(all shortest paths, two hops or less)

Use case: Navigate to root

(shortest path to Entity using subclass of, instance of, part of)

Neo4j Cypher query

http://example/visrootpaths?id=Q332

MATCH p=allShortestPaths( 
  (a:Item {itemId:'Q332'})-[*]->(b:Item {itemId:'Q35120'}) 
)
WHERE NONE(x IN RELATIONSHIPS(p) 
  WHERE (x.propId <> 'P279') AND 
    (x.propId <> 'P31') AND 
    (x.propId <> 'P361')
)
RETURN p

(shortest path to Entity using subclass of, instance of, part of)

Make the app executable

package com.javafxpert.wikibrowser;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;

@EnableConfigurationProperties
@SpringBootApplication
public class WikiBrowserServiceApplication {

    public static void main(String[] args) {
        SpringApplication.run(WikiBrowserServiceApplication.class, args);
    }
}

To learn more, see Building a RESTful Web Service Spring Guide

App build/deploy cycle

  1. $ mvn clean install
  2. $ cf push

Note: One method of deployment for Spring Boot apps is a JAR file, which contains an embedded Tomcat servlet container.

Pivotal Web Services Console

start.spring.io

Use case: Degrees of separation

Text

(shortest path, like Kevin Bacon game)

Use case: Amazon Alexa

"ask concept map"

"get teams for Lionel Messi"

AWS Lambda developed in Java

Navigate *All* the Knowledge

ConceptMap.io from a technical perspective

James L. Weaver
Developer Advocate
 

 

Twitter: @JavaFXpert
Email: jweaver@pivotal.io
http://JavaFXpert.com
http://CulturedEar.com

Hope you enjoyed