diff --git a/defaults/yacy.init b/defaults/yacy.init index e8f2b78c5..d94671b43 100644 --- a/defaults/yacy.init +++ b/defaults/yacy.init @@ -691,7 +691,7 @@ crawlPause.localsearch=50 crawlPause.remotesearch=10 # Some configuration values for the crawler -crawler.clientTimeout=9000 +crawler.clientTimeout=30000 # http crawler specific settings; size in bytes crawler.http.accept=text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 diff --git a/htroot/DemoServlet.java b/htroot/DemoServlet.java index 98d6ce3e3..42cc2b491 100644 --- a/htroot/DemoServlet.java +++ b/htroot/DemoServlet.java @@ -1,11 +1,6 @@ -import java.util.Iterator; - import net.yacy.yacy; import net.yacy.cora.protocol.RequestHeader; import net.yacy.interaction.Interaction; -import net.yacy.search.Switchboard; -import de.anomic.data.BookmarkHelper; -import de.anomic.data.UserDB; import de.anomic.server.serverObjects; import de.anomic.server.serverSwitch; @@ -13,17 +8,15 @@ public final class DemoServlet { public static serverObjects respond(final RequestHeader header, final serverObjects post, final serverSwitch env) { - + // return variable that accumulates replacements final serverObjects prop = new serverObjects(); - - final Switchboard sb = Switchboard.getSwitchboard(); - + prop.put("temperature", "-10°C"); - + // Display currently logged on user prop.put("username", Interaction.GetLoggedOnUser(header)); - + //Generate Userlist int numUsers = 0; for (String user : Interaction.GetUsers()) { @@ -31,36 +24,36 @@ public final class DemoServlet { numUsers++; } prop.put("users", numUsers); - - - + + + if (post != null) { - + if (post.containsKey("submit")) { - + prop.put("temperature", post.get("textthing")); - + String filename= post.get("textthing"); - + int counter = 0; - + while (counter < 10) { - + prop.put("localimg_"+counter+"_path","/"+filename); - + prop.put("localimg_"+counter+"_checked", "2"); counter++; } - + prop.put("localimg", counter); - - - + + + prop.put("temperature", yacy.homedir+"/DATA/HTDOCS/"+filename); } - + } - + // return rewrite properties return prop; } diff --git a/htroot/DemoServletInteraction.java b/htroot/DemoServletInteraction.java index 2e974e421..f8d34a4b0 100644 --- a/htroot/DemoServletInteraction.java +++ b/htroot/DemoServletInteraction.java @@ -1,5 +1,4 @@ import net.yacy.cora.protocol.RequestHeader; -import de.anomic.data.BookmarkHelper; import de.anomic.server.serverObjects; import de.anomic.server.serverSwitch; @@ -9,9 +8,9 @@ public final class DemoServletInteraction { final serverObjects post, final serverSwitch env) { // return variable that accumulates replacements final serverObjects prop = new serverObjects(); - + prop.put("temperature", "-10°C"); - + // return rewrite properties return prop; } diff --git a/htroot/DemoServletRDF.java b/htroot/DemoServletRDF.java index 593d6bcbe..25d2143d1 100644 --- a/htroot/DemoServletRDF.java +++ b/htroot/DemoServletRDF.java @@ -1,6 +1,4 @@ -import net.yacy.yacy; import net.yacy.cora.protocol.RequestHeader; -import de.anomic.data.BookmarkHelper; import de.anomic.server.serverObjects; import de.anomic.server.serverSwitch; @@ -10,37 +8,37 @@ public final class DemoServletRDF { final serverObjects post, final serverSwitch env) { // return variable that accumulates replacements final serverObjects prop = new serverObjects(); - + // prop.put("temperature", "-10°C"); - + if (post != null) { - + if (post.containsKey("submit")) { prop.put("temperature", post.get("textthing")); - + String filename= post.get("textthing"); - + // prop.put("imglink", filename+".jpg"); - + int counter = 0; - + while (counter < 10) { - + prop.put("localimg_"+counter+"_path","/"+filename); - + prop.put("localimg_"+counter+"_checked", "2"); counter++; } - + prop.put("localimg", counter); - - - + + + // prop.put("temperature",yacy.homedir+"/DATA/HTDOCS/"+filename); } - + } - + // return rewrite properties return prop; } diff --git a/htroot/DictionaryLoader_p.html b/htroot/DictionaryLoader_p.html index fd48f6c6a..8d3d0fdfe 100644 --- a/htroot/DictionaryLoader_p.html +++ b/htroot/DictionaryLoader_p.html @@ -65,9 +65,11 @@ Geolocalization will enable YaCy to present locations from OpenStreetMap according to given search words.
With this file it is possible to find cities with a population > 1000 all over the world.
+With this file it is possible to find cities all over the world.
With this file it is possible to find locations in Germany using the location (city) name, a zip code, a car sign or a telephone pre-dial number.
diff --git a/htroot/DictionaryLoader_p.java b/htroot/DictionaryLoader_p.java index 32e60d18c..70ba014ee 100644 --- a/htroot/DictionaryLoader_p.java +++ b/htroot/DictionaryLoader_p.java @@ -24,8 +24,8 @@ import java.net.MalformedURLException; import net.yacy.cora.protocol.RequestHeader; import net.yacy.cora.services.federated.yacy.CacheStrategy; import net.yacy.document.LibraryProvider; -import net.yacy.document.geolocalization.GeonamesLocation; -import net.yacy.document.geolocalization.OpenGeoDBLocation; +import net.yacy.document.geolocation.GeonamesLocation; +import net.yacy.document.geolocation.OpenGeoDBLocation; import net.yacy.kelondro.data.meta.DigestURI; import net.yacy.kelondro.logging.Log; import net.yacy.kelondro.util.FileUtils; @@ -68,7 +68,7 @@ public class DictionaryLoader_p { final Response response = sb.loader.load(sb.loader.request(new DigestURI(LibraryProvider.Dictionary.GEON0.url), false, true), CacheStrategy.NOCACHE, Integer.MAX_VALUE, false); final byte[] b = response.getContent(); FileUtils.copy(b, LibraryProvider.Dictionary.GEON0.file()); - LibraryProvider.geoLoc.activateLocalization(LibraryProvider.Dictionary.GEON0.nickname, new GeonamesLocation(LibraryProvider.Dictionary.GEON0.file())); + LibraryProvider.geoLoc.activateLocation(LibraryProvider.Dictionary.GEON0.nickname, new GeonamesLocation(LibraryProvider.Dictionary.GEON0.file(), null, -1)); LibraryProvider.autotagging.addPlaces(LibraryProvider.geoLoc); prop.put("geon0Status", LibraryProvider.Dictionary.GEON0.file().exists() ? 1 : 0); prop.put("geon0ActionLoaded", 1); @@ -98,11 +98,95 @@ public class DictionaryLoader_p { if (post.containsKey("geon0Activate")) { LibraryProvider.Dictionary.GEON0.fileDisabled().renameTo(LibraryProvider.Dictionary.GEON0.file()); - LibraryProvider.geoLoc.activateLocalization(LibraryProvider.Dictionary.GEON0.nickname, new GeonamesLocation(LibraryProvider.Dictionary.GEON0.file())); + LibraryProvider.geoLoc.activateLocation(LibraryProvider.Dictionary.GEON0.nickname, new GeonamesLocation(LibraryProvider.Dictionary.GEON0.file(), null, -1)); LibraryProvider.autotagging.addPlaces(LibraryProvider.geoLoc); prop.put("geon0ActionActivated", 1); } + // GEON1 + if (post.containsKey("geon1Load")) { + // load from the net + try { + final Response response = sb.loader.load(sb.loader.request(new DigestURI(LibraryProvider.Dictionary.GEON1.url), false, true), CacheStrategy.NOCACHE, Integer.MAX_VALUE, false); + final byte[] b = response.getContent(); + FileUtils.copy(b, LibraryProvider.Dictionary.GEON1.file()); + LibraryProvider.geoLoc.activateLocation(LibraryProvider.Dictionary.GEON1.nickname, new GeonamesLocation(LibraryProvider.Dictionary.GEON1.file(), null, -1)); + LibraryProvider.autotagging.addPlaces(LibraryProvider.geoLoc); + prop.put("geon1Status", LibraryProvider.Dictionary.GEON1.file().exists() ? 1 : 0); + prop.put("geon1ActionLoaded", 1); + } catch (final MalformedURLException e) { + Log.logException(e); + prop.put("geon1ActionLoaded", 2); + prop.put("geon1ActionLoaded_error", e.getMessage()); + } catch (final IOException e) { + Log.logException(e); + prop.put("geon1ActionLoaded", 2); + prop.put("geon1ActionLoaded_error", e.getMessage()); + } + } + + if (post.containsKey("geon1Remove")) { + FileUtils.deletedelete(LibraryProvider.Dictionary.GEON1.file()); + FileUtils.deletedelete(LibraryProvider.Dictionary.GEON1.fileDisabled()); + LibraryProvider.geoLoc.deactivateLocalization(LibraryProvider.Dictionary.GEON1.nickname); + prop.put("geon1ActionRemoved", 1); + } + + if (post.containsKey("geon1Deactivate")) { + LibraryProvider.Dictionary.GEON1.file().renameTo(LibraryProvider.Dictionary.GEON1.fileDisabled()); + LibraryProvider.geoLoc.deactivateLocalization(LibraryProvider.Dictionary.GEON1.nickname); + prop.put("geon1ActionDeactivated", 1); + } + + if (post.containsKey("geon1Activate")) { + LibraryProvider.Dictionary.GEON1.fileDisabled().renameTo(LibraryProvider.Dictionary.GEON1.file()); + LibraryProvider.geoLoc.activateLocation(LibraryProvider.Dictionary.GEON1.nickname, new GeonamesLocation(LibraryProvider.Dictionary.GEON1.file(), null, -1)); + LibraryProvider.autotagging.addPlaces(LibraryProvider.geoLoc); + prop.put("geon1ActionActivated", 1); + } + + // GEON2 + if (post.containsKey("geon2Load")) { + // load from the net + try { + final Response response = sb.loader.load(sb.loader.request(new DigestURI(LibraryProvider.Dictionary.GEON2.url), false, true), CacheStrategy.NOCACHE, Integer.MAX_VALUE, false); + final byte[] b = response.getContent(); + FileUtils.copy(b, LibraryProvider.Dictionary.GEON2.file()); + LibraryProvider.geoLoc.activateLocation(LibraryProvider.Dictionary.GEON2.nickname, new GeonamesLocation(LibraryProvider.Dictionary.GEON2.file(), null, 100000)); + LibraryProvider.autotagging.addPlaces(LibraryProvider.geoLoc); + prop.put("geon2Status", LibraryProvider.Dictionary.GEON2.file().exists() ? 1 : 0); + prop.put("geon2ActionLoaded", 1); + } catch (final MalformedURLException e) { + Log.logException(e); + prop.put("geon2ActionLoaded", 2); + prop.put("geon2ActionLoaded_error", e.getMessage()); + } catch (final IOException e) { + Log.logException(e); + prop.put("geon2ActionLoaded", 2); + prop.put("geon2ActionLoaded_error", e.getMessage()); + } + } + + if (post.containsKey("geon2Remove")) { + FileUtils.deletedelete(LibraryProvider.Dictionary.GEON2.file()); + FileUtils.deletedelete(LibraryProvider.Dictionary.GEON2.fileDisabled()); + LibraryProvider.geoLoc.deactivateLocalization(LibraryProvider.Dictionary.GEON2.nickname); + prop.put("geon2ActionRemoved", 1); + } + + if (post.containsKey("geon2Deactivate")) { + LibraryProvider.Dictionary.GEON2.file().renameTo(LibraryProvider.Dictionary.GEON2.fileDisabled()); + LibraryProvider.geoLoc.deactivateLocalization(LibraryProvider.Dictionary.GEON2.nickname); + prop.put("geon2ActionDeactivated", 1); + } + + if (post.containsKey("geon2Activate")) { + LibraryProvider.Dictionary.GEON2.fileDisabled().renameTo(LibraryProvider.Dictionary.GEON2.file()); + LibraryProvider.geoLoc.activateLocation(LibraryProvider.Dictionary.GEON2.nickname, new GeonamesLocation(LibraryProvider.Dictionary.GEON2.file(), null, 100000)); + LibraryProvider.autotagging.addPlaces(LibraryProvider.geoLoc); + prop.put("geon2ActionActivated", 1); + } + // GEO1 if (post.containsKey("geo1Load")) { // load from the net @@ -110,8 +194,8 @@ public class DictionaryLoader_p { final Response response = sb.loader.load(sb.loader.request(new DigestURI(LibraryProvider.Dictionary.GEODB1.url), false, true), CacheStrategy.NOCACHE, Integer.MAX_VALUE, false); final byte[] b = response.getContent(); FileUtils.copy(b, LibraryProvider.Dictionary.GEODB1.file()); - LibraryProvider.geoLoc.deactivateLocalization(LibraryProvider.Dictionary.GEODB0.nickname); - LibraryProvider.geoLoc.activateLocalization(LibraryProvider.Dictionary.GEODB1.nickname, new OpenGeoDBLocation(LibraryProvider.Dictionary.GEODB1.file(), false)); + LibraryProvider.geoLoc.deactivateLocalization(LibraryProvider.Dictionary.GEODB1.nickname); + LibraryProvider.geoLoc.activateLocation(LibraryProvider.Dictionary.GEODB1.nickname, new OpenGeoDBLocation(LibraryProvider.Dictionary.GEODB1.file(), null)); LibraryProvider.autotagging.addPlaces(LibraryProvider.geoLoc); prop.put("geo1Status", LibraryProvider.Dictionary.GEODB1.file().exists() ? 1 : 0); prop.put("geo1ActionLoaded", 1); @@ -141,7 +225,7 @@ public class DictionaryLoader_p { if (post.containsKey("geo1Activate")) { LibraryProvider.Dictionary.GEODB1.fileDisabled().renameTo(LibraryProvider.Dictionary.GEODB1.file()); - LibraryProvider.geoLoc.activateLocalization(LibraryProvider.Dictionary.GEODB1.nickname, new OpenGeoDBLocation(LibraryProvider.Dictionary.GEODB1.file(), false)); + LibraryProvider.geoLoc.activateLocation(LibraryProvider.Dictionary.GEODB1.nickname, new OpenGeoDBLocation(LibraryProvider.Dictionary.GEODB1.file(), null)); LibraryProvider.autotagging.addPlaces(LibraryProvider.geoLoc); prop.put("geo1ActionActivated", 1); } @@ -229,7 +313,7 @@ public class DictionaryLoader_p { LibraryProvider.activatePND(); prop.put("pnd0ActionActivated", 1); } - + // check status again for (final LibraryProvider.Dictionary dictionary: LibraryProvider.Dictionary.values()) { prop.put(dictionary.nickname + "Status", dictionary.file().exists() ? 1 : dictionary.fileDisabled().exists() ? 2 : 0); diff --git a/htroot/ViewFile.java b/htroot/ViewFile.java index a23746628..d9e26ea91 100644 --- a/htroot/ViewFile.java +++ b/htroot/ViewFile.java @@ -40,6 +40,7 @@ import net.yacy.cora.document.ASCII; import net.yacy.cora.document.MultiProtocolURI; import net.yacy.cora.document.UTF8; import net.yacy.cora.lod.JenaTripleStore; +import net.yacy.cora.lod.vocabulary.YaCyMetadata; import net.yacy.cora.protocol.RequestHeader; import net.yacy.cora.services.federated.yacy.CacheStrategy; import net.yacy.document.Condenser; @@ -54,6 +55,9 @@ import net.yacy.kelondro.data.meta.URIMetadataRow; import net.yacy.search.Switchboard; import net.yacy.search.index.Segment; import net.yacy.search.index.Segments; + +import com.hp.hpl.jena.rdf.model.Model; + import de.anomic.crawler.Cache; import de.anomic.crawler.retrieval.Response; import de.anomic.server.serverObjects; @@ -344,7 +348,8 @@ public class ViewFile { prop.putNum("error_size", size); prop.put("error_mimeTypeAvailable", (response.getMimeType() == null) ? "0" : "1"); prop.put("error_mimeTypeAvailable_mimeType", response.getMimeType()); - prop.putXML("error_triples", JenaTripleStore.getMetadataByURLHash(url.hash())); + Model model = JenaTripleStore.getSubmodelBySubject(YaCyMetadata.hashURI(url.hash())); + prop.putXML("error_triples", JenaTripleStore.getRDFByModel(model)); return prop; } diff --git a/htroot/Vocabulary_p.html b/htroot/Vocabulary_p.html index 7a2fe2bf4..30226a0ca 100644 --- a/htroot/Vocabulary_p.html +++ b/htroot/Vocabulary_p.html @@ -3,8 +3,76 @@