removed jena library and all code that depended on jena. When jena was

introduced, it was also used for search facets. The generic search
facets are now deduced from generic solr fields which makes jena as tool
for facet semantics superfluous.
pull/1/head
Michael Peter Christen 11 years ago
parent 0e6729f9bc
commit 6e59ca4ebf

@ -70,7 +70,6 @@
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="lib" path="lib/icu4j-core.jar"/>
<classpathentry kind="lib" path="lib/htmllexer.jar"/>
<classpathentry kind="lib" path="lib/jena-2.6.4.jar"/>
<classpathentry kind="lib" path="lib/sax-2.0.1.jar"/>
<classpathentry kind="lib" path="lib/arq-2.8.7.jar"/>
<classpathentry kind="lib" path="lib/iri-0.8.jar"/>

@ -64,7 +64,6 @@
<string>$JAVAROOT/lib/jcifs-1.3.17.jar</string>
<string>$JAVAROOT/lib/jcl-over-slf4j-1.7.2.jar</string>
<string>$JAVAROOT/lib/jempbox-1.8.3.jar</string>
<string>$JAVAROOT/lib/jena-2.6.4.jar</string>
<string>$JAVAROOT/lib/jetty-client-8.1.14.v20131031.jar</string>
<string>$JAVAROOT/lib/jetty-continuation-8.1.14.v20131031.jar</string>
<string>$JAVAROOT/lib/jetty-http-8.1.14.v20131031.jar</string>

@ -188,7 +188,6 @@
<pathelement location="${lib}/jcifs-1.3.17.jar" />
<pathelement location="${lib}/jcl-over-slf4j-1.7.2.jar" />
<pathelement location="${lib}/jempbox-1.8.3" />
<pathelement location="${lib}/jena-2.6.4.jar" />
<pathelement location="${lib}/jetty-client-8.1.14.v20131031.jar" />
<pathelement location="${lib}/jetty-continuation-8.1.14.v20131031.jar" />
<pathelement location="${lib}/jetty-http-8.1.14.v20131031.jar" />

@ -1143,10 +1143,6 @@ core.service.fulltext = true
core.service.rwi.tmp = true
core.service.citation.tmp = true
core.service.webgraph.tmp = false
core.service.jena.tmp = false
# RDF triplestore settings
triplestore.persistent = true
# Augmentation settings
parserAugmentation = false

@ -15,50 +15,6 @@
You can download additional files here.
</p>
<form action="DictionaryLoader_p.html" method="post" enctype="multipart/form-data" accept-charset="UTF-8">
<fieldset>
<legend>Persons</legend>
Person dictionaries will help YaCy to identify Person names in input documents. As a result, a person Navigator is presented
<h4><a href="http://wiki.dbpedia.org/Downloads37#pnd" target="_blank">PND (Personennamendatei) identifiers from dbPedia - wikipedia extraction</a></h4>
<p>This file provides 150000 person names as an extraction from wikipedia where a PND from the Deutsche Nationalbibliothek is mentioned. It is not the 'raw' PND from d-dnb.de which is much larger but not available in the public.</p><!--http://downloads.dbpedia.org/3.7-i18n/de/pnd_de.nt.bz2-->
<dl>
<dt><label>Download from</label></dt>
<dd>#[pnd0URL]#</dd>
<dt><label>Storage location</label></dt>
<dd>#[pnd0Storage]#</dd>
<dt><label>Status</label></dt>
<dd>#(pnd0Status)#<div class="info">not loaded</div>::<div class="commit">loaded</div>::deactivated#(/pnd0Status)#</dd>
<dt>Action</dt>
<dd>#(pnd0Status)#
<input type="submit" name="pnd0Load" value="Load" />::
<input type="submit" name="pnd0Deactivate" value="Deactivate" />
<input type="submit" name="pnd0Remove" value="Remove" />::
<input type="submit" name="pnd0Activate" value="Activate" />
<input type="submit" name="pnd0Remove" value="Remove" />
#(/pnd0Status)#</dd>
#(pnd0ActionLoaded)#::
<dt>Result</dt><dd><div class="commit">loaded and activated dictionary file</div></dd>::
<dt>Result</dt><dd><div class="error">loading of dictionary file failed: #[error]#</div></dd>
#(/pnd0ActionLoaded)#
#(pnd0ActionRemoved)#::
<dt>Result</dt><dd><div class="commit">deactivated and removed dictionary file</div></dd>::
<dt>Result</dt><dd><div class="error">cannot remove dictionary file: #[error]#</div></dd>
#(/pnd0ActionRemoved)#
#(pnd0ActionDeactivated)#::
<dt>Result</dt><dd><div class="commit">deactivated dictionary file</div></dd>::
<dt>Result</dt><dd><div class="error">cannot deactivate dictionary file: #[error]#</div></dd>
#(/pnd0ActionDeactivated)#
#(pnd0ActionActivated)#::
<dt>Result</dt><dd><div class="commit">activated dictionary file</div></dd>::
<dt>Result</dt><dd><div class="error">cannot activate dictionary file: #[error]#</div></dd>
#(/pnd0ActionActivated)#
</dl>
</fieldset>
</form>
<form action="DictionaryLoader_p.html" method="post" enctype="multipart/form-data" accept-charset="UTF-8">
<fieldset>
<legend>Geolocalization</legend>

@ -275,46 +275,6 @@ public class DictionaryLoader_p {
prop.put("drw0ActionActivated", 1);
}
// PND0
if (post.containsKey("pnd0Load")) {
// load from the net
try {
final Response response = sb.loader.load(sb.loader.request(new DigestURL(LibraryProvider.Dictionary.PND0.url), false, true), CacheStrategy.NOCACHE, Integer.MAX_VALUE, null, ClientIdentification.yacyInternetCrawlerAgent);
final byte[] b = response.getContent();
FileUtils.copy(b, LibraryProvider.Dictionary.PND0.file());
LibraryProvider.activatePND();
prop.put("pnd0Status", LibraryProvider.Dictionary.PND0.file().exists() ? 1 : 0);
prop.put("pnd0ActionLoaded", 1);
} catch (final MalformedURLException e) {
ConcurrentLog.logException(e);
prop.put("pnd0ActionLoaded", 2);
prop.put("pnd0ActionLoaded_error", e.getMessage());
} catch (final IOException e) {
ConcurrentLog.logException(e);
prop.put("pnd0ActionLoaded", 2);
prop.put("pnd0ActionLoaded_error", e.getMessage());
}
}
if (post.containsKey("pnd0Remove")) {
LibraryProvider.deactivatePND();
FileUtils.deletedelete(LibraryProvider.Dictionary.PND0.file());
FileUtils.deletedelete(LibraryProvider.Dictionary.PND0.fileDisabled());
prop.put("pnd0ActionRemoved", 1);
}
if (post.containsKey("pnd0Deactivate")) {
LibraryProvider.deactivatePND();
LibraryProvider.Dictionary.PND0.file().renameTo(LibraryProvider.Dictionary.PND0.fileDisabled());
prop.put("pnd0ActionDeactivated", 1);
}
if (post.containsKey("pnd0Activate")) {
LibraryProvider.Dictionary.PND0.fileDisabled().renameTo(LibraryProvider.Dictionary.PND0.file());
LibraryProvider.activatePND();
prop.put("pnd0ActionActivated", 1);
}
// check status again
boolean keepPlacesTagging = false;
for (final LibraryProvider.Dictionary dictionary: LibraryProvider.Dictionary.values()) {

@ -88,13 +88,12 @@ function updatepage(str) {
<dl>
<dt class="TableCellDark">Index Deletion</dt>
<dd><input type="checkbox" name="deleteIndex" id="deleteIndex"
onclick="x=document.getElementById('deleteIndex').checked;#(rwi)#::document.getElementById('deleteRWI').checked=x;#(/rwi)#document.getElementById('deleteTriplestore').checked=x;document.getElementById('deleteRobots').checked=x;document.getElementById('deleteRobots').checked=x;document.getElementById('deleteCrawlQueues').checked=x;c='disabled';document.getElementById('deleteSearchFl').checked=x;if(x){c='';};document.getElementById('deleteTriplestore').disabled=c;document.getElementById('deletecomplete').disabled=c;document.getElementById('deleteCache').disabled=c;document.getElementById('deleteRobots').disabled=c;document.getElementById('deleteCrawlQueues').disabled=c;document.getElementById('deleteSearchFl').disabled=c;"
onclick="x=document.getElementById('deleteIndex').checked;#(rwi)#::document.getElementById('deleteRWI').checked=x;#(/rwi)#document.getElementById('deleteRobots').checked=x;document.getElementById('deleteRobots').checked=x;document.getElementById('deleteCrawlQueues').checked=x;c='disabled';document.getElementById('deleteSearchFl').checked=x;if(x){c='';};document.getElementById('deletecomplete').disabled=c;document.getElementById('deleteCache').disabled=c;document.getElementById('deleteRobots').disabled=c;document.getElementById('deleteCrawlQueues').disabled=c;document.getElementById('deleteSearchFl').disabled=c;"
/><label for="deleteIndex">Delete local search index (embedded Solr and old Metadata)</label><br/>
#(solr)#::<input type="checkbox" name="deleteRemoteSolr" id="deleteRemoteSolr" onclick="x=document.getElementById('deleteRemoteSolr').checked;c='disabled';if(x){c='';};document.getElementById('deletecomplete').disabled=c;" /><label for="deleteRemoteSolr">Delete remote solr index</label><br/>#(/solr)#
#(rwi)#::<input type="checkbox" name="deleteRWI" id="deleteRWI" onclick="x=document.getElementById('deleteRWI').checked;c='disabled';if(x){c='';};document.getElementById('deletecomplete').disabled=c;" /><label for="deleteRWI">Delete RWI Index (DHT transmission words)</label><br/>#(/rwi)#
#(citation)#::<input type="checkbox" name="deleteCitation" id="deleteCitation" onclick="x=document.getElementById('deleteCitation').checked;c='disabled';if(x){c='';};document.getElementById('deletecomplete').disabled=c;" /><label for="deleteCitation">Delete Citation Index (linking between URLs)</label><br/>#(/citation)#
<input type="checkbox" name="deleteCache" id="deleteCache" disabled="disabled" /><label for="deleteCache">Delete HTTP &amp; FTP Cache</label><br/>
<input type="checkbox" name="deleteTriplestore" id="deleteTriplestore" disabled="disabled" /><label for="deleteTriplestore">Delete RDF Triplestore</label><br/>
<input type="checkbox" name="deleteCrawlQueues" id="deleteCrawlQueues" disabled="disabled" /><label for="deleteCrawlQueues">Stop Crawler and delete Crawl Queues</label><br/>
<input type="checkbox" name="deleteRobots" id="deleteRobots" disabled="disabled" /><label for="deleteRobots">Delete robots.txt Cache</label><br/>
<input type="checkbox" name="deleteSearchFl" id="deleteSearchFl" disabled="disabled" /><label for="deleteSearchFl">Delete cached snippet-fetching failures during search</label><br/><br/>

@ -40,7 +40,6 @@ import net.yacy.cora.date.GenericFormatter;
import net.yacy.cora.document.encoding.ASCII;
import net.yacy.cora.document.id.DigestURL;
import net.yacy.cora.federate.yacy.CacheStrategy;
import net.yacy.cora.lod.JenaTripleStore;
import net.yacy.cora.protocol.ClientIdentification;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.cora.sorting.ReversibleScoreMap;
@ -166,9 +165,6 @@ public class IndexControlURLs_p {
sb.crawlStacker.clear();
ResultURLs.clearStacks();
}
if ( post.get("deleteTriplestore", "").equals("on") ) {
JenaTripleStore.clear();
}
if ( post.get("deleteCache", "").equals("on") ) {
Cache.clear();
}

@ -97,24 +97,6 @@
</fieldset>
</form>
<!--
<form id="config" action="IndexFederated_p.html" method="get" enctype="multipart/form-data" accept-charset="UTF-8">
<fieldset>
<legend>
Content Semantics
</legend>
YaCy uses a Apache Jena instance to host metadata about web pages.
<dl>
<dt><input type="checkbox" name="core.service.jena.tmp" id="core_service_jena" #(core.service.jena.tmp.checked)#:: checked="checked"#(/core.service.jena.tmp.checked)# /></dt>
<dd>write document metadata to the Jena index.</dd>
<dt><input type="submit" name="setjena" value="Set" /></dt><dd></dd>
</dl>
</fieldset>
</form>
-->
<form id="config" action="IndexFederated_p.html" method="get" enctype="multipart/form-data" accept-charset="UTF-8">
<fieldset>
<legend>

@ -74,11 +74,6 @@ public class IndexFederated_p {
env.setConfig(SwitchboardConstants.CORE_SERVICE_WEBGRAPH, webgraph);
}
if (post != null && post.containsKey("setjena")) {
boolean jena = post.getBoolean(SwitchboardConstants.CORE_SERVICE_JENA);
env.setConfig(SwitchboardConstants.CORE_SERVICE_JENA, jena);
}
if (post != null && post.containsKey("setsolr")) {
boolean post_core_fulltext = post.getBoolean(SwitchboardConstants.CORE_SERVICE_FULLTEXT);
final boolean previous_core_fulltext = sb.index.fulltext().connectedLocalSolr() && env.getConfigBool(SwitchboardConstants.CORE_SERVICE_FULLTEXT, false);
@ -179,7 +174,6 @@ public class IndexFederated_p {
prop.put(SwitchboardConstants.CORE_SERVICE_RWI + ".checked", env.getConfigBool(SwitchboardConstants.CORE_SERVICE_RWI, false) ? 1 : 0);
prop.put(SwitchboardConstants.CORE_SERVICE_CITATION + ".checked", env.getConfigBool(SwitchboardConstants.CORE_SERVICE_CITATION, false) ? 1 : 0);
prop.put(SwitchboardConstants.CORE_SERVICE_WEBGRAPH + ".checked", env.getConfigBool(SwitchboardConstants.CORE_SERVICE_WEBGRAPH, false) ? 1 : 0);
prop.put(SwitchboardConstants.CORE_SERVICE_JENA + ".checked", env.getConfigBool(SwitchboardConstants.CORE_SERVICE_JENA, false) ? 1 : 0);
prop.put("solr.indexing.solrremote.checked", env.getConfigBool(SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_ENABLED, false) ? 1 : 0);
prop.put("solr.indexing.url", env.getConfig(SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_URL, "http://127.0.0.1:8983/solr").replace(",", "\n"));
prop.put("solr.indexing.sharding", env.getConfig(SwitchboardConstants.FEDERATED_SERVICE_SOLR_INDEXING_SHARDING, "modulo-host-md5"));

@ -1,2 +0,0 @@
#{entries}##[s]#;#[p]#;#[o]#
#{/entries}#
1 #{entries}##[s]#;#[p]#;#[o]#
2 #{/entries}#

@ -1,120 +0,0 @@
<!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%#
#%env/templates/submenuSemantic.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>

@ -1,155 +0,0 @@
/**
* Triple_p
* Copyright 2012 by Michael Peter Christen, mc@yacy.net, Frankfurt am Main, Germany
* First released 14.09.2011 at http://yacy.net
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program in the file lgpl21.txt
* If not, see <http://www.gnu.org/licenses/>.
*/
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.net.MalformedURLException;
import net.yacy.cora.document.id.DigestURL;
import net.yacy.cora.lod.JenaTripleStore;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.cora.util.ConcurrentLog;
import net.yacy.server.serverObjects;
import net.yacy.server.serverSwitch;
import net.yacy.server.http.HTTPDemon;
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;
public class Triple_p {
public static serverObjects respond(@SuppressWarnings("unused") final RequestHeader header,
final serverObjects post, @SuppressWarnings("unused") final serverSwitch env) {
final serverObjects prop = new serverObjects();
prop.put("display", 1); // Fixed to 1
prop.putHTML("mode_output", "no query performed");
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:hasvalue ?pa .\n"+
"FILTER (xsd:float (?pa) > 21.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 {
DigestURL d = new DigestURL (s);
if (d.getHost().endsWith(".yacy")) {
newurl = d.getProtocol()+"://"+HTTPDemon.getAlternativeResolver().resolve(d.getHost())+d.getPath();
System.out.println (newurl);
}
JenaTripleStore.load(newurl);
} catch (final MalformedURLException e) {
ConcurrentLog.logException(e);
} catch (final IOException e) {
ConcurrentLog.logException(e);
}
}
}
if (post.containsKey("rdffile")) {
JenaTripleStore.addFile(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, JenaTripleStore.model);
ResultSet resultSet = qe.execSelect();
ByteArrayOutputStream sos = new ByteArrayOutputStream();
ResultSetFormatter.outputAsRDF(sos, "", resultSet);
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 (final Exception e) {
prop.putHTML("mode_rdfdump", "error");
}
prop.putHTML("mode_output", ""+count);
}
}
prop.putHTML("mode_query", q);
// return rewrite properties
return prop;
}
}

@ -1,68 +0,0 @@
<!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%#
</head>
<body id="Settings">
<div id="api">
<a href="/interaction/GetRDF.xml?global=" id="apilink"><img src="/env/grafics/api.png" width="60" height="40" alt="API"/></a>
<span>The information that is presented on this page can also be retrieved as XML
Click the API icon to see the Triplestore.
To see a list of all APIs, please visit the <a href="http://www.yacy-websuche.de/wiki/index.php/Dev:API" target="_blank">API wiki page</a>.</span>
</div>
#%env/templates/header.template%#
#%env/templates/submenuSemantic.template%#
<h2>Triplestore</h2>
<form id="parsersettings" action="Triplestore_p.html" method="post" enctype="multipart/form-data">
<fieldset><legend id="urlproxy">Triplestore</legend>
<p>
With this settings you change the behavior of the jena-based Triplestore.
</p>
<dl>
<dt>Triplestore size:</dt>
<dd>
#[size]#
</dd>
<dt><label for="content">Persistent store:</label></dt>
<dd>
<input type="checkbox" name="tspersistentenabled" id="tspersistentenabled" #(tspersistentenabled_checked)#:: checked="checked"#(/tspersistentenabled_checked)# />Enabled<br/>
<p class="help">
If enabled, the Triplestore will save its content on shutdown on the filesystem and load it again on startup.
</p>
</dd>
<!-- <dt><label for="author">Forward feedback to peer:</label></dt>
<dd>
<input type="text" name="feedbackforward" value="#[feedbackforward]#" size="60" /><br/><br/>
<p class="help">
Feedback is forwarded to this peer.
</p>
</dd>
<dt><label for="content">Store Feedback on this peer:</label></dt>
<dd>
<input type="checkbox" name="acceptfeedbackenabled" id="acceptfeedbackenabled" #(acceptfeedbackenabled_checked)#:: checked="checked"#(/acceptfeedbackenabled_checked)# />Enabled<br/>
<p class="help">
If enabled, this peer will accept Feedback items and will NOT forward them.
</p>
</dd> -->
</dl>
<input type="submit" name="tsSettings" value="Submit"/>
</fieldset>
</form>
#%env/templates/footer.template%#
</body>
</html>

@ -1,59 +0,0 @@
/**
* Triplestore_p
* Copyright 2012 by Michael Peter Christen, mc@yacy.net, Frankfurt am Main, Germany
* First released 14.09.2011 at http://yacy.net
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program in the file lgpl21.txt
* If not, see <http://www.gnu.org/licenses/>.
*/
import net.yacy.cora.lod.JenaTripleStore;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.server.serverObjects;
import net.yacy.server.serverSwitch;
public final class Triplestore_p {
public static serverObjects respond(@SuppressWarnings("unused") final RequestHeader header,
final serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements
final serverObjects prop = new serverObjects();
if (post != null) {
if (post.containsKey("tsSettings")) {
env.setConfig("triplestore.persistent",
"on".equals(post.get("tspersistentenabled")) ? true : false);
// env.setConfig("interaction.feedback.accept",
// "on".equals(post.get("acceptfeedbackenabled")) ? true : false);
}
}
prop.put("tspersistentenabled_checked",
env.getConfigBool("triplestore.persistent", false) ? "1" : "0");
// prop.put("acceptfeedbackenabled_checked",
// env.getConfigBool("interaction.feedback.accept", false) ? "1" : "0");
prop.put("size", JenaTripleStore.size());
// return rewrite properties
return prop;
}
}

@ -103,7 +103,6 @@ function updatepage(str) {
<dt>Size:</dt><dd>#[size]# Bytes</dd>#(mimeTypeAvailable)#::
<dt>MimeType:</dt><dd>#[mimeType]#</dd>#(/mimeTypeAvailable)#
<dt>Collections:</dt><dd>#[collections]#</dd>
<dt>Triplestore:</dt><dd><pre>#[triples]#</pre></dd>
<dt><label for="viewMode">View as</label>:</dt>
<dd>
<select id="viewMode" name="viewMode" onchange='this.form.submit()'>

@ -39,8 +39,6 @@ import net.yacy.cora.document.id.AnchorURL;
import net.yacy.cora.document.id.DigestURL;
import net.yacy.cora.document.id.MultiProtocolURL;
import net.yacy.cora.federate.yacy.CacheStrategy;
import net.yacy.cora.lod.JenaTripleStore;
import net.yacy.cora.lod.vocabulary.YaCyMetadata;
import net.yacy.cora.protocol.ClientIdentification;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.crawler.data.Cache;
@ -59,9 +57,6 @@ import net.yacy.search.index.Segment;
import net.yacy.server.serverObjects;
import net.yacy.server.serverSwitch;
import com.hp.hpl.jena.rdf.model.Model;
public class ViewFile {
public static final int VIEW_MODE_NO_TEXT = 0;
@ -352,8 +347,6 @@ public class ViewFile {
prop.putNum("error_size", size);
prop.put("error_mimeTypeAvailable", (response.getMimeType() == null) ? "0" : "1");
prop.put("error_mimeTypeAvailable_mimeType", response.getMimeType());
Model model = JenaTripleStore.getSubmodelBySubject(YaCyMetadata.hashURI(url.hash()));
prop.putXML("error_triples", JenaTripleStore.getRDFByModel(model));
if (urlEntry == null) {
prop.put("error_referrerHash", "");

@ -1,66 +1,21 @@
import java.io.IOException;
import java.util.Iterator;
import net.yacy.cora.document.encoding.UTF8;
import net.yacy.cora.protocol.HeaderFramework;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.cora.util.ConcurrentLog;
import net.yacy.cora.util.SpaceExceededException;
import net.yacy.data.UserDB;
import net.yacy.data.ymark.YMarkEntry;
import net.yacy.data.ymark.YMarkRDF;
import net.yacy.data.ymark.YMarkTables;
import net.yacy.data.ymark.YMarkTables.TABLES;
import net.yacy.kelondro.blob.Tables;
import net.yacy.search.Switchboard;
import net.yacy.server.serverObjects;
import net.yacy.server.serverSwitch;
public class YMarks {
public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
public static serverObjects respond(final RequestHeader header, @SuppressWarnings("unused") final serverObjects post, final serverSwitch env) {
final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
final UserDB.Entry user = sb.userDB.getUser(header);
final boolean isAdmin = (sb.verifyAuthentication(header));
final boolean isAuthUser = user!= null && user.hasRight(UserDB.AccessRight.BOOKMARK_RIGHT);
final String path = header.get(HeaderFramework.CONNECTION_PROP_PATH);
if(path != null && path.endsWith(".rdf")) {
YMarkRDF rdf = new YMarkRDF("http://"+sb.peers.myAlternativeAddress());
if(post != null && post.containsKey(YMarkEntry.BOOKMARKS_ID)) {
final String id[] = post.get(YMarkEntry.BOOKMARKS_ID).split(":");
if(id[1].equals("b")) {
final String bmk_user = id[0];
final String bmk_table = TABLES.BOOKMARKS.tablename(bmk_user);
final byte[] urlHash = UTF8.getBytes(id[2]);
Tables.Row bmk_row;
try {
bmk_row = sb.tables.select(bmk_table, urlHash);
rdf.addBookmark(bmk_user, bmk_row);
} catch (final IOException e) {
} catch (final SpaceExceededException e) {
}
}
} else {
final Iterator<String> iter = sb.tables.iterator();
while(iter.hasNext()) {
final String bmk_table = iter.next();
final int i = bmk_table.indexOf(TABLES.BOOKMARKS.basename());
if(i > 0) {
final String bmk_user = bmk_table.substring(0, i);
try {
// TODO select only public bookmarks
rdf.addBookmarks(bmk_user, sb.tables.iterator(bmk_table));
} catch (final IOException e) {
// TODO exception handling
}
}
}
}
prop.put("rdf", rdf.getRDF("RDF/XML-ABBREV"));
return prop;
}
if(isAdmin || isAuthUser) {
prop.put("login", 1);
final String bmk_user = (isAuthUser ? user.getUserName() : YMarkTables.USER_ADMIN);

@ -52,7 +52,6 @@ To see a list of all APIs, please visit the <a href="http://www.yacy-websuche.de
<dt>Incoming Links (citation)</dt><dd property="yacy:citations">#[yacy_citations]#</dd>
<dt>Location</dt><dd><a href="/osm.png?lon=#[geo_long]#&lat=#[geo_lat]#&zoom=14" onclick="return hs.expand(this)">lat=#[geo_lat]#, lon=#[geo_long]#</a></dd>
<dt>Metadata Triplestore</dt><dd><pre>#[triples]#</pre></dd>
</dl>
</fieldset>

@ -27,15 +27,11 @@
import java.net.MalformedURLException;
import java.util.Arrays;
import java.util.Iterator;
import net.yacy.cora.date.ISO8601Formatter;
import net.yacy.cora.document.encoding.ASCII;
import net.yacy.cora.document.id.DigestURL;
import net.yacy.cora.lod.JenaTripleStore;
import net.yacy.cora.lod.vocabulary.YaCyMetadata;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.cora.protocol.RequestHeader.FileType;
import net.yacy.cora.util.ConcurrentLog;
import net.yacy.kelondro.data.meta.URIMetadataNode;
import net.yacy.kelondro.data.word.Word;
@ -44,12 +40,9 @@ import net.yacy.search.index.Segment;
import net.yacy.server.serverObjects;
import net.yacy.server.serverSwitch;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.RDFNode;
public class yacydoc {
public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
public static serverObjects respond(@SuppressWarnings("unused") final RequestHeader header, final serverObjects post, final serverSwitch env) {
// return variable that accumulates replacements
final Switchboard sb = (Switchboard) env;
@ -130,25 +123,6 @@ public class yacydoc {
prop.put("yacy_inbound", entry.llocal());
prop.put("yacy_outbound", entry.lother());
// extract the submodel from the triplestore
Model model = JenaTripleStore.getSubmodelBySubject(YaCyMetadata.hashURI(entry.hash()));
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()+",";
}
ConcurrentLog.info("yacydoc", references);
prop.put("taglinks", references);
// return rewrite properties
return prop;
}

@ -18,12 +18,4 @@
<li><a href="/AugmentedParsing_p.html" class="MenuItemLink lock">Augmented Parsing</a></li>
</ul>
</div>
<div class="SubMenugroup">
<h3>Linked Data</h3>
<ul class="SubMenu">
<li><a href="/Triplestore_p.html" class="MenuItemLink lock">Triplestore</a></li>
<li><a href="/Triple_p.html" class="MenuItemLink lock">Query</a></li>
</ul>
</div>
</div>

@ -1,101 +0,0 @@
package interaction;
//ViewLog_p.java
//-----------------------
//part of the AnomicHTTPD caching proxy
//(C) by Michael Peter Christen; mc@yacy.net
//first published on http://www.anomic.de
//Frankfurt, Germany, 2004
//
//This File is contributed by Alexander Schier
//last major change: 14.12.2004
//
//This program is free software; you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation; either version 2 of the License, or
//(at your option) any later version.
//
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU General Public License for more details.
//
//You should have received a copy of the GNU General Public License
//along with this program; if not, write to the Free Software
//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//You must compile this file with
//javac -classpath .:../classes ViewLog_p.java
//if the shell's current path is HTROOT
import java.io.ByteArrayOutputStream;
import java.io.UnsupportedEncodingException;
import net.yacy.cora.document.encoding.UTF8;
import net.yacy.cora.lod.JenaTripleStore;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.interaction.Interaction;
import net.yacy.server.serverObjects;
import net.yacy.server.serverSwitch;
import com.hp.hpl.jena.rdf.model.Model;
public class GetRDF {
public static serverObjects respond(final RequestHeader header, final serverObjects post, @SuppressWarnings("unused") final serverSwitch env) {
final serverObjects prop = new serverObjects();
Boolean global = false;
if(post != null){
global = post.containsKey("global");
}
if (global) {
ByteArrayOutputStream fout;
fout = new ByteArrayOutputStream();
JenaTripleStore.model.write(fout);
try {
prop.put("resultXML", fout.toString(UTF8.charset.name()));
} catch (final UnsupportedEncodingException e) {
}
} else {
Model tmp = JenaTripleStore.privatestorage.get(Interaction.GetLoggedOnUser(header));
if (tmp != null) {
ByteArrayOutputStream fout;
fout = new ByteArrayOutputStream();
tmp.write(fout);
try {
prop.put("resultXML", fout.toString(UTF8.charset.name()));
} catch (final UnsupportedEncodingException e) {
}
} else {
prop.put("resultXML", "");
}
}
return prop;
}
}

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

@ -1,94 +0,0 @@
package interaction;
//ViewLog_p.java
//-----------------------
//part of the AnomicHTTPD caching proxy
//(C) by Michael Peter Christen; mc@yacy.net
//first published on http://www.anomic.de
//Frankfurt, Germany, 2004
//
//This File is contributed by Alexander Schier
//last major change: 14.12.2004
//
//This program is free software; you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation; either version 2 of the License, or
//(at your option) any later version.
//
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU General Public License for more details.
//
//You should have received a copy of the GNU General Public License
//along with this program; if not, write to the Free Software
//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//You must compile this file with
//javac -classpath .:../classes ViewLog_p.java
//if the shell's current path is HTROOT
import java.io.ByteArrayOutputStream;
import net.yacy.cora.lod.JenaTripleStore;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.interaction.Interaction;
import net.yacy.server.serverObjects;
import net.yacy.server.serverSwitch;
import com.hp.hpl.jena.rdf.model.Model;
public class PutRDF {
public static serverObjects respond(final RequestHeader header, final serverObjects post, @SuppressWarnings("unused") final serverSwitch env) {
final serverObjects prop = new serverObjects();
Boolean global = false;
if(post != null){
global = post.containsKey("global");
}
if (global) {
ByteArrayOutputStream fout;
fout = new ByteArrayOutputStream();
JenaTripleStore.model.write(fout);
prop.put("resultXML", fout.toString());
} else {
Model tmp = JenaTripleStore.privatestorage.get(Interaction.GetLoggedOnUser(header));
if (tmp != null) {
ByteArrayOutputStream fout;
fout = new ByteArrayOutputStream();
tmp.write(fout);
prop.put("resultXML", fout.toString());
} else {
prop.put("resultXML", "");
}
}
return prop;
}
}

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

@ -1,132 +0,0 @@
package interaction;
//ViewLog_p.java
//-----------------------
//part of the AnomicHTTPD caching proxy
//(C) by Michael Peter Christen; mc@yacy.net
//first published on http://www.anomic.de
//Frankfurt, Germany, 2004
//
//This File is contributed by Alexander Schier
//last major change: 14.12.2004
//
//This program is free software; you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation; either version 2 of the License, or
//(at your option) any later version.
//
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU General Public License for more details.
//
//You should have received a copy of the GNU General Public License
//along with this program; if not, write to the Free Software
//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//You must compile this file with
//javac -classpath .:../classes ViewLog_p.java
//if the shell's current path is HTROOT
import net.yacy.cora.protocol.HeaderFramework;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.data.UserDB;
import net.yacy.interaction.Interaction;
import net.yacy.search.Switchboard;
import net.yacy.server.serverObjects;
import net.yacy.server.serverSwitch;
public class Table {
public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
UserDB.Entry entry=null;
//default values
prop.put("enabled_logged_in", "0");
prop.put("enabled_logged-in_limit", "0");
String username = "anonymous";
prop.put("enabled_status", "0");
//identified via HTTPPassword
entry=sb.userDB.proxyAuth((header.get(RequestHeader.AUTHORIZATION, "xxxxxx")));
if(entry != null){
prop.put("enabled_logged-in_identified-by", "1");
//try via cookie
}else{
entry=sb.userDB.cookieAuth(header.getHeaderCookies());
prop.put("enabled_logged-in_identified-by", "2");
//try via ip
if(entry == null){
entry=sb.userDB.ipAuth((header.get(HeaderFramework.CONNECTION_PROP_CLIENTIP, "xxxxxx")));
if(entry != null){
prop.put("enabled_logged-in_identified-by", "0");
}
}
}
//identified via userDB
if(entry != null){
prop.put("enabled_logged-in", "1");
username = entry.getUserName();
if(entry.getTimeLimit() > 0){
prop.put("enabled_logged-in_limit", "1");
final long limit=entry.getTimeLimit();
final long used=entry.getTimeUsed();
prop.put("enabled_logged-in_limit_timelimit", limit);
prop.put("enabled_logged-in_limit_timeused", used);
int percent=0;
if(limit!=0 && used != 0)
percent=(int)((float)used/(float)limit*100);
prop.put("enabled_logged-in_limit_percent", percent/3);
prop.put("enabled_logged-in_limit_percent2", (100-percent)/3);
}
//logged in via static Password
}else if(sb.verifyAuthentication(header)){
prop.put("enabled_logged-in", "2");
username = "staticadmin";
//identified via form-login
//TODO: this does not work for a static admin, yet.
}
String s = "";
String p = "";
String o = "";
Boolean global = false;
if(post != null){
if(post.containsKey("s")){
s = post.get("s");
}
if(post.containsKey("p")){
p = post.get("p");
}
if(post.containsKey("o")){
o = post.get("o");
}
global = post.containsKey("global");
}
if (post.containsKey("load")) {
o = Interaction.GetTableentry(s, p, global ? "global" : username);
} else {
Interaction.Tableentry(s, p, o, global ? "global" : username, "");
}
prop.put("result", o);
return prop;
}
}

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

@ -1,135 +0,0 @@
package interaction;
//ViewLog_p.java
//-----------------------
//part of the AnomicHTTPD caching proxy
//(C) by Michael Peter Christen; mc@yacy.net
//first published on http://www.anomic.de
//Frankfurt, Germany, 2004
//
//This File is contributed by Alexander Schier
//last major change: 14.12.2004
//
//This program is free software; you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation; either version 2 of the License, or
//(at your option) any later version.
//
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU General Public License for more details.
//
//You should have received a copy of the GNU General Public License
//along with this program; if not, write to the Free Software
//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//You must compile this file with
//javac -classpath .:../classes ViewLog_p.java
//if the shell's current path is HTROOT
import net.yacy.cora.lod.JenaTripleStore;
import net.yacy.cora.protocol.HeaderFramework;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.data.UserDB;
import net.yacy.search.Switchboard;
import net.yacy.server.serverObjects;
import net.yacy.server.serverSwitch;
public class Triple {
public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) {
final Switchboard sb = (Switchboard) env;
final serverObjects prop = new serverObjects();
UserDB.Entry entry=null;
//default values
prop.put("enabled_logged_in", "0");
prop.put("enabled_logged-in_limit", "0");
String username = "anonymous";
prop.put("enabled_status", "0");
//identified via HTTPPassword
entry=sb.userDB.proxyAuth((header.get(RequestHeader.AUTHORIZATION, "xxxxxx")));
if(entry != null){
prop.put("enabled_logged-in_identified-by", "1");
//try via cookie
}else{
entry=sb.userDB.cookieAuth(header.getHeaderCookies());
prop.put("enabled_logged-in_identified-by", "2");
//try via ip
if(entry == null){
entry=sb.userDB.ipAuth((header.get(HeaderFramework.CONNECTION_PROP_CLIENTIP, "xxxxxx")));
if(entry != null){
prop.put("enabled_logged-in_identified-by", "0");
}
}
}
//identified via userDB
if(entry != null){
prop.put("enabled_logged-in", "1");
username = entry.getUserName();
if(entry.getTimeLimit() > 0){
prop.put("enabled_logged-in_limit", "1");
final long limit=entry.getTimeLimit();
final long used=entry.getTimeUsed();
prop.put("enabled_logged-in_limit_timelimit", limit);
prop.put("enabled_logged-in_limit_timeused", used);
int percent=0;
if(limit!=0 && used != 0)
percent=(int)((float)used/(float)limit*100);
prop.put("enabled_logged-in_limit_percent", percent/3);
prop.put("enabled_logged-in_limit_percent2", (100-percent)/3);
}
//logged in via static Password
}else if(sb.verifyAuthentication(header)){
prop.put("enabled_logged-in", "2");
username = "staticadmin";
//identified via form-login
//TODO: this does not work for a static admin, yet.
}
String s = "";
String p = "";
String o = "";
String result = "";
Boolean global = false;
if (post != null) {
s = post.get("s", "");
p = post.get("p", "");
o = post.get("o", "");
if (post.containsKey("sp")) s = post.get("sp") + "#" + s;
if (post.containsKey("pp")) p = post.get("pp") + "#" + p;
global = post.containsKey("global");
if (post.containsKey("load")) {
if (global) {
result = JenaTripleStore.getObject(s, p);
} else {
result = JenaTripleStore.getPrivateObject(s, p, username);
}
} else {
if (global) {
JenaTripleStore.addTriple(s, p, o);
} else {
JenaTripleStore.addTriple(s, p, o, username);
}
}
}
prop.put("result", result);
return prop;
}
}

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

@ -1,35 +0,0 @@
<style type="text/css" >
.sci_doc {
font: arial,helvetica,sans-serif;
font-size: 10px;
background: #ffffff;
border:0px;
width: 150px;
height: 20px;
z-index:99998;
}
</style>
<span id="sci_doc_#[hash]#" class="sci_doc" style="display: none;">
<img id="sci_doc_#[hash]#_img" src="/currentyacypeer/interaction_elements/document.png" width="16px" height="16px" alt="0" onclick="/* $('#sci_doc_#[hash]#_box').toggle();*/ return false">&nbsp; <span style="font-size: x-small; position: absolute; margin-top: 4px;"><span id="sci_doc_#[hash]#_title"></span></span>
</span>
<div id="sci_doc_#[hash]#_box" class="sci_panel" style="top: 50px; display: none;">
</div>
<script type="text/javascript" charset="utf-8">
document.getElementById('sci_doc_#[hash]#').style.display = "";
var metajson = getMetadata('#[url]#');
var title = metajson.item.title.substring(0, 20)+"...";
document.getElementById('sci_doc_#[hash]#_title').innerHTML = title;
</script>

@ -1,19 +0,0 @@
package interaction_elements;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.server.serverObjects;
import net.yacy.server.serverSwitch;
public class Document_part {
public static serverObjects respond(@SuppressWarnings("unused") final RequestHeader header, final serverObjects post, @SuppressWarnings("unused") final serverSwitch env) {
final serverObjects prop = new serverObjects();
prop.put("hash", post.get("hash", ""));
prop.put("url", post.get("url", ""));
prop.put("action", post.get("action", ""));
return prop;
}
}

@ -1,88 +0,0 @@
#(enabled)#::
<!-- BEGIN Footer.html -->
<style type="text/css">
.SubMenuFooter h3 {
-webkit-border-radius: 5px;
-khtml-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
background-color:#[color]#;
color:white;
}
a.MenuItemLinkFooter, ul.SubMenuFooter em {
background-color: #[color]#;
color:#[color]#;
}
a:hover.MenuItemLinkFooter {
background-color:#[color]#;
color:#[color]#;
}
ul.SubMenuFooter a.MenuItemLinkFooter {
margin-top:0;
}
a.MenuItemLinkFooter{
display:block;
text-decoration:none;
margin-top:1px;
margin-bottom:1px;
padding:1px 10px 1px 15px;
font-size:0.9em;
white-space:nowrap;
}
a:hover.MenuItemLinkFooter {
text-decoration:none;
}
ul.SubMenuFooter em {
margin-top:0;
}
ul.SubMenuFooter em {
display:block;
text-decoration:none;
margin-top:1px;
margin-bottom:1px;
padding:1px 10px 1px 15px;
font-size:0.9em;
}
ul.SubMenuFooter {
clear:left;
padding:0;
margin:0;
}
ul.SubMenuFooter li {
list-style:none;
margin:0;
margin-top:1px;
padding:0;
}
ul.SubMenuFooter li {
float:left;
margin-right:1px;
margin-top:0;
}
</style>
<div style="position: fixed; bottom: 0px; width: 100%;">
<ul class="SubMenuFooter">
#(userlogonenabled)#::<li style="width:#[ratio]#%;"><!--#include virtual="/currentyacypeer/interaction_elements/Loginstatus_part.html" --></li>#(/userlogonenabled)#
</ul>
</div>
<!-- END Footer.html -->
#(/enabled)#

@ -1,32 +0,0 @@
package interaction_elements;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.server.serverObjects;
import net.yacy.server.serverSwitch;
public class Footer {
public static serverObjects respond(@SuppressWarnings("unused") final RequestHeader requestHeader, @SuppressWarnings("unused") final serverObjects post, final serverSwitch env) {
final serverObjects prop = new serverObjects();
prop.put("enabled_color", env.getConfig("color_tableheader", ""));
int count = 0;
prop.put("enabled_userlogonenabled", env.getConfigBool("interaction.userlogon.enabled", false) ? "1" : "0");
if (env.getConfigBool("interaction.userlogon.enabled", false)) count++;
if (count > 0) {
prop.put("enabled", "1");
prop.put("enabled_userlogonenabled_ratio", Math.round(100/count)-1);
} else {
prop.put("enabled", "0");
}
return prop;
}
}

@ -1,10 +0,0 @@
#(enabled)#::
<!-- Loginbutton_part -->
#(logged-in)#
<a id="logon_trigger" href="" class="MenuItemLinkFooter" style="color: #fff; background-color: #[color]#;" onclick="return false;"><img src="/currentyacypeer/interaction_elements/login_empty.png"> #[username]#</a>
::
<a id="logon_trigger" href="" class="MenuItemLinkFooter" style="color: #fff; background-color: #[color]#;" onclick="return false;"><img src="/currentyacypeer/interaction_elements/login_user.png"> #[username]#</a>
::
<a id="logon_trigger" href="" class="MenuItemLinkFooter" style="color: #fff; background-color: #[color]#;" onclick="return false;"><img src="/currentyacypeer/interaction_elements/login_admin.png"> #[username]#</a>
#(/logged-in)#
#(/enabled)#

@ -1,114 +0,0 @@
package interaction_elements;
//ViewLog_p.java
//-----------------------
//part of the AnomicHTTPD caching proxy
//(C) by Michael Peter Christen; mc@yacy.net
//first published on http://www.anomic.de
//Frankfurt, Germany, 2004
//
//This File is contributed by Alexander Schier
//last major change: 14.12.2004
//
//This program is free software; you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation; either version 2 of the License, or
//(at your option) any later version.
//
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU General Public License for more details.
//
//You should have received a copy of the GNU General Public License
//along with this program; if not, write to the Free Software
//Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//You must compile this file with
//javac -classpath .:../classes ViewLog_p.java
//if the shell's current path is HTROOT
import net.yacy.cora.protocol.HeaderFramework;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.data.UserDB;
import net.yacy.search.Switchboard;
import net.yacy.server.serverObjects;
import net.yacy.server.serverSwitch;
import net.yacy.server.servletProperties;
public class Loginstatus_part {
public static serverObjects respond(final RequestHeader requestHeader, @SuppressWarnings("unused") final serverObjects post, final serverSwitch env) {
final Switchboard sb = (Switchboard) env;
final servletProperties prop = new servletProperties();
prop.put("enabled", env.getConfigBool("interaction.userlogon.enabled", false) ? "1" : "0");
prop.put("enabled_color", env.getConfig("color_tableheader", ""));
prop.put("enabled_logged-in_registrationenabled", env.getConfigBool("interaction.userselfregistration.enabled", false) ? "1" : "0");
//
// final String address = sb.peers.mySeed().getPublicAddress();
prop.put("enabled_peer", sb.peers.myName());
prop.put("enabled_logged-in_returnto", "/index.html");
UserDB.Entry entry=null;
//default values
prop.put("enabled_logged_in", "0");
prop.put("enabled_logged-in_limit", "0");
prop.put("enabled_logged-in_username", "anonymous");
prop.put("enabled_status", "0");
//identified via HTTPPassword
entry=sb.userDB.proxyAuth((requestHeader.get(RequestHeader.AUTHORIZATION, "xxxxxx")));
if(entry != null){
prop.put("enabled_logged-in_identified-by", "1");
//try via cookie
}else{
entry=sb.userDB.cookieAuth(requestHeader.getHeaderCookies());
prop.put("enabled_logged-in_identified-by", "2");
//try via ip
if(entry == null){
entry=sb.userDB.ipAuth((requestHeader.get(HeaderFramework.CONNECTION_PROP_CLIENTIP, "xxxxxx")));
if(entry != null){
prop.put("enabled_logged-in_identified-by", "0");
}
}
}
//identified via userDB
if(entry != null){
prop.put("enabled_logged-in", "1");
prop.put("enabled_logged-in_username", entry.getUserName());
if(entry.getTimeLimit() > 0){
prop.put("enabled_logged-in_limit", "1");
final long limit=entry.getTimeLimit();
final long used=entry.getTimeUsed();
prop.put("enabled_logged-in_limit_timelimit", limit);
prop.put("enabled_logged-in_limit_timeused", used);
int percent=0;
if(limit!=0 && used != 0)
percent=(int)((float)used/(float)limit*100);
prop.put("enabled_logged-in_limit_percent", percent/3);
prop.put("enabled_logged-in_limit_percent2", (100-percent)/3);
}
//logged in via static Password
}else if(sb.verifyAuthentication(requestHeader)){
prop.put("enabled_logged-in", "2");
prop.put("enabled_logged-in_username", "staticadmin");
//identified via form-login
//TODO: this does not work for a static admin, yet.
}
// return rewrite properties
return prop;
}
}

@ -1,195 +0,0 @@
#(enabled)#::
<style type="text/css" >
.sci_headerbar {
font: arial,helvetica,sans-serif;
font-size: 10px;
position: fixed;
left: 0;
top: 0px;;
width: 100%;
height: 37px;
border:0px;
background: #ffffff;
padding: 0px 0px 0px 0px;
z-index:99998;
text-align: left;
}
.sci_bar {
font: arial,helvetica,sans-serif;
font-size: 10px;
position: fixed;
left: 0;
top: 35px;;
width: 100%;
height: 2px;
background: #ffffff;
border:0px;
background: #[color]#;
padding: 0px 0px 0px 0px;
z-index:99998;
text-align: left;
}
.sci_icon {
font: arial,helvetica,sans-serif;
font-size: 10px;
position: fixed;
left: 10px;
top: 0;
margin-top: 1px;
padding-left: 50px;
background: #ffffff;
border:0px;
width: 250px;
height: 19px;
padding: 9px 5px 5px 5px;
z-index:99998;
color: #5a346e;
text-align: left;
}
.sci_left {
font: arial,helvetica,sans-serif;
font-size: 10px;
position: fixed;
left: 60px;
top: 0;
margin-top: 1px;
padding-left: 50px;
background: #ffffff;
border:0px;
width: 250px;
height: 19px;
padding: 9px 5px 5px 5px;
z-index:99998;
color: #5a346e;
text-align: left;
}
.sci_right {
font: arial,helvetica,sans-serif;
font-size: 10px;
position: fixed;
right: 200px;
top: 0;
background: #ffffff;
border:0px;
width: 200px;
height: 20px;
padding: 5px 5px 5px 5px;
z-index:99998;
color: #[color]#;
text-align: left;
}
.sci_panel {
font: arial,helvetica,sans-serif;
font-size: 10px;
position: fixed;
right: 0;
background: #ffffff;
border:1px solid #[color]#;
width: 210px;
height: auto;
padding: 30px 110px 30px 30px;
z-index:99998;
color: #[color]#;
text-align: left;
}
.sci_panel p{
margin: 0 0 15px 0;
padding: 0;
color: #cccccc;
}
.sci_panel a, .sci_panel a:visited{
margin: 0;
padding: 0;
color: #9FC54E;
text-decoration: none;
border-bottom: 1px solid #9FC54E;
}
.sci_panel a:hover, .sci_panel a:visited:hover{
margin: 0;
padding: 0;
color: #ffffff;
text-decoration: none;
border-bottom: 1px solid #ffffff;
}
</style>
<div id="sci_headerbar" class="sci_headerbar">
<div id="sidebar-bar" class="sci_bar" style="">
</div>
<div id="sidebar-logo" class="sci_icon" style="">
<img src="/currentyacypeer/env/grafics/yacy.png" height="20px" width="36px"/>
</div>
<div id="sidebar-logo" class="sci_left" style="">
<!--#include virtual="/currentyacypeer/interaction_elements/Tag_part.html?action=#[action]#&hash=#[urlhash]#&url=#[url]#" -->
</div>
<div id="sidebar-document" class="sci_right" style="">
<!--#include virtual="/currentyacypeer/interaction_elements/Document_part.html?action=#[action]#&hash=#[urlhash]#&url=#[url]#" -->
</div>
</div>
#(/enabled)#

@ -1,25 +0,0 @@
package interaction_elements;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.server.serverObjects;
import net.yacy.server.serverSwitch;
public class OverlayInteraction {
public static serverObjects respond(@SuppressWarnings("unused") final RequestHeader header, final serverObjects post, final serverSwitch env) {
final serverObjects prop = new serverObjects();
prop.put("enabled", env.getConfigBool("interaction.overlayinteraction.enabled", false) ? "1" : "0");
prop.put("enabled_url", post.get("url", ""));
prop.put("enabled_urlhash", post.get("urlhash", ""));
prop.put("enabled_action", post.get("action", ""));
prop.put("enabled_color", env.getConfig("color_tableheader", ""));
return prop;
}
}

@ -1,111 +0,0 @@
<style type="text/css" >
.sci_tag {
font: arial,helvetica,sans-serif;
font-size: 10px;
background: #ffffff;
border:0px;
width: 65px;
height: 20px;
z-index:99998;
color: #5a346e;
}
</style>
<span id="sci_tags_#[hash]#" class="sci_tag" style="display: none;">
<img id="sci_tags_#[hash]#_img" src="/currentyacypeer/interaction_elements/tag.png" width="16px" height="16px" alt="0" onclick="/* $('#sci_tags_#[hash]#_box').toggle();*/ return false">&nbsp; <span style="font-size: x-small; position: absolute; margin-top: 4px;"><span id="sci_tags_#[hash]#_tags"></span></span>
</span>
<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" />
</div>
<script type="text/javascript" charset="utf-8">
var vocabularies_string = '#[vocabularies]#';
var vocs = vocabularies_string.split (",");
var existingtags = "";
var resultstring = "";
if (vocabularies_string != "") {
$.ajaxSetup({async: false});
$.getJSON('/currentyacypeer/api/yacydoc.json?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+":"+ finaltags;
});
if (existingtags != "") {
document.getElementById('sci_tags_#[hash]#').style.display = "";
document.getElementById('sci_tags_#[hash]#_tags').innerHTML = existingtags;
}
/* document.getElementById('tags_#[hash]#').value = existingtags;
$('#tags_#[hash]#').tagsInput({
'height':'105px',
'width':'270px',
'interactive':true,
'removeWithBackspace' : true,
'minChars' : 0,
'maxChars' : 0,
'placeholderColor' : '#666666',
'onChange' : function () {
storevalue_t ('http://yacy.net/url#[hash]#', 'http://yacy.net/autotagging#manual', document.getElementById('tags_#[hash]#').value);
}
}); */
</script>

@ -1,36 +0,0 @@
package interaction_elements;
import java.util.Collection;
import net.yacy.cora.lod.vocabulary.Tagging;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.document.LibraryProvider;
import net.yacy.server.serverObjects;
import net.yacy.server.serverSwitch;
public class Tag_part {
public static serverObjects respond(@SuppressWarnings("unused") final RequestHeader header, final serverObjects post, @SuppressWarnings("unused") final serverSwitch env) {
final serverObjects prop = new serverObjects();
prop.put("hash", post.get("hash", ""));
prop.put("url", post.get("url", ""));
prop.put("action", post.get("action", ""));
String vocabularies = "";
Collection<Tagging> vocs = LibraryProvider.autotagging.getVocabularies();
for (Tagging v: vocs) {
vocabularies += v.getName()+",";
}
vocabularies += "manual";
prop.put("vocabularies", vocabularies);
return prop;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

@ -1,202 +0,0 @@
function newload (name, div) {
$.ajaxSetup({async: false});
$.get(name, function(data) {
document.getElementById(div).innerHTML = data;
});
}
function xmlToString (xmlData) {
var xmlString;
if (window.ActiveXObject) {
xmlString = xmlData.xml;
}
else {
xmlString = (new XMLSerializer()).serializeToString(xmlData);
}
return xmlString;
}
function rdfload (datastore) {
$.ajax({
type : "GET",
url: "/currentyacypeer/interaction/GetRDF.xml?global=true",
dataType: "xml",
success: function(xml) {
datastore.load(xml);
}
});
}
function feedback (url, comment, from) {
$.getJSON('/currentyacypeer/interaction/Feedback.json?url='+url+'&comment='+comment+'&from='+from, function(data) {
});
}
function suggest (url) {
$.getJSON('/currentyacypeer/interaction/Suggest.json?url='+url, function(data) {
});
}
function contribution (url, comment, username) {
$.getJSON('/currentyacypeer/interaction/Contribution.json?url='+url+'&comment='+comment+'&from='+username, function(data) {
});
}
function triple (url, s, p, o, username) {
$.getJSON('/currentyacypeer/interaction/Triple.json?url='+url+'&s='+s+'&p='+p+'&o='+o+'&from='+username, function(data) {
});
}
function storevalue_t (s, p, o) {
$.getJSON('/currentyacypeer/interaction/Table.json?url='+document.location.href+'&s='+s+'&p='+p+'&o='+o, function(data) {
});
}
function storevalueglobal_t (s, p, o) {
$.getJSON('/currentyacypeer/interaction/Table.json?global=true&url='+s+'&s='+s+'&p='+p+'&o='+o, function(data) {
});
}
function storevalue (s, p, o) {
$.getJSON('/currentyacypeer/interaction/Triple.json?url='+document.location.href+'&s='+s+'&p='+p+'&o='+o, function(data) {
});
}
function storevalueglobal (s, p, o) {
$.getJSON('/currentyacypeer/interaction/Triple.json?global=true&url='+document.location.href+'&s='+s+'&p='+p+'&o='+o, function(data) {
});
}
function loadvalue (s, p) {
var res = {result: ""};
$.ajaxSetup({async: false});
$.getJSON('/currentyacypeer/interaction/Triple.json?s='+s+'&p='+p+'&load=true', function (data) {
res = data;
});
return res.result;
}
function loadvalue_t (s, p) {
var res = {result: ""};
$.ajaxSetup({async: false});
$.getJSON('/currentyacypeer/interaction/Table.json?s='+s+'&p='+p+'&load=true', function (data) {
res = data;
});
return res.result;
}
function loadvalueglobal_t (s, p) {
var res = {result: ""};
$.ajaxSetup({async: false});
$.getJSON('/currentyacypeer/interaction/Table.json?global=true&s='+s+'&p='+p+'&load=true', function (data) {
res = data;
});
return res.result;
}
function loadvalueglobal (s, p) {
var res = {result: ""};
$.ajaxSetup({async: false});
$.getJSON('/currentyacypeer/interaction/Triple.json?global=true&s='+s+'&p='+p+'&load=true', function (data) {
res = data;
});
return res.result;
}
function triple_get_prefix (sp, s, pp, p) {
var res = {result: ""};
$.ajaxSetup({async: false});
$.getJSON('/currentyacypeer/interaction/Triple.json?sep=true&global=true&sp='+sp+'&s='+s+'&pp='+pp+'&p='+p+'&load=true', function (data) {
res = data;
});
return res.result;
}

@ -1,21 +0,0 @@
function getMetadata (url) {
var res = {"item": {"title": "no title"}};
$.ajaxSetup({async: false});
$.getJSON('/currentyacypeer/api/getpageinfo.json?url='+url, function(data) {
res = data;
});
return res;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 145 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 131 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 145 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

@ -1,332 +0,0 @@
// Author: DL
package net.yacy.cora.lod;
import java.io.BufferedOutputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
import net.yacy.cora.document.encoding.UTF8;
import net.yacy.cora.lod.vocabulary.DCTerms;
import net.yacy.cora.lod.vocabulary.Geo;
import net.yacy.cora.lod.vocabulary.HttpHeader;
import net.yacy.cora.lod.vocabulary.Tagging;
import net.yacy.cora.lod.vocabulary.YaCyMetadata;
import net.yacy.cora.util.ConcurrentLog;
import net.yacy.search.Switchboard;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.rdf.model.Property;
import com.hp.hpl.jena.rdf.model.RDFNode;
import com.hp.hpl.jena.rdf.model.ResIterator;
import com.hp.hpl.jena.rdf.model.Resource;
import com.hp.hpl.jena.rdf.model.Selector;
import com.hp.hpl.jena.rdf.model.SimpleSelector;
import com.hp.hpl.jena.rdf.model.StmtIterator;
import com.hp.hpl.jena.util.FileManager;
public class JenaTripleStore {
private final static ConcurrentLog log = new ConcurrentLog(JenaTripleStore.class.getName());
public static Model model = ModelFactory.createDefaultModel();
static {
init(model);
}
private final static void init(Model model) {
model.setNsPrefix(YaCyMetadata.PREFIX, YaCyMetadata.NAMESPACE);
model.setNsPrefix(Tagging.DEFAULT_PREFIX, Tagging.DEFAULT_NAMESPACE);
model.setNsPrefix(HttpHeader.PREFIX, HttpHeader.NAMESPACE);
model.setNsPrefix(Geo.PREFIX, Geo.NAMESPACE);
model.setNsPrefix("pnd", "http://dbpedia.org/ontology/individualisedPnd");
model.setNsPrefix(DCTerms.PREFIX, DCTerms.NAMESPACE);
}
public static long size() {
return model.size();
}
public static ConcurrentHashMap<String, Model> privatestorage = null;
public static void load(String filename) throws IOException {
if (filename.endsWith(".nt")) LoadNTriples(filename);
else loadRDF(filename);
}
private static void loadRDF(String fileNameOrUri) throws IOException {
Model tmp = ModelFactory.createDefaultModel();
log.info("Loading from " + fileNameOrUri);
InputStream is = FileManager.get().open(fileNameOrUri);
if (is != null) {
// read the RDF/XML file
tmp.read(is, null);
log.info("loaded " + tmp.size() + " triples from " + fileNameOrUri);
model = model.union(tmp);
} else {
throw new IOException("cannot read " + fileNameOrUri);
}
}
private static void LoadNTriples(String fileNameOrUri) throws IOException {
log.info("Loading N-Triples from " + fileNameOrUri);
InputStream is = FileManager.get().open(fileNameOrUri);
LoadNTriples(is);
}
public static void LoadNTriples(InputStream is) throws IOException {
Model tmp = ModelFactory.createDefaultModel();
if (is != null) {
tmp.read(is, null, "N-TRIPLE");
log.info("loaded " + tmp.size() + " triples");
model = model.union(tmp);
//model.write(System.out, "TURTLE");
} else {
throw new IOException("cannot read input stream");
}
}
public static void addFile(String rdffile) {
Model tmp = ModelFactory.createDefaultModel();
try {
InputStream in = new ByteArrayInputStream(UTF8.getBytes(rdffile));
// read the RDF/XML file
tmp.read(in, null);
} finally {
model = model.union(tmp);
}
}
private static void saveFile(String filename) {
saveFile(filename, model);
}
private static void saveFile(String filename, Model model) {
File f = new File(filename);
File ftmp = new File(filename + "." + System.currentTimeMillis());
if (model.isEmpty() && !f.exists()) {
// we don't store zero-size models if they did not exist before
log.info("NOT saving triplestore with " + model.size() + " triples to " + filename);
return;
}
log.info("Saving triplestore with " + model.size() + " triples to " + filename);
OutputStream fout;
try {
fout = new BufferedOutputStream(new FileOutputStream(ftmp));
model.write(fout);
fout.close();
// if something went wrong until here, the original file is not overwritten
// since we are happy here, we can remove the old file and replace it with the new one
f.delete();
if (!f.exists()) {
ftmp.renameTo(f);
}
log.info("Saved triplestore with " + model.size() + " triples to " + filename);
} catch (final Exception e) {
log.warn("Saving to " + filename+" failed");
}
}
/**
* clear the triplestore
*/
public static void clear() {
model = ModelFactory.createDefaultModel();
init(model);
}
/**
* Return a Resource instance with the given URI in this model.
* @param uri
* @return
*/
private static Resource getResource(String uri) {
return model.getResource(uri);
}
public static void deleteObjects(String subject, String predicate) {
Resource r = subject == null ? null : getResource(subject);
Property pr = model.getProperty(predicate);
JenaTripleStore.model.removeAll(r, pr, (Resource) null);
}
public static void addTriple(String subject, String predicate, String object, String username) {
if (privatestorage != null && privatestorage.containsKey(username)) {
addTriple (subject, predicate, object, privatestorage.get(username));
}
}
public static void addTriple(String subject, String predicate, String object) {
addTriple (subject, predicate, object, model);
}
private static void addTriple(String subject, String predicate, String object, Model model) {
Resource r = model.getResource(subject);
Property pr = model.getProperty(predicate);
r.addProperty(pr, object);
log.info("ADD " + subject + " - " + predicate + " - " + object);
}
public static String getObject(final String subject, final String predicate) {
Iterator<RDFNode> ni = JenaTripleStore.getObjects(subject, predicate);
String object = "";
if (ni.hasNext()) object = ni.next().toString();
log.info("GET " + subject + " - " + predicate + " - " + object);
return object;
}
public static Iterator<RDFNode> getObjects(final String subject, final String predicate) {
final Resource r = subject == null ? null : JenaTripleStore.getResource(subject);
return getObjects(r, predicate);
}
public static String getPrivateObject(final String subject, final String predicate, final String username) {
Iterator<RDFNode> ni = JenaTripleStore.getPrivateObjects(subject, predicate, username);
String object = "";
if (ni.hasNext()) object = ni.next().toString();
log.info("GET (" + username + ") " + subject + " - " + predicate + " - " + object);
return object;
}
private static Iterator<RDFNode> getPrivateObjects(final String subject, final String predicate, final String username) {
if (privatestorage != null && privatestorage.containsKey(username)) {
return getObjects(privatestorage.get(username).getResource(subject), predicate, privatestorage.get(username));
}
return null;
}
private static Iterator<RDFNode> getObjects(final Resource r, final String predicate) {
return getObjects(r, predicate, model);
}
private static Iterator<RDFNode> getObjects(final Resource r, final String predicate, final Model model) {
final Property pr = model.getProperty(predicate);
final StmtIterator iter = model.listStatements(r, pr, (Resource) null);
return new Iterator<RDFNode>() {
@Override
public boolean hasNext() {
return iter.hasNext();
}
@Override
public RDFNode next() {
return iter.nextStatement().getObject();
}
@Override
public void remove() {
iter.remove();
}
};
}
public static Iterator<Resource> getSubjects(final String predicate) {
return getSubjects(predicate, model);
}
private static Iterator<Resource> getSubjects(final String predicate, final Model model) {
final Property pr = model.getProperty(predicate);
final ResIterator iter = model.listSubjectsWithProperty(pr);
return new Iterator<Resource>() {
@Override
public boolean hasNext() {
return iter.hasNext();
}
@Override
public Resource next() {
return iter.nextResource();
}
@Override
public void remove() {
iter.remove();
}
};
}
public static Model getSubmodelBySubject(String subject) {
Selector q = new SimpleSelector(model.getResource(subject), (Property) null, (RDFNode) null);
final Model m = model.query(q);
m.setNsPrefix(Tagging.DEFAULT_PREFIX, Tagging.DEFAULT_NAMESPACE);
m.setNsPrefix(DCTerms.PREFIX, DCTerms.NAMESPACE);
return m;
}
public static String getRDFByModel(Model model) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
model.write(baos, "RDF/XML-ABBREV");
return UTF8.String(baos.toByteArray());
}
public static void initPrivateStores() {
Switchboard switchboard = Switchboard.getSwitchboard();
log.info("Init private stores");
if (privatestorage == null) privatestorage = new ConcurrentHashMap<String, Model>();
if (privatestorage != null) privatestorage.clear();
try {
Iterator<net.yacy.data.UserDB.Entry> it = switchboard.userDB.iterator(true);
while (it.hasNext()) {
net.yacy.data.UserDB.Entry e = it.next();
String username = e.getUserName();
File triplestore = new File(switchboard.getConfig("triplestore", new File(switchboard.getDataPath(), "DATA/TRIPLESTORE").getAbsolutePath()));
File currentuserfile = new File(triplestore, "private_store_"+username+".rdf");
log.info("Init " + username + " from "+currentuserfile.getAbsolutePath());
Model tmp = ModelFactory.createDefaultModel();
init (tmp);
if (currentuserfile.exists()) {
log.info("Loading from " + currentuserfile.getAbsolutePath());
InputStream is = FileManager.get().open(currentuserfile.getAbsolutePath());
if (is != null) {
// read the RDF/XML file
tmp.read(is, null);
log.info("loaded " + tmp.size() + " triples from " + currentuserfile.getAbsolutePath());
} else {
throw new IOException("cannot read " + currentuserfile.getAbsolutePath());
}
}
if (tmp != null) {
privatestorage.put(username, tmp);
}
}
} catch (final Exception anyex) {
log.warn(anyex);
}
}
private static void savePrivateStores() {
Switchboard switchboard = Switchboard.getSwitchboard();
log.info("Saving user triplestores");
if (privatestorage == null) return;
for (Entry<String, Model> s : privatestorage.entrySet()) {
File triplestore = new File(switchboard.getConfig("triplestore", new File(switchboard.getDataPath(), "DATA/TRIPLESTORE").getAbsolutePath()));
File currentuserfile = new File(triplestore, "private_store_"+s.getKey()+".rdf");
saveFile (currentuserfile.getAbsolutePath(), s.getValue());
}
}
private static long lastModelSizeStored = -1;
public static void saveAll() {
Switchboard sb = Switchboard.getSwitchboard();
File triplestore = new File(sb.getConfig("triplestore", new File(sb.dataPath, "DATA/TRIPLESTORE").getAbsolutePath()));
if (model.size() != lastModelSizeStored){
JenaTripleStore.saveFile(new File(triplestore, "local.rdf").getAbsolutePath());
lastModelSizeStored = model.size();
}
JenaTripleStore.savePrivateStores();
}
}

@ -1,161 +0,0 @@
package net.yacy.data.ymark;
import java.io.ByteArrayOutputStream;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import net.yacy.cora.document.encoding.UTF8;
import net.yacy.cora.lod.vocabulary.AnnoteaA;
import net.yacy.cora.lod.vocabulary.AnnoteaB;
import net.yacy.cora.lod.vocabulary.DCElements;
import net.yacy.cora.lod.vocabulary.Rdf;
import net.yacy.kelondro.blob.Tables;
import com.hp.hpl.jena.rdf.model.Bag;
import com.hp.hpl.jena.rdf.model.Model;
import com.hp.hpl.jena.rdf.model.ModelFactory;
import com.hp.hpl.jena.rdf.model.Property;
import com.hp.hpl.jena.rdf.model.Resource;
public class YMarkRDF {
public final Model model;
public final static String USER = "USER";
public final static String TYPE = "TYPE";
public final static String SUBTOPIC = "SUBTOPIC";
private final Map<String, Property> property;
public final static String BOOKMARK = "/YMarks.rdf?id=";
private final StringBuilder resourceURI;
private final int len;
public YMarkRDF(final String peerURI) {
this.model = ModelFactory.createDefaultModel();
this.property = new HashMap<String, Property>();
this.len = peerURI.length()+BOOKMARK.length();
this.resourceURI = new StringBuilder(len+20);
this.resourceURI.append(peerURI);
this.resourceURI.append(BOOKMARK);
model.setNsPrefix(Rdf.PREFIX, Rdf.IDENTIFIER);
model.setNsPrefix(DCElements.PREFIX, DCElements.IDENTIFIER);
model.setNsPrefix(AnnoteaA.PREFIX, AnnoteaA.NAMESPACE);
model.setNsPrefix(AnnoteaB.PREFIX, AnnoteaB.NAMESPACE);
this.property.put(YMarkEntry.BOOKMARK.URL.key(), this.model.createProperty(AnnoteaB.recalls.getNamespace(), AnnoteaB.recalls.name()));
this.property.put(YMarkEntry.BOOKMARK.FOLDERS.key(), this.model.createProperty(AnnoteaB.hasTopic.getNamespace(), AnnoteaB.hasTopic.name()));
this.property.put(YMarkEntry.BOOKMARK.TITLE.key(), this.model.createProperty(DCElements.title.getNamespace(), DCElements.title.name()));
this.property.put(YMarkEntry.BOOKMARK.DESC.key(), this.model.createProperty(DCElements.description.getNamespace(), DCElements.description.name()));
this.property.put(YMarkEntry.BOOKMARK.DATE_ADDED.key(), this.model.createProperty(AnnoteaA.created.getNamespace(), AnnoteaA.created.name()));
this.property.put(YMarkEntry.BOOKMARK.DATE_MODIFIED.key(), this.model.createProperty(DCElements.date.getNamespace(), DCElements.date.name()));
this.property.put(YMarkEntry.BOOKMARK.TAGS.key(), this.model.createProperty(DCElements.subject.getNamespace(), DCElements.subject.name()));
this.property.put(USER, this.model.createProperty(DCElements.creator.getNamespace(), DCElements.creator.name()));
this.property.put(TYPE, this.model.createProperty(Rdf.type.getNamespace(), Rdf.type.name()));
this.property.put(SUBTOPIC, this.model.createProperty(AnnoteaB.subTopicOf.getNamespace(), AnnoteaB.subTopicOf.name()));
}
/**
* @param format {RDF/XML, RDF/XML-ABBREV, N-TRIPLE, N3, N3-PP, N3-PLAIN, N3-TRIPLE, TURTLE}
* @return RDF
*/
public String getRDF(final String format) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
this.model.write(baos, format);
try {
return baos.toString("UTF-8");
} catch (final UnsupportedEncodingException e) {
return new String();
}
}
public void addTopic(final String bmk_user, final String folder) {
this.resourceURI.append(bmk_user);
this.resourceURI.append(":f:");
this.resourceURI.append(UTF8.String(YMarkUtil.getKeyId(folder)));
final Resource topic = this.model.createResource(this.resourceURI.toString());
this.resourceURI.setLength(this.len);
topic.addProperty(this.property.get(YMarkEntry.BOOKMARK.DATE_MODIFIED.key()), YMarkUtil.EMPTY_STRING);
topic.addProperty(this.property.get(YMarkEntry.BOOKMARK.DATE_ADDED.key()), YMarkUtil.EMPTY_STRING);
topic.addProperty(this.property.get(USER), bmk_user);
topic.addProperty(this.property.get(YMarkEntry.BOOKMARK.DESC.key()), YMarkUtil.EMPTY_STRING);
final int i = folder.lastIndexOf(YMarkUtil.FOLDERS_SEPARATOR);
if(i>0)
topic.addProperty(this.property.get(SUBTOPIC), folder.substring(0, i));
topic.addProperty(this.property.get(YMarkEntry.BOOKMARK.TITLE.key()), folder);
topic.addProperty(this.property.get(TYPE), AnnoteaB.Topic.getPredicate());
}
public void addBookmark (final String bmk_user, final Tables.Row bmk_row) {
if(bmk_row == null || bmk_row.get(YMarkEntry.BOOKMARK.PUBLIC.key(), YMarkEntry.BOOKMARK.PUBLIC.deflt()).equals("false"))
return;
// create an annotea bookmark resource
this.resourceURI.append(bmk_user);
this.resourceURI.append(":b:");
this.resourceURI.append(UTF8.String(bmk_row.getPK()));
final Resource bmk = this.model.createResource(this.resourceURI.toString());
this.resourceURI.setLength(this.len);
// add properties
bmk.addProperty(this.property.get(USER), bmk_user);
for (final YMarkEntry.BOOKMARK b : YMarkEntry.BOOKMARK.values()) {
switch(b) {
case FOLDERS:
final String[] folders = bmk_row.get(b.key(), b.deflt()).split(b.seperator());
if(folders.length > 1) {
Bag topics = this.model.createBag();
for(String folder : folders) {
topics.add(folder);
this.addTopic(bmk_user, folder);
}
bmk.addProperty(this.property.get(b.key()), topics);
} else {
bmk.addProperty(this.property.get(b.key()), folders[0]);
this.addTopic(bmk_user, folders[0]);
}
break;
case TAGS:
final String[] tags = bmk_row.get(b.key(), b.deflt()).split(b.seperator());
if(tags.length > 1) {
Bag subjects = this.model.createBag();
for(String tag : tags) {
subjects.add(tag);
}
bmk.addProperty(this.property.get(b.key()), subjects);
} else {
bmk.addProperty(this.property.get(b.key()), tags[0]);
}
break;
case DATE_ADDED:
case DATE_MODIFIED:
final YMarkDate date = new YMarkDate(bmk_row.get(b.key()));
bmk.addProperty(this.property.get(b.key()), date.toISO8601());
break;
// these cases are inserted for better readable RDF output
case DESC:
case URL:
case TITLE:
bmk.addProperty(this.property.get(b.key()), bmk_row.get(b.key(), b.deflt()));
break;
default:
if(this.property.containsKey(b.key())) {
bmk.addProperty(this.property.get(b.key()), bmk_row.get(b.key(), b.deflt()));
}
}
}
bmk.addProperty(this.property.get(TYPE), AnnoteaB.Bookmark.getPredicate());
}
public void addBookmarks(final String bmk_user, final Iterator<Tables.Row> riter) {
while(riter.hasNext()) {
this.addBookmark(bmk_user, riter.next());
}
}
}

@ -32,11 +32,8 @@ import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.MalformedURLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;
import java.util.zip.ZipException;
@ -49,16 +46,10 @@ import net.yacy.cora.geo.OpenGeoDBLocation;
import net.yacy.cora.geo.OverarchingLocation;
import net.yacy.cora.language.synonyms.AutotaggingLibrary;
import net.yacy.cora.language.synonyms.SynonymLibrary;
import net.yacy.cora.lod.JenaTripleStore;
import net.yacy.cora.lod.vocabulary.Tagging;
import net.yacy.cora.lod.vocabulary.Tagging.SOTuple;
import net.yacy.cora.storage.Files;
import net.yacy.cora.util.ConcurrentLog;
import net.yacy.crawler.retrieval.URLRewriterLibrary;
import net.yacy.kelondro.util.FileUtils;
import com.hp.hpl.jena.rdf.model.Resource;
public class LibraryProvider {
public static final String path_to_source_dictionaries = "source";
@ -132,7 +123,6 @@ public class LibraryProvider {
integrateGeonames0(-1);
integrateGeonames1(-1);
integrateGeonames2(100000);
activatePND();
Set<String> allTags = new HashSet<String>() ;
allTags.addAll(autotagging.allTags()); // we must copy this into a clone to prevent circularity
autotagging.addPlaces(geoLoc);
@ -232,60 +222,6 @@ public class LibraryProvider {
FileUtils.deletedelete(derewoOutput);
}
public static void activatePND() {
// translate input files (once..)
final File dymDict = new File(dictRoot, path_to_did_you_mean_dictionaries);
if ( !dymDict.exists() ) {
dymDict.mkdirs();
}
// read the pnd file and store it into the triplestore
final File dictInput = LibraryProvider.Dictionary.PND0.file();
if ( dictInput.exists() ) {
try {
JenaTripleStore.LoadNTriples(Files.read(dictInput));
} catch (final IOException e ) {
ConcurrentLog.logException(e);
}
}
// read the triplestore and generate a vocabulary
Map<String, SOTuple> map = new HashMap<String, SOTuple>();
ConcurrentLog.info("LibraryProvider", "retrieving PND data from triplestore");
Iterator<Resource> i = JenaTripleStore.getSubjects("http://dbpedia.org/ontology/individualisedPnd");
ConcurrentLog.info("LibraryProvider", "creating vocabulary map from PND triplestore");
String objectspace = "";
while (i.hasNext()) {
Resource resource = i.next();
String subject = resource.toString();
// prepare a proper term from the subject uri
int p = subject.lastIndexOf('/');
if (p < 0) continue;
String term = subject.substring(p + 1);
objectspace = subject.substring(0, p + 1);
p = term.indexOf('(');
if (p >= 0) term = term.substring(0, p);
term = term.replaceAll("_", " ").trim();
if (term.isEmpty()) continue;
if (term.indexOf(' ') < 0) continue; // accept only names that have at least two parts
// store the term into the vocabulary map
map.put(term, new SOTuple(Tagging.normalizeTerm(term), subject));
}
if (!map.isEmpty()) try {
ConcurrentLog.info("LibraryProvider", "adding vocabulary to autotagging");
Tagging pndVoc = new Tagging("Persons", null, objectspace, map);
autotagging.addVocabulary(pndVoc);
ConcurrentLog.info("LibraryProvider", "added pnd vocabulary to autotagging");
} catch (final IOException e) {
}
}
public static void deactivatePND() {
// remove the PND Triples from the triplestore
JenaTripleStore.deleteObjects(null, "http://dbpedia.org/ontology/individualisedPnd");
autotagging.deleteVocabulary("Persons");
}
/*
private static ArrayList<String> loadList(final File file, String comment, boolean toLowerCase) {
final ArrayList<String> list = new ArrayList<String>();

@ -104,7 +104,6 @@ import net.yacy.cora.federate.solr.Ranking;
import net.yacy.cora.federate.solr.SchemaConfiguration;
import net.yacy.cora.federate.solr.instance.RemoteInstance;
import net.yacy.cora.federate.yacy.CacheStrategy;
import net.yacy.cora.lod.JenaTripleStore;
import net.yacy.cora.order.Base64Order;
import net.yacy.cora.order.Digest;
import net.yacy.cora.order.NaturalOrder;
@ -734,9 +733,6 @@ public final class Switchboard extends serverSwitch {
ConcurrentLog.logException(e);
}
// init user triplestores
JenaTripleStore.initPrivateStores();
// init html parser evaluation scheme
File parserPropertiesPath = new File("defaults/");
String[] settingsList = parserPropertiesPath.list();
@ -2300,11 +2296,6 @@ public final class Switchboard extends serverSwitch {
this.tables.cleanFailURLS(getConfigLong("cleanup.failedSearchURLtimeout", -1));
}
// periodically store the triple store
if (getConfigBool("triplestore.persistent", false)) {
JenaTripleStore.saveAll();
}
// clean up profiles
checkInterruption();

@ -322,13 +322,10 @@ public final class SwitchboardConstants {
public static final String FEDERATED_SERVICE_SOLR_INDEXING_TIMEOUT = "federated.service.solr.indexing.timeout";
public static final String FEDERATED_SERVICE_SOLR_INDEXING_WRITEENABLED = "federated.service.solr.indexing.writeEnabled";
//public static final String CORE_SERVICE_URLDB = "core.service.urldb.tmp";
//public static final String CORE_SERVICE_SOLR = "core.service.solr.tmp";
public static final String CORE_SERVICE_FULLTEXT = "core.service.fulltext";
public static final String CORE_SERVICE_RWI = "core.service.rwi.tmp";
public static final String CORE_SERVICE_CITATION = "core.service.citation.tmp";
public static final String CORE_SERVICE_WEBGRAPH = "core.service.webgraph.tmp";
public static final String CORE_SERVICE_JENA = "core.service.jena.tmp";
/**
* <p><code>public static final String <strong>CRAWLER_THREADS_ACTIVE_MAX</strong> = "crawler.MaxActiveThreads"</code></p>

@ -42,7 +42,6 @@ import java.util.concurrent.Semaphore;
import java.util.concurrent.ExecutionException;
import net.yacy.cora.date.GenericFormatter;
import net.yacy.cora.lod.JenaTripleStore;
import net.yacy.cora.protocol.ClientIdentification;
import net.yacy.cora.protocol.RequestHeader;
import net.yacy.cora.protocol.TimeoutRequest;
@ -286,29 +285,6 @@ public final class yacy {
// set user-agent
HTTPClient.setDefaultUserAgent(ClientIdentification.yacyInternetCrawlerAgent.userAgent);
// initial fill of the triplestore
File triplestore = new File(sb.getConfig("triplestore", new File(dataHome, "DATA/TRIPLESTORE").getAbsolutePath()));
mkdirIfNeseccary(triplestore);
for (String s: triplestore.list()) {
if ((s.endsWith(".rdf") || s.endsWith(".nt")) && !s.equals("local.rdf") && !s.endsWith("_triplestore.rdf") && !s.startsWith("private_store_")) {
try {
JenaTripleStore.load(new File(triplestore, s).getAbsolutePath());
} catch (final IOException e) {
ConcurrentLog.logException(e);
}
}
}
if (sb.getConfigBool("triplestore.persistent", false)) {
File local = new File(triplestore, "local.rdf");
if (local.exists()) {
try {
JenaTripleStore.load(local.getAbsolutePath());
} catch (final IOException e) {
ConcurrentLog.logException(e);
}
}
}
// start main threads
final int port = sb.getConfigInt("port", 8090);
try {
@ -400,11 +376,6 @@ public final class yacy {
} finally {
}
// save the triple store
if (sb.getConfigBool("triplestore.persistent", false)) {
JenaTripleStore.saveAll();
}
ConcurrentLog.config("SHUTDOWN", "goodbye. (this is the last line)");
ConcurrentLog.shutdown();
shutdownSemaphore.release(1000);

Loading…
Cancel
Save