Skip to content

Commit

Permalink
update to web structure picture:
Browse files Browse the repository at this point in the history
- allow bigger size
- better instructions for api usage

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6089 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
orbiter committed Jun 17, 2009
1 parent ae015e8 commit fc69a76
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 17 deletions.
19 changes: 12 additions & 7 deletions htroot/WatchWebStructure_p.html
Expand Up @@ -22,8 +22,11 @@
#%env/templates/header.template%#
#%env/templates/submenuWebStructure.template%#

<div id="api"><a href="/api/webstructure.xml"><img src="env/grafics/api.png"></a>
<span>The data that is visualized here can also be retrieved in a XML file. The XM L contains a back-reference of domains. That means you can see the set of domains that all link to the same (other) domain, which could be called a 'reverse domain index'.
<div id="api"><a href="/api/webstructure.xml?about=#[besthost]#"><img src="env/grafics/api.png"></a>
<span>
The data that is visualized here can also be retrieved in a XML file, which lists the reference relation between the domains.
With a GET-property 'about' you get only reference relations about the host that you give in the argument field for 'about'.
With a GET-property 'latest' you get a list of references that had been computed during the current run-time of YaCy, and with each next call only an update to the next list of references.
Click the API icon to see the XML file.
To see a list of all APIs, please visit the <a href="http://www.yacy-websuche.de/wiki/index.php/Dev:API">API wiki page</a>.</span>
</div>
Expand All @@ -33,7 +36,8 @@ <h2>Web Structure</h2>

<div id="left">
<form action="/WatchWebStructure_p.html">
<dl>
<fieldset>
<dl>
<dt>host</dt>
<dd>
<input type="text" value="#[host]#" name="host" id="host" size="20" maxlength="80" />
Expand All @@ -57,14 +61,15 @@ <h2>Web Structure</h2>
<a href="WatchWebStructure_p.html?host=#[host]#&amp;depth=#[depth]#&amp;width=#[width]#&amp;height=#[height]#&amp;nodes=#[nodes]#&amp;time=#[timei]#"><img src="env/grafics/plus.gif" alt="plus"/></a>
</dd>
<dt>size</dt>
<dd><input type="text" name="width" value="#[width]#" size="4" maxlength="4" />&nbsp;x&nbsp;<input type="text" name="height" value="#[height]#" size="4" maxlength="4" /></dd>
<dd><input type="text" name="width" value="#[width]#" size="5" maxlength="5" />&nbsp;x&nbsp;<input type="text" name="height" value="#[height]#" size="5" maxlength="5" /></dd>
<dt>&nbsp;</dt>
<dd><input type="submit" value="change" /></dd>
</dl>
</dl>
</fieldset>
</form>
</div>
</div><br>

<img src="WebStructurePicture_p.png?host=#[host]#&amp;depth=#[depth]#&amp;width=#[width]#&amp;height=#[height]#&amp;nodes=#[nodes]#&amp;time=#[time]#" alt="WebStructurePicture"/>
<img align="right" src="WebStructurePicture_p.png?host=#[besthost]#&amp;depth=#[depth]#&amp;width=#[width]#&amp;height=#[height]#&amp;nodes=#[nodes]#&amp;time=#[time]#" alt="WebStructurePicture"/>

#%env/templates/footer.template%#
</body>
Expand Down
10 changes: 10 additions & 0 deletions htroot/WatchWebStructure_p.java
Expand Up @@ -20,6 +20,7 @@ public static serverObjects respond(final httpRequestHeader header, final server
int nodes = 500; // maximum number of host nodes that are painted
int time = -1;
String host = "auto";
String besthost;

if (post != null) {
width = post.getInt("width", 768);
Expand Down Expand Up @@ -49,7 +50,16 @@ public static serverObjects respond(final httpRequestHeader header, final server
}
}

// find start point
if ((host == null) || (host.length() == 0) || (host.equals("auto"))) {
// find domain with most references
besthost = sb.webStructure.hostWithMaxReferences();
} else {
besthost = host;
}

prop.putHTML("host", host);
prop.putHTML("besthost", besthost);
prop.put("depth", depth);
prop.put("depthi", Math.min(8, depth + 1));
prop.put("depthd", Math.max(0, depth - 1));
Expand Down
6 changes: 3 additions & 3 deletions htroot/WebStructurePicture_p.java
Expand Up @@ -65,11 +65,11 @@ public static ymageMatrix respond(final httpRequestHeader header, final serverOb
host = post.get("host", null);
}

//too small values lead to an error, too big to huge CPU/memory consumption, resulting in possible DOS.
// too small values lead to an error, too big to huge CPU/memory consumption, resulting in possible DOS.
if (width < 32 ) width = 32;
if (width > 1920) width = 1920;
if (width > 10000) width = 10000;
if (height < 24) height = 24;
if (height > 1920) height = 1920;
if (height > 10000) height = 10000;
if (depth > 8) depth = 8;
if (depth < 0) depth = 0;

Expand Down
13 changes: 6 additions & 7 deletions source/de/anomic/plasma/plasmaWebStructure.java
Expand Up @@ -176,7 +176,7 @@ public void flushCitationReference(final String type) {

private static int refstr2count(final String refs) {
if ((refs == null) || (refs.length() <= 8)) return 0;
assert (refs.length() - 8) % 10 == 0;
assert (refs.length() - 8) % 10 == 0 : "refs = " + refs + ", length = " + refs.length();
return (refs.length() - 8) / 10;
}

Expand Down Expand Up @@ -471,21 +471,20 @@ public boolean hasNext() {

private void next0() {
Map.Entry<String, String> entry = null;
String dom = null, ref;
String dom = null, ref = "";
while (i.hasNext()) {
entry = i.next();
ref = entry.getValue();
if ((ref.length() - 8) % 10 != 0) continue;
dom = entry.getKey();
if (dom.length() >= 8) break;
if (!i.hasNext()) {
nextentry = null;
return;
}
dom = null;
}
if ((entry == null) || (dom == null)) {
nextentry = null;
return;
}
ref = entry.getValue();
assert (ref.length() - 8) % 10 == 0 : "refs = " + ref + ", length = " + ref.length();
nextentry = new structureEntry(dom.substring(0, 6), dom.substring(7), ref.substring(0, 8), refstr2map(ref));
}

Expand Down

0 comments on commit fc69a76

Please sign in to comment.