1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
DrawWordCloud = {};
DrawWordCloud.propList = ["政治家を志した理由", "地域のありたい姿", "解決したい課題"];
DrawWordCloud.keyProp = "政治家名";
DrawWordCloud.areaProp = "対象の市区町村または都道府県";
DrawWordCloud.area = "埼玉県";
DrawWordCloud.sourceURL = "http://www.maniken.jp/id#";
DrawWordCloud.manifestURL = "http://manifestoswitchsaitama.strikingly.com/";
DrawWordCloud.subList = [];
DrawWordCloud.workID = "";
DrawWordCloud.fileName = "";
$(function(){
DrawWordCloud.loadInputData();
$("#generate").click(function() {
var sub = "";
var propList = [];
$("#wordcrowd, #original").empty();
if ($('#subjects').val() != "all") {
sub = $('#subjects').val();
}
$('.property:checked').each(function(){
propList.push($(this).val());
});
var str = DrawWordCloud.getData(DrawWordCloud.workID, DrawWordCloud.fileName, sub, propList);
DrawWordCloud.analyze(str);
DrawWordCloud.loadInputData = function() {
var pList=[];
$.each(LinkData.getWorks(), function(workKey, workValue) {
DrawWordCloud.workID = workValue;
var workURl = "http://linkdata.org/work/" + workValue;
var keyPropURI = "http://linkdata.org/property/" + workValue + "#" +encodeURIComponent(DrawWordCloud.keyProp);
var areaPropURI = "http://linkdata.org/property/" + workValue + "#" +encodeURIComponent(DrawWordCloud.areaProp);
$.each(LinkData.getFiles(workValue), function(fileKey, fileValue) {
DrawWordCloud.fileName = fileValue;
$.each(LinkData.getSubjects(workValue, fileValue), function(subjKey, subjValue) {
$.each( LinkData.getTriplesBySubject(workValue, fileValue, subjValue), function( tripleKey, tripleValue ) {
if ( tripleValue.property == keyPropURI &&
LinkData.getObjects(workValue , fileValue , subjValue , areaPropURI) == DrawWordCloud.area) {
var subMap = {uri:subjValue, label:tripleValue.object};
DrawWordCloud.subList.push(subMap);
$.each(LinkData.getProperties(DrawWordCloud.workID, DrawWordCloud.fileName), function(propKey, propValue){
pList.push(propValue);
DrawWordCloud.initPreference(DrawWordCloud.subList, pList);
};
DrawWordCloud.initPreference = function(sList, pList){
// サブジェクトのセレクトボックス初期化
$.each(sList, function(subKey, subValue) {
var $option = "<option value=\"" + subValue.uri + "\">"+ subValue.label +"</option>";
$("#subjects").append($option);
// プロパティのチェックボックス初期化
$.each(pList, function(index, propURI) {
var decode = decodeURIComponent(propURI);
var sharp = decode.split("#");
var slash = sharp[sharp.length-1].split("/");
var propName = slash[slash.length-1];
$.each(DrawWordCloud.propList, function(i, prop) {
if (propName == prop) {
var $input = $('<input type="checkbox" />').attr({value: propURI}).attr({name: propName}).attr({class: "property"});
var $label = $('<label for="'+ propName +'">'+ propName +'</label>');
$("#properties").append($input).append($label);
DrawWordCloud.getData = function(work, file, sub, prop) {
var originalStr="";
$.each (prop, function(i, propValue) {
if (sub == ""){
$.each(DrawWordCloud.subList, function(sbjKey, subjValue) {
originalStr += " " + LinkData.getObjects(work, file, subjValue.uri, propValue);
} else {
originalStr += " " + LinkData.getObjects(work, file, sub, propValue);
var subStr = sub.split("#");
var subValue = subStr[subStr.length-1];
var url = DrawWordCloud.sourceURL + subValue;
$("#seeManifest").attr("href", DrawWordCloud.manifestURL).text("→マニフェストを見る");
$("#seeManifest").attr("href", url).text("→マニフェストを見る");
var inputStr = originalStr.substr(0,900); // APIの字数制限対策
$("#original").append('<p id="props"><b>元の文章</b>:' + inputStr + '</p>');
return inputStr;
span.highlight {color: red;}
span.propertyName {color: gray;}
span.subject { color: blue; }
span.object{ color: black; }
body { background: white; }
a, a span { text-decoration: underline; }
a:hover, a span:hover { text-decoration: none; }
img { width: 550px; }
#subjects {
margin: 20px 0;
.download {
font-size:16px;
font-family:Arial;
font-weight:normal;
-moz-border-radius:8px;
-webkit-border-radius:8px;
border-radius:8px;
border:1px solid #74b807;
padding:4px 20px;
text-decoration:none;
background:-webkit-gradient( linear, left top, left bottom, color-stop(5%, #89c403), color-stop(100%, #77a809) );
background:-moz-linear-gradient( center top, #89c403 5%, #77a809 100% );
background:-ms-linear-gradient( top, #89c403 5%, #77a809 100% );
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#89c403', endColorstr='#77a809');
background-color:#89c403;
color:#ffffff;
display:inline-block;
text-shadow:1px 1px 0px #528009;
-webkit-box-shadow:inset 1px 1px 0px 0px #a4e271;
-moz-box-shadow:inset 1px 1px 0px 0px #a4e271;
box-shadow:inset 1px 1px 0px 0px #a4e271;
margin-top: 10px;
.download:hover {
background:-webkit-gradient( linear, left top, left bottom, color-stop(5%, #77a809), color-stop(100%, #89c403) );
background:-moz-linear-gradient( center top, #77a809 5%, #89c403 100% );
background:-ms-linear-gradient( top, #77a809 5%, #89c403 100% );
filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#77a809', endColorstr='#89c403');
background-color:#77a809;
.download:active {
position:relative;
top:1px;
#original {
background: none repeat scroll 0 0 #eee;
margin: 10px;
padding: 5px 10px;
width: 500px;
<img src="http://res.cloudinary.com/hrscywv4p/image/upload/c_limit,f_auto,h_1440,q_90,w_720/v1/266220/switchsaitama_s4qqdv.png" />
<div id="result"></div>
<div id="fileList">
<div id="properties"><span>項目:</span></div>
立候補者: <select id="subjects" >
<option value="all">全件(※3,000文字まで)</option>
</select>
<button id="generate">ワードクラウドを表示</button>
<a id="seeManifest" target="_blank" href=""></a>
<a id="png" href="" type="application/octet-stream" download="sample.png" class="download" style="display:none;">Dowload Image</a>
</div>
<div id="wordcrowd"></div>
<div id="original"></div>
Click the Browse button or drag and drop to choose files to upload
The Maximum upload size is 1MB.(bmp,gif,jpeg,jpg,png)
*Required field
Add name for another language
You can upload jpg, gif, png file formats
Add description for another language
Fork original application has been updated. >>see
Original application has been updated. >>see
Playing...
Please enter a valid URL