From e16e4bd2ba586d85be39547bd4b47dc598bc650e Mon Sep 17 00:00:00 2001 From: Michael Peter Christen Date: Mon, 18 Jun 2012 13:02:12 +0200 Subject: [PATCH] added ontology extraction in xml as api call for vocabularies --- htroot/Vocabulary_p.html | 17 ++++++++++++++++- htroot/Vocabulary_p.java | 26 ++++++++++++++++++++------ htroot/Vocabulary_p.xml | 25 +++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 7 deletions(-) create mode 100644 htroot/Vocabulary_p.xml diff --git a/htroot/Vocabulary_p.html b/htroot/Vocabulary_p.html index 468eab159..4a3abcdbc 100644 --- a/htroot/Vocabulary_p.html +++ b/htroot/Vocabulary_p.html @@ -57,7 +57,22 @@ function updatepage(str) { //]]> - + + +#(edit)#:: +
+API + +The information that is presented on this page can also be retrieved as XML +Click the API icon to see the XML. +To see a list of all APIs, please visit the API wiki page. +
+#(/edit)# + #%env/templates/header.template%# #%env/templates/submenuSemantic.template%#

Vocabulary Administration

diff --git a/htroot/Vocabulary_p.java b/htroot/Vocabulary_p.java index c78c5b7ba..6021e9c7c 100644 --- a/htroot/Vocabulary_p.java +++ b/htroot/Vocabulary_p.java @@ -190,31 +190,45 @@ public class Vocabulary_p { prop.put("edit_editable", editable ? 1 : 0); prop.putHTML("edit_editable_file", editable ? vocabulary.getFile().getAbsolutePath() : ""); prop.putHTML("edit_name", vocabulary.getName()); + prop.putXML("edit_namexml", vocabulary.getName()); prop.putHTML("edit_namespace", vocabulary.getNamespace()); prop.put("edit_size", vocabulary.size()); prop.putHTML("edit_predicate", vocabulary.getPredicate()); prop.putHTML("edit_prefix", Tagging.DEFAULT_PREFIX); prop.putHTML("edit_editable_objectspace", vocabulary.getObjectspace() == null ? "" : vocabulary.getObjectspace()); prop.putHTML("edit_editable_objectspacepredicate", DCTerms.references.getPredicate()); - prop.putHTML("edit_triple1", "<" + yacyurl + "> <" + vocabulary.getPredicate() + "> \"[discovered-tags-commaseparated]\""); - prop.putHTML("edit_triple2", "<" + yacyurl + "> <" + Owl.SameAs.getPredicate() + "> <[document-url]>"); - prop.putHTML("edit_tripleN", vocabulary.getObjectspace() == null ? "none - missing objectspace" : "<" + yacyurl + "> <" + DCTerms.references.getPredicate() + "> \"[reference-link]#[tag]\" ."); + prop.putXML("edit_triple1", "<" + yacyurl + "> <" + vocabulary.getPredicate() + "> \"[discovered-tags-commaseparated]\""); + prop.putXML("edit_triple2", "<" + yacyurl + "> <" + Owl.SameAs.getPredicate() + "> <[document-url]>"); + prop.putXML("edit_tripleN", vocabulary.getObjectspace() == null ? "none - missing objectspace" : "<" + yacyurl + "> <" + DCTerms.references.getPredicate() + "> \"[object-link]#[tag]\" ."); int c = 0; boolean dark = false; + int osl = vocabulary.getObjectspace() == null ? 0 : vocabulary.getObjectspace().length(); Map list = vocabulary.list(); prop.put("edit_size", list.size()); for (Map.Entry entry: list.entrySet()) { prop.put("edit_terms_" + c + "_editable", editable ? 1 : 0); prop.put("edit_terms_" + c + "_dark", dark ? 1 : 0); dark = !dark; + prop.putXML("edit_terms_" + c + "_label", osl > entry.getValue().getObjectlink().length() ? entry.getKey() : entry.getValue().getObjectlink().substring(osl)); prop.putHTML("edit_terms_" + c + "_term", entry.getKey()); + prop.putXML("edit_terms_" + c + "_termxml", entry.getKey()); prop.putHTML("edit_terms_" + c + "_editable_term", entry.getKey()); - prop.putHTML("edit_terms_" + c + "_editable_synonyms", entry.getValue().getSynonymsCSV()); - prop.putHTML("edit_terms_" + c + "_editable_objectlink", entry.getValue().getObjectlink()); + String synonymss = entry.getValue().getSynonymsCSV(); + prop.putHTML("edit_terms_" + c + "_editable_synonyms", synonymss); + if (synonymss.length() > 0) { + String[] synonymsa = entry.getValue().getSynonymsList(); + for (int i = 0; i < synonymsa.length; i++) { + prop.put("edit_terms_" + c + "_synonyms_" + i + "_altLabel", synonymsa[i]); + } + prop.put("edit_terms_" + c + "_synonyms", synonymsa.length); + } else { + prop.put("edit_terms_" + c + "_synonyms", 0); + } + prop.putXML("edit_terms_" + c + "_editable_objectlink", entry.getValue().getObjectlink()); c++; if (c > 3000) break; } prop.put("edit_terms", c); - + } // return rewrite properties diff --git a/htroot/Vocabulary_p.xml b/htroot/Vocabulary_p.xml new file mode 100644 index 000000000..afc65ba58 --- /dev/null +++ b/htroot/Vocabulary_p.xml @@ -0,0 +1,25 @@ + + +#(edit)#:: + + #[namexml]# + + + #{terms}# + + #[label]# + + #[termxml]# + #{synonyms}# + #[altLabel]# + #{/synonyms}# + + + #{/terms}# +#(/edit)# +