Conflicts: build.xml defaults/yacy.init source/net/yacy/interaction/AugmentHtmlStream.javapull/1/head
parent
bc9a618e0a
commit
5d20cd324a
@ -0,0 +1,119 @@
|
|||||||
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
||||||
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<title>YaCy '#[clientname]#': Triplestore</title>
|
||||||
|
#%env/templates/metas.template%#
|
||||||
|
|
||||||
|
#%env/templates/jqueryheader.template%#
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body id="Experiments">
|
||||||
|
|
||||||
|
#%env/templates/header.template%#
|
||||||
|
|
||||||
|
|
||||||
|
#(mode)#
|
||||||
|
<div class="AddSection">
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
function xyz() {
|
||||||
|
|
||||||
|
$.getJSON('yacysearch.json?query=rdfdatasource&Enter=Search&verify=never&contentdom=text&nav=hosts%2Cauthors%2Cnamespace%2Ctopics%2Cfiletype%2Cprotocol&startRecord=0&indexof=off&meanCount=5&resource=global&urlmaskfilter=.*&prefermaskfilter=&maximumRecords=10', null, function(data) {
|
||||||
|
|
||||||
|
$('#rdffileslist').val(data.channels[0].items[0].urlname);
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
<h2>Search RDF</h2>
|
||||||
|
<form action="Triple_p.html" method="post" enctype="multipart/form-data">
|
||||||
|
|
||||||
|
<input id="rdfsearch" name="rdfsearch" type="text" size="50" value="rdfdatasource" />
|
||||||
|
<input type="submit" value="Search" onclick="xyz(); return false;"/>
|
||||||
|
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
<textarea id="rdffileslist" name="rdffileslist" cols="100" rows="10">
|
||||||
|
|
||||||
|
</textarea>
|
||||||
|
|
||||||
|
<input type="submit" value="Import Triples" />
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<div class="AddSection">
|
||||||
|
<h2>or import RDF from local filesystem</h2>
|
||||||
|
<form action="Triple_p.html" method="post" enctype="multipart/form-data">
|
||||||
|
|
||||||
|
<input name="rdffile" type="file" size="50" maxlength="10000000" />
|
||||||
|
|
||||||
|
<input type="submit" value="Add Triples" />
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<div class="AddSection">
|
||||||
|
<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>
|
||||||
|
</div>
|
||||||
|
<br></br>
|
||||||
|
<!-- 0: viewing -->
|
||||||
|
|
||||||
|
#{entries}#
|
||||||
|
<div class="Experiment">
|
||||||
|
|
||||||
|
<a href="./experiments/#[link]#/" target="_blank"><h2 class="PostSubject">#[subject]#</h2></a>
|
||||||
|
<p class="PostInfo">
|
||||||
|
<a href="/Crawler_p.html?createBookmark=off&xsstopw=off&crawlingDomMaxPages=10000&intention=&range=subpath&indexMedia=on&xdstopw=off&storeHTCache=off&sitemapURL=&repeat_time=1&cachePolicy=never&indexText=on&crawlingMode=url&crawlingURL=#[publiclink]#&bookmarkTitle=&mustnotmatch=&crawlingDomFilterDepth=1&crawlingDomFilterCheck=off&crawlingstart=Start%20New%20Crawl&xpstopw=off&crawlingDepth=0" target="_blank">Publish</a> |
|
||||||
|
<a href="/Crawler_p.html?createBookmark=off&xsstopw=off&crawlingDomMaxPages=10000&intention=&range=subpath&indexMedia=on&xdstopw=off&storeHTCache=off&sitemapURL=&repeat_time=1&cachePolicy=never&indexText=on&crawlingMode=url&crawlingURL=#[publiclink_ip]#&bookmarkTitle=&mustnotmatch=&crawlingDomFilterDepth=1&crawlingDomFilterCheck=off&crawlingstart=Start%20New%20Crawl&xpstopw=off&crawlingDepth=0" target="_blank">Publish using IP-Adress</a>
|
||||||
|
| <a href="UnpublishExperiment_p.html?experiment=#[subject]#&urlstring=#[publiclink]#">Unpublish and remove</a> | <a href="#[publiclinkproxy]#">Preview via inbuilt proxy</a>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
#{/entries}#
|
||||||
|
|
||||||
|
|
||||||
|
<!-- <applet
|
||||||
|
code="org.openscience.jchempaint.applet.JChemPaintEditorApplet"
|
||||||
|
archive="/applets/jchempaint-applet-core.jar"
|
||||||
|
name="Editor"
|
||||||
|
width="600" height="500">
|
||||||
|
<param name="load" value="a-pinene.mol">
|
||||||
|
</applet> -->
|
||||||
|
|
||||||
|
<div class="AddSection">
|
||||||
|
<h2>Result</h2>
|
||||||
|
|
||||||
|
#[rdfdump]#
|
||||||
|
<br/>
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
#{output}##[caption]#
|
||||||
|
#{/output}#
|
||||||
|
</div>
|
||||||
|
|
||||||
|
::
|
||||||
|
<!-- 3: Access Denied (no rights) -->
|
||||||
|
<h3>Access denied</h3>
|
||||||
|
<p>To edit or create experiment entries you need to be logged in as Administrator.</p>
|
||||||
|
|
||||||
|
|
||||||
|
#(/mode)#
|
||||||
|
#%env/templates/footer.template%#
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -0,0 +1,135 @@
|
|||||||
|
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.net.MalformedURLException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import net.yacy.cora.protocol.RequestHeader;
|
||||||
|
import net.yacy.interaction.TripleStore;
|
||||||
|
import net.yacy.kelondro.data.meta.DigestURI;
|
||||||
|
import net.yacy.search.Switchboard;
|
||||||
|
|
||||||
|
|
||||||
|
import de.anomic.http.server.HTTPDemon;
|
||||||
|
import de.anomic.server.serverObjects;
|
||||||
|
import de.anomic.server.serverSwitch;
|
||||||
|
|
||||||
|
import com.hp.hpl.jena.query.QueryExecution;
|
||||||
|
import com.hp.hpl.jena.query.QueryExecutionFactory;
|
||||||
|
import com.hp.hpl.jena.query.QueryFactory ;
|
||||||
|
import com.hp.hpl.jena.query.QuerySolution;
|
||||||
|
import com.hp.hpl.jena.query.ResultSet;
|
||||||
|
import com.hp.hpl.jena.query.ResultSetFormatter;
|
||||||
|
import com.hp.hpl.jena.sparql.algebra.Algebra ;
|
||||||
|
import com.hp.hpl.jena.sparql.algebra.Op ;
|
||||||
|
import com.hp.hpl.jena.sparql.engine.QueryIterator ;
|
||||||
|
import com.hp.hpl.jena.sparql.engine.binding.Binding ;
|
||||||
|
|
||||||
|
import com.hp.hpl.jena.rdf.model.*;
|
||||||
|
import com.hp.hpl.jena.util.FileManager;
|
||||||
|
|
||||||
|
|
||||||
|
public class Triple_p {
|
||||||
|
|
||||||
|
public static serverObjects respond(final RequestHeader header,
|
||||||
|
final serverObjects post, final serverSwitch env) {
|
||||||
|
final Switchboard sb = (Switchboard) env;
|
||||||
|
final serverObjects prop = new serverObjects();
|
||||||
|
|
||||||
|
boolean hasRights = sb.verifyAuthentication(header);
|
||||||
|
|
||||||
|
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"+
|
||||||
|
"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"+
|
||||||
|
"}";
|
||||||
|
|
||||||
|
if (post != null) {
|
||||||
|
|
||||||
|
if (post.containsKey("submit")) {
|
||||||
|
//
|
||||||
|
System.out.println (post.get("submit"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (post.containsKey("rdffileslist")) {
|
||||||
|
|
||||||
|
String list = post.get("rdffileslist");
|
||||||
|
|
||||||
|
for (String s: list.split("\n")) {
|
||||||
|
String newurl = s;
|
||||||
|
try {
|
||||||
|
DigestURI d = new DigestURI (s);
|
||||||
|
|
||||||
|
if (d.getHost().endsWith(".yacy")) {
|
||||||
|
newurl = d.getProtocol()+"://"+HTTPDemon.getAlternativeResolver().resolve(d.getHost())+d.getPath();
|
||||||
|
System.out.println (newurl);
|
||||||
|
}
|
||||||
|
} catch (MalformedURLException e) {
|
||||||
|
// TODO Auto-generated catch block
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
TripleStore.Load (newurl);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if (post.containsKey("rdffile")) {
|
||||||
|
|
||||||
|
TripleStore.Add(post.get("rdffile$file"));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (post.containsKey("query")) {
|
||||||
|
|
||||||
|
// Create a new query
|
||||||
|
String queryString = post.get("query");
|
||||||
|
|
||||||
|
q = queryString;
|
||||||
|
|
||||||
|
int count = 0;
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
com.hp.hpl.jena.query.Query query = QueryFactory.create(queryString);
|
||||||
|
|
||||||
|
// Execute the query and obtain results
|
||||||
|
QueryExecution qe = QueryExecutionFactory.create(query, TripleStore.model);
|
||||||
|
ResultSet resultSet = qe.execSelect();
|
||||||
|
|
||||||
|
ByteArrayOutputStream sos = new ByteArrayOutputStream();
|
||||||
|
|
||||||
|
ResultSetFormatter.outputAsRDF(sos, "", resultSet);
|
||||||
|
|
||||||
|
prop.putHTML("mode_rdfdump", sos.toString());
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
prop.putHTML("mode_query", q);
|
||||||
|
|
||||||
|
|
||||||
|
// return rewrite properties
|
||||||
|
return prop;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in new issue