Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
fixed vocabulary initialization
Michael Peter Christenc2f0d16d2c0e
diff --git a/htroot/Vocabulary_p.java b/htroot/Vocabulary_p.javaindex 44d98cbc8..5a7eeca93 100644--- a/htroot/Vocabulary_p.java+++ b/htroot/Vocabulary_p.java@@ -172,7 +172,7 @@ public class Vocabulary_p {prop.putHTML("edit_terms_" + c + "_editable_synonyms", entry.getValue().getSynonymsCSV());prop.putHTML("edit_terms_" + c + "_editable_objectlink", entry.getValue().getObjectlink());c++;- if (c > 1000) break;+ if (c > 3000) break;}prop.put("edit_terms", c);}diff --git a/source/net/yacy/cora/lod/vocabulary/Tagging.java b/source/net/yacy/cora/lod/vocabulary/Tagging.javaindex 96992b8ad..dac5a628e 100644--- a/source/net/yacy/cora/lod/vocabulary/Tagging.java+++ b/source/net/yacy/cora/lod/vocabulary/Tagging.java@@ -303,7 +303,8 @@ public class Tagging {Map<String, Set<String>> r = reconstructionSets();Map<String, SOTuple> map = new TreeMap<String, SOTuple>();for (Map.Entry<String, Set<String>> e: r.entrySet()) {- map.put(e.getKey(), new SOTuple(e.getValue().toArray(new String[e.getValue().size()]), ""));+ String objectlink = this.term2objectlink.get(e.getKey());+ map.put(e.getKey(), new SOTuple(e.getValue().toArray(new String[e.getValue().size()]), objectlink == null ? "" : objectlink));}return map;}diff --git a/source/net/yacy/document/LibraryProvider.java b/source/net/yacy/document/LibraryProvider.javaindex 92d6d352f..c0f4b940e 100644--- a/source/net/yacy/document/LibraryProvider.java+++ b/source/net/yacy/document/LibraryProvider.java@@ -42,8 +42,6 @@ import java.util.TreeSet;import java.util.zip.ZipException;import java.util.zip.ZipFile;-import com.hp.hpl.jena.rdf.model.Resource;-import net.yacy.cora.document.MultiProtocolURI;import net.yacy.cora.lod.JenaTripleStore;import net.yacy.cora.lod.vocabulary.Tagging;@@ -55,6 +53,8 @@ import net.yacy.document.geolocalization.OverarchingLocation;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.util.FileUtils;+import com.hp.hpl.jena.rdf.model.Resource;+public class LibraryProvider {public static final char tagPrefix = '$';@@ -65,7 +65,7 @@ public class LibraryProvider {public static final String disabledExtension = ".disabled";public static WordCache dymLib = new WordCache(null);- public static Autotagging autotagging = new Autotagging(null, tagPrefix);+ public static Autotagging autotagging = null;public static OverarchingLocation geoLoc = new OverarchingLocation();private static File dictSource = null;private static File dictRoot = null;@@ -116,12 +116,12 @@ public class LibraryProvider {dictRoot = rootPath;// initialize libraries+ initAutotagging(tagPrefix);activateDeReWo();initDidYouMean();integrateOpenGeoDB();integrateGeonames();activatePND();- initAutotagging(tagPrefix);Set<String> allTags = new HashSet<String>() ;allTags.addAll(autotagging.allTags()); // we must copy this into a clone to prevent circularityautotagging.addPlaces(geoLoc);@@ -194,7 +194,7 @@ public class LibraryProvider {final File derewoOutput = new File(dymDict, derewoInput.getName() + ".words");FileUtils.deletedelete(derewoOutput);}-+public static void activatePND() {// translate input files (once..)final File dymDict = new File(dictRoot, path_to_did_you_mean_dictionaries);@@ -212,27 +212,32 @@ public class LibraryProvider {}// read the triplestore and generate a vocabularyMap<String, SOTuple> map = new HashMap<String, SOTuple>();+ Log.logInfo("LibraryProvider", "retrieving PND data from triplestore");Iterator<Resource> i = JenaTripleStore.getSubjects("http://dbpedia.org/ontology/individualisedPnd");+ Log.logInfo("LibraryProvider", "creating vocabulary map from PND triplestore");+ String objectspace = "";while (i.hasNext()) {Resource resource = i.next();String subject = resource.toString();-+// prepare a propert term from the subject uriint p = subject.lastIndexOf('/');if (p < 0) continue;String term = subject.substring(p + 1);- //String objectspace = subject.substring(0, p);+ objectspace = subject.substring(0, p + 1);p = term.indexOf('(');if (p >= 0) term = term.substring(0, p);term = term.replaceAll("_", " ").trim();if (term.length() == 0) continue;-+// store the term into the vocabulary mapmap.put(term, new SOTuple("", subject));}try {- Tagging pndVoc = new Tagging("Persons", null, "", map);+ Log.logInfo("LibraryProvider", "adding vocabulary to autotagging");+ Tagging pndVoc = new Tagging("Persons", null, objectspace, map);autotagging.addVocabulary(pndVoc);+ Log.logInfo("LibraryProvider", "added pnd vocabulary to autotagging");} catch (IOException e) {}}