From 79464189a4a3af42528093ebae1798e4468b466d Mon Sep 17 00:00:00 2001 From: Michael Peter Christen Date: Wed, 13 Jun 2012 13:05:41 +0200 Subject: [PATCH] The 'Locale' vocabulary, which is generated by geo data, has now the objectspace "http://dbpedia.org/resource/" --- htroot/Vocabulary_p.html | 4 ++-- source/net/yacy/cora/lod/vocabulary/Tagging.java | 4 ++++ source/net/yacy/document/Autotagging.java | 4 ++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/htroot/Vocabulary_p.html b/htroot/Vocabulary_p.html index ebce2e014..5febbdf29 100644 --- a/htroot/Vocabulary_p.html +++ b/htroot/Vocabulary_p.html @@ -40,9 +40,9 @@
Namespace
#[namespace]#
Predicate
#[predicate]#
Prefix
#[prefix]#
-
Objectspace
#(editable)##[objectspacepredicate]#::
if set, this uses the predicate #[objectspacepredicate]# for generated objects#(/editable)#
+
Objectspace
#(editable)##[objectspace]#::
if set, uses the predicate #[objectspacepredicate]# for generated objects. Hint: use 'http://dbpedia.org/resource/' as default.#(/editable)#
-

This produces the following triples in the triplestore if a term or synonym matches in a document:

+

This produces the following triples in the triplestore if a term or synonym matches in a document:

Triple #1
#[triple1]#
Triple #2
#[triple2]#
diff --git a/source/net/yacy/cora/lod/vocabulary/Tagging.java b/source/net/yacy/cora/lod/vocabulary/Tagging.java index 8d47be415..f2d2ed8f7 100644 --- a/source/net/yacy/cora/lod/vocabulary/Tagging.java +++ b/source/net/yacy/cora/lod/vocabulary/Tagging.java @@ -73,10 +73,12 @@ public class Tagging { } private File tmpFile() { + if (this.propFile == null) return null; return new File(this.propFile.getAbsolutePath() + ".tmp"); } public void put(String term, String synonyms) throws IOException { + if (this.propFile == null) return; File tmp = tmpFile(); BufferedWriter w = new BufferedWriter(new FileWriter(tmp)); BlockingQueue list = Files.concurentLineReader(this.propFile, 1000); @@ -109,6 +111,7 @@ public class Tagging { } public void delete(String term) throws IOException { + if (this.propFile == null) return; File tmp = tmpFile(); BufferedWriter w = new BufferedWriter(new FileWriter(tmp)); BlockingQueue list = Files.concurentLineReader(this.propFile, 1000); @@ -136,6 +139,7 @@ public class Tagging { } public void setObjectspace(String os) throws IOException { + if (this.propFile == null) return; if (os == null || (this.objectspace != null && this.objectspace.equals(os))) return; this.objectspace = os; File tmp = tmpFile(); diff --git a/source/net/yacy/document/Autotagging.java b/source/net/yacy/document/Autotagging.java index 5458b7411..0a01f1458 100644 --- a/source/net/yacy/document/Autotagging.java +++ b/source/net/yacy/document/Autotagging.java @@ -115,6 +115,10 @@ public class Autotagging { public void addLocalization(Localization localization) { Tagging voc = new Tagging("Locale", localization); + try { + voc.setObjectspace("http://dbpedia.org/resource/"); + } catch (IOException e) { + } this.vocabularies.put("Locale", voc); for (String t: voc.tags()) { this.allTags.put(t, PRESENT);