Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

Demonstration: include value from interaction in search results

cominchc9dc6cda02f2
diff --git a/htroot/Triple_p.html b/htroot/Triple_p.html
index f00d2cfa4..0765ebd0f 100644
--- a/htroot/Triple_p.html
+++ b/htroot/Triple_p.html
@@ -63,6 +63,15 @@
<h2>Query</h2>
<form action="Triple_p.html" method="post" enctype="multipart/form-data">
+ <textarea name="query" cols="100" rows="10">
+ #[query]#
+ </textarea>
+
+ <input type="submit" value="Query" />
+
+ </form>
+ <form action="Triple_p.csv" method="post" enctype="multipart/form-data">
+
<textarea name="query" cols="100" rows="10">
#[query]#
</textarea>
diff --git a/htroot/Triple_p.java b/htroot/Triple_p.java
index 2662cbf28..c50df2067 100644
--- a/htroot/Triple_p.java
+++ b/htroot/Triple_p.java
@@ -40,13 +40,13 @@ public class Triple_p {
prop.put("display", 1); // Fixed to 1
prop.putHTML("mode_output", "no query performed");
- String q = "PREFIX lln: <http://virtual.liebel-lab.org/n#>\n"+
+ String q = "PREFIX lln: <http://virtual.x/>\n"+
"PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>\n"+
"PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>\n"+
"SELECT ?resource ?pa\n"+
"WHERE {\n"+
- "?resource lln:percentageofarea ?pa .\n"+
-"FILTER (xsd:float (?pa) > 3.000)\n"+
+ "?resource lln:hasvalue ?pa .\n"+
+"FILTER (xsd:float (?pa) > 21.000)\n"+
"}";
if (post != null) {
@@ -106,17 +106,29 @@ public class Triple_p {
prop.putHTML("mode_rdfdump", sos.toString());
-
+ int scount = 0;
+ while (resultSet.hasNext()) {
+ QuerySolution s = resultSet.next();
+ prop.put("entries_"+scount+"_s", s.getResource(null).getURI());
+ prop.put("entries_"+scount+"_p", s.getResource(null).getURI());
+ prop.put("entries_"+scount+"_o", s.getResource(null).getURI());
+ scount ++;
+ }
+ prop.putHTML("entries", ""+scount);
for (String s: resultSet.getResultVars()) {
prop.putHTML("mode_output_"+count+"_caption", s);
count ++;
}
+
+
} catch (Exception e) {
prop.putHTML("mode_rdfdump", "error");
}
+
+
prop.putHTML("mode_output", ""+count);
diff --git a/htroot/interaction/OverlayInteraction.html b/htroot/interaction/OverlayInteraction.html
index da7dee359..d3fea7278 100644
--- a/htroot/interaction/OverlayInteraction.html
+++ b/htroot/interaction/OverlayInteraction.html
@@ -52,9 +52,32 @@ border-bottom: 1px solid #ffffff;
</div>
-<div id="sidebar-document" class="sci_panel" style="top: 110px;">
+<!-- <div id="sidebar-document" class="sci_panel" style="top: 110px;">
-<p>document</p> <img src="/currentyacypeer/env/grafics/bad.png" onclick="contribution (document.location.href, 'like document', '#[username]#'); return false">
+document <img src="/currentyacypeer/env/grafics/bad.png" width="16px" height="16px" onclick="contribution (document.location.href, 'like document', '#[username]#'); return false">
+
+</div> -->
+
+<div id="sidebar-element" class="sci_panel" style="top: 110px;">
+
+<input id="SliderSingle" type="slider" name="price" value="20" />
+
+<script type="text/javascript" charset="utf-8">
+ $("#SliderSingle").slider(
+ {
+ from: 0,
+ to: 100,
+ step: 2.5,
+ round: 1,
+ format: { format: '##.0', locale: 'de'},
+ dimension: '&nbsp;',
+ skin: 'round',
+ onstatechange: function(value) {
+ triple ('#[link]#', '#[link]#', 'http://virtual.x/hasvalue', value, '#[username]#');
+ }
+ }
+ );
+</script>
</div>
diff --git a/htroot/yacysearchitem.html b/htroot/yacysearchitem.html
index de0086832..82e425ed1 100644
--- a/htroot/yacysearchitem.html
+++ b/htroot/yacysearchitem.html
@@ -2,7 +2,7 @@
<div class="searchresults">
<h4 class="linktitle">
<img width="16" height="16" src="ViewImage.png?width=16&amp;height=16&amp;code=#[faviconCode]#" id="f#[urlhash]#" class="favicon" style="width:16px; height:16px;" alt="" />
- <a href="#[link]#" target="#[target]#">#[title]#</a></h4>
+ <a href="#[link]#" target="#[target]#">#[title]#</a> #[value]#</h4>
<div class="urlactions">
#(heuristic)#::
<img width="16" height="9" src="/env/grafics/heuristic_redundant.gif" title="heuristic:#[name]# (redundant)" style="width:16px; height:9px;" alt="heuristic:#[name]# (redundant)"/>::
diff --git a/htroot/yacysearchitem.java b/htroot/yacysearchitem.java
index 9604d2a5e..3c0f4d665 100644
--- a/htroot/yacysearchitem.java
+++ b/htroot/yacysearchitem.java
@@ -34,6 +34,7 @@ import net.yacy.cora.document.Classification.ContentDomain;
import net.yacy.cora.protocol.HeaderFramework;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.cora.protocol.RequestHeader.FileType;
+import net.yacy.interaction.Interaction;
import net.yacy.kelondro.data.meta.DigestURI;
import net.yacy.kelondro.logging.Log;
import net.yacy.kelondro.util.Formatter;
@@ -141,8 +142,44 @@ public class yacysearchitem {
prop.putHTML("content_title", result.title());
prop.putXML("content_title-xml", result.title());
prop.putJSON("content_title-json", result.title());
- prop.putHTML("content_link", resultUrlstring);
prop.putHTML("content_showPictures_link", resultUrlstring);
+ //prop.putHTML("content_link", resultUrlstring);
+
+// START interaction
+ String modifyURL = resultUrlstring;
+ if (sb.getConfigBool("proxyURL.useforresults", false)) {
+ // check if url is allowed to view
+ if (sb.getConfig("proxyURL.rewriteURLs", "all").equals("all")) {
+ modifyURL = "./proxy.html?url="+modifyURL;
+ }
+
+ // check if url is allowed to view
+ if (sb.getConfig("proxyURL.rewriteURLs", "all").equals("domainlist")) {
+ try {
+ if (sb.crawlStacker.urlInAcceptedDomain(new DigestURI (modifyURL)) == null) {
+ modifyURL = "./proxy.html?url="+modifyURL;
+ }
+ } catch (MalformedURLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ if (sb.getConfig("proxyURL.rewriteURLs", "all").equals("yacy")) {
+ try {
+ if ((new DigestURI (modifyURL).getHost().endsWith(".yacy"))) {
+ modifyURL = "./proxy.html?url="+modifyURL;
+ }
+ } catch (MalformedURLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+ }
+ prop.putHTML("content_link", modifyURL);
+ prop.putHTML("content_value", Interaction.getTriple(result.urlstring(), "http://virtual.x/hasvalue"));
+// END interaction
+
prop.putHTML("content_target", target);
if (faviconURL != null && fileType == FileType.HTML) sb.loader.loadIfNotExistBackground(faviconURL, 1024 * 1024 * 10);
prop.putHTML("content_faviconCode", sb.licensedURLs.aquireLicense(faviconURL)); // acquire license for favicon url loading
diff --git a/source/net/yacy/interaction/Interaction.java b/source/net/yacy/interaction/Interaction.java
index 285537b50..6bdf0b117 100644
--- a/source/net/yacy/interaction/Interaction.java
+++ b/source/net/yacy/interaction/Interaction.java
@@ -463,6 +463,23 @@ public static String Triple(String url, String s, String p, String o, String fro
return "";
}
+public static String getTriple(String s, String p) {
+
+ final Switchboard sb = Switchboard.getSwitchboard();
+
+ Resource r = TripleStore.model.getResource(s);
+ Property pr = TripleStore.model.getProperty(p);
+
+ StmtIterator iter = TripleStore.model.listStatements(r, pr, (Resource) null);
+
+ while (iter.hasNext()) {
+ return (iter.nextStatement().getObject().toString());
+ }
+
+ return "";
+
+}
+
public static String GetContribution(String url) {
final Switchboard sb = Switchboard.getSwitchboard();