<!DOCTYPE html>
<meta charset="utf-8">
<head>
<link rel="stylesheet" type="text/css" href="styles/style.css">
</head>
<body>
<script src="js/d3.v3.min.js"></script>
<script src="js/d3.tip.v0.6.3.js"></script>
<script src="js/jquery-3.3.1.min.js"></script>
<script>
var margin = {top: 40, right: 20, bottom: 30, left: 70},
width = 460 - margin.left - margin.right,
height = 500 - margin.top - margin.bottom;
var jsonData= [
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1870.1989" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/S.A.Seges" }},
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1988.1630" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/Van%20Malderen%2C%20Luc" }},
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1989.0903" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/Chom%C3%A9%2C%20G" }},
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1989.0903" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/Schmidt%2C%20F" }},
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1989.3770" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/Dehli%2C%20M" }},
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1989.3770" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/Erb%2C%20P" }},
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1989.3770" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/Luik%2C%20K.O" }},
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1989.3770" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/Reinicke%2C%20B" }},
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1989.4180" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/Paolacci%2C%20A" }},
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1989.5295" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/Everard%2C%20Patrick" }},
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1989.5295" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/Wolter%2C%20Diane" }},
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1989.5395" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/Cailloux%2C%20J.M" }},
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1990.1255" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/Crossa-Raynaud%2C%20P" }},
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1990.1255" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/Rossetto%2C%20G" }},
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1990.1344" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/Barthelemy%2C%20Philippe" }},
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1990.1344" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/Lobo%2C%20Faustino" }},
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1990.1344" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/Mingione%2C%20Enzo" }},
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1990.1344" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/Pahl%2C%20Raymond" }},
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1990.1344" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/Wnig%2C%20Alois" }},
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1990.1428" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/Cunningham%2C%20J" }},
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1990.1593" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/Cort%C3%A9%2C%20P" }},
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1990.1593" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/Fabry%2C%20C" }},
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1990.1593" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/Luca%20Ferrero%2C%20G" }},
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1990.1676" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/Guerry%2C%20J" }},
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1990.1676" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/Waldner%2C%20P" }},
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1990.1684" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/Dutta%2C%20D" }},
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1990.1684" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/Mang%2C%20F" }},
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1990.1684" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/Wardenier%2C%20J" }},
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1991.0062" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/Mauro%2C%20Paula" }},
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1991.1283" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/Pilavachi%2C%20P.%2C%20A" }},
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1991.1335" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/Leroy%2C%20B" }},
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1991.1479" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/Ducrey%2C%20M" }},
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1991.1479" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/Oswald%2C%20H" }},
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1991.1874" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/Fontaine%2C%20Pascal" }},
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1991.1960" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/De%20Aguirre%2C%20F" }},
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1992.1314" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/Dufrien%2C%20J.-B" }},
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1992.1314" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/Marquet%2C%20C" }},
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1993.2477" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/Davies%2C%20L.P" }},
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1993.2477" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/Ingham%2C%20E.L" }},
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1993.2477" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/Walsh%2C%20P.K" }},
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1994.0083" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/Serdjenian%2C%20Evelyne" }},
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1994.1334" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/Smith%2C%20B" }},
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1994.1334" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/Warwick%2C%20P" }},
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1994.1334" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/Williams%2C%20G.M" }},
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1994.1827A" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/Astudillo%2C%20J" }},
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1994.1827A" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/Barahona%2C%20E" }},
{ "w1": { "type": "uri", "value": "http://publications.europa.eu/resource/genpub/1994.1827A" } , "agent1": { "type": "uri", "value": "http://publications.europa.eu/resource/agent/Del%20Olmo%2C%20C" }}
];
function computeLinks(jsonData){
var links = [];
/* links = [
{source: "Microsoft", target: "Amazon", type: "licensing"},
{source: "Microsoft", target: "HTC", type: "licensing"},
{source: "Samsung", target: "Apple", type: "suit"},
];
{source: "Motorola", target: "Apple", type: "suit"},
{source: "Nokia", target: "Apple", type: "resolved"},
{source: "HTC", target: "Apple", type: "suit"},
{source: "Kodak", target: "Apple", type: "suit"},
{source: "Microsoft", target: "Barnes & Noble", type: "suit"},
{source: "Microsoft", target: "Foxconn", type: "suit"},
{source: "Oracle", target: "Google", type: "suit"},
{source: "Apple", target: "HTC", type: "suit"},
{source: "Microsoft", target: "Inventec", type: "suit"},
{source: "Samsung", target: "Kodak", type: "resolved"},
{source: "LG", target: "Kodak", type: "resolved"},
{source: "RIM", target: "Kodak", type: "suit"},
{source: "Sony", target: "LG", type: "suit"},
{source: "Kodak", target: "LG", type: "resolved"},
{source: "Apple", target: "Nokia", type: "resolved"},
{source: "Qualcomm", target: "Nokia", type: "resolved"},
{source: "Apple", target: "Motorola", type: "suit"},
{source: "Microsoft", target: "Motorola", type: "suit"},
{source: "Motorola", target: "Microsoft", type: "suit"},
{source: "Huawei", target: "ZTE", type: "suit"},
{source: "Ericsson", target: "ZTE", type: "suit"},
{source: "Kodak", target: "Samsung", type: "resolved"},
{source: "Apple", target: "Samsung", type: "suit"},
{source: "Kodak", target: "RIM", type: "suit"},
{source: "Nokia", target: "Qualcomm", type: "suit"}];*/
$.each(jsonData, function(i, obj) {
var fields1 = obj.w1.value.split('/');
var fields2 = obj.agent1.value.split('/');
var work = fields1[fields1.length-1];
var agent = fields2[fields2.length - 1];
var link = '{"source":"' + work + '", "target":"' + agent + '"}';
links.push(jQuery.parseJSON(link));
});
return links;
}
var links = computeLinks(jsonData);
console.log(links);
var nodes = {};
// Compute the distinct nodes from the links.
links.forEach(function(link) {
link.source = nodes[link.source] || (nodes[link.source] = {name: link.source});
link.target = nodes[link.target] || (nodes[link.target] = {name: link.target});
});
console.log(links);
var width = 960,
height = 500;
var force = d3.layout.force()
.nodes(d3.values(nodes))
.links(links)
.size([width, height])
.linkDistance(60)
.charge(-300)
.on("tick", tick)
.start();
var svg = d3.select("body").append("svg")
.attr("width", width)
.attr("height", height);
// Per-type markers, as they don't inherit styles.
svg.append("defs").selectAll("marker")
.data(["suit", "licensing", "resolved"])
.enter().append("marker")
.attr("id", function(d) { return d; })
.attr("viewBox", "0 -5 10 10")
.attr("refX", 15)
.attr("refY", -1.5)
.attr("markerWidth", 6)
.attr("markerHeight", 6)
.attr("orient", "auto")
.append("path")
.attr("d", "M0,-5L10,0L0,5");
var path = svg.append("g").selectAll("path")
.data(force.links())
.enter().append("path")
.attr("class", function(d) { return "link " + d.type; })
.attr("marker-end", function(d) { return "url(#" + d.type + ")"; });
var circle = svg.append("g").selectAll("circle")
.data(force.nodes())
.enter().append("circle")
.attr("r", 6)
.call(force.drag);
var text = svg.append("g").selectAll("text")
.data(force.nodes())
.enter().append("text")
.attr("x", 8)
.attr("y", ".31em")
.text(function(d) { return d.name; });
// Use elliptical arc path segments to doubly-encode directionality.
function tick() {
path.attr("d", linkArc);
circle.attr("transform", transform);
text.attr("transform", transform);
}
function linkArc(d) {
var dx = d.target.x - d.source.x,
dy = d.target.y - d.source.y,
dr = Math.sqrt(dx * dx + dy * dy);
return "M" + d.source.x + "," + d.source.y + "A" + dr + "," + dr + " 0 0,1 " + d.target.x + "," + d.target.y;
}
function transform(d) {
return "translate(" + d.x + "," + d.y + ")";
}
</script>
<h5 class="header">A network of Works created | contributed to by agents @Copyright Infeurope S.A. 2018</h5>
<body>