Auto Tagging: Add hyperlinks to tags (provisional)

pull/1/head
cominch 13 years ago
parent 8c544edee4
commit 011f8a5818

@ -0,0 +1,3 @@
{
"result": "#[taglinks]#"
}

@ -26,6 +26,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
import java.net.MalformedURLException;
import java.util.Iterator;
import net.yacy.cora.date.ISO8601Formatter;
import net.yacy.cora.document.ASCII;
@ -42,6 +43,7 @@ import net.yacy.search.index.Segment;
import net.yacy.search.index.Segments;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.RDFNode;
import de.anomic.server.serverObjects;
import de.anomic.server.serverSwitch;
@ -138,6 +140,19 @@ public class yacydoc {
String rdf = JenaTripleStore.getRDFByModel(model);
prop.putXML("triples", rdf);
prop.put("rdf", header.fileType() == FileType.XML ? rdf : "");
String references = "";
Iterator<RDFNode> t = JenaTripleStore.getObjects("http://yacy.net/url#"+urlhash, "http://purl.org/dc/terms/references");
while (t.hasNext()) {
RDFNode r = t.next();
references += r.toString()+",";
}
Log.logInfo ("TRIPLESTORE", references);
prop.put("taglinks", references);
// return rewrite properties
return prop;

@ -9,4 +9,5 @@
<link media="screen" type="text/css" href="/currentyacypeer/jquery/css/jquery.tagsinput.css" rel="stylesheet" />
<script src="/currentyacypeer/jquery/js/jquery.tagsinput.min.js" type="text/javascript"></script>
<script src="/currentyacypeer/jquery/js/jquery.rdfquery.core-1.0.js" type="text/javascript"></script>
<!-- END jQuery header -->

@ -28,6 +28,8 @@ color: #5a346e;
<div id="sci_tags_#[hash]#_box" class="sci_panel" style="top: 50px; display: none;">
<div id="rdfcontent_#[hash]#" class="rdfcontent_#[hash]#" style="display:none;"></div>
<input type="text" id="tags_#[hash]#" name="tags_#[hash]#" class="bm_input" size="80" />
<script type="text/javascript" charset="utf-8">
@ -37,12 +39,45 @@ color: #5a346e;
var vocs = vocabularies_string.split (",");
var existingtags = "";
$.ajaxSetup({async: false});
var resultstring = "";
$.getJSON('/currentyacypeer/api/yacydoc.htm?urlhash=#[hash]#', function(data) {
resultstring = data.result;
});
vocs.forEach (function(voc) {
var currenttags = triple_get_prefix ('http://yacy.net/url', '#[hash]#', 'http://yacy.net/autotagging', voc);
var finaltags = "";
currenttags.split(',').forEach (function(tag) {
var link = "";
resultstring.split(',').forEach (function(hyperlink) {
var h_url = hyperlink.substring (0, hyperlink.indexOf('#'));
var h_tag = hyperlink.substring (hyperlink.indexOf('#')+1);
if (h_tag == tag) link = h_url;
});
if (link != "") {
finaltags = finaltags + '<a href="'+ link +'" target="_blank">' + tag + '</a>&nbsp;';
}
else {
finaltags = finaltags + tag + '&nbsp';
}
});
if (existingtags != "" && currenttags != "") existingtags += " - ";
if (currenttags != "") existingtags += voc+":"+ currenttags;
if (currenttags != "") existingtags += voc+":"+ finaltags;
});

@ -1,9 +1,10 @@
function newload (name, div) {
$.ajaxSetup({async: false});
$.get(name, function(data) {
$('#'+div).html(data);
$.get(name, function(data) {
document.getElementById(div).innerHTML = data;
});
}

File diff suppressed because it is too large Load Diff
Loading…
Cancel
Save