[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/utils/strigi-foaf
From: Egon Willighagen <e.willighagen () science ! ru ! nl>
Date: 2007-11-09 12:09:02
Message-ID: 1194610142.365987.21432.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 734620 by egonw:
Added support for foaf: jabberID, homepage and interests
M +6 -0 ChangeLog
M +27 -0 src/foafsaxanalyzer.cpp
M +5 -0 src/foafsaxanalyzer.h
--- trunk/playground/utils/strigi-foaf/ChangeLog #734619:734620
@@ -1,3 +1,9 @@
+0.2 (2007-11-09)
+-------------------------
+* added foaf:interests
+* added foaf:jabberID
+* added foaf:homepage
+
0.1
-------------------------
* first draft
--- trunk/playground/utils/strigi-foaf/src/foafsaxanalyzer.cpp #734619:734620
@@ -48,8 +48,13 @@
void FOAFSaxAnalyzerFactory::registerFields(FieldRegister& reg) {
contactNameField = \
reg.registerField("http://freedesktop.org/standards/xesam/1.0/core#contactName"); +// \
contactGivenNameField = \
reg.registerField("http://freedesktop.org/standards/xesam/1.0/core#contactName"); +// \
contactFamilyNameField = \
reg.registerField("http://freedesktop.org/standards/xesam/1.0/core#contactName"); \
contactNickField = reg.registerField("http://freedesktop.org/standards/xesam/1.0/core#contactNick");
contactBlogField = \
reg.registerField("http://freedesktop.org/standards/xesam/1.0/core#blogContactURL"); \
+ contactHomepageField = \
reg.registerField("http://freedesktop.org/standards/xesam/1.0/core#homepageContactURL");
+ contactJabberIDField = \
reg.registerField("http://freedesktop.org/standards/xesam/1.0/core#jabberContactMedium");
+ contactInterestsField = \
reg.registerField("http://freedesktop.org/standards/xesam/1.0/core#interests"); }
Strigi::StreamSaxAnalyzer* FOAFSaxAnalyzerFactory::newInstance() const {
@@ -92,6 +97,26 @@
result->addValue(factory->contactBlogField, value);
}
}
+ } else if (strcmp(localname, "homepage") == 0) {
+ for (int i = 0 ; i < nb_attributes ; i++) {
+ const char* attrName(attributes[0+i*5]);
+ int stringLength = strlen(attributes[3+i*5]) - strlen(attributes[4+i*5]);
+ if (strcmp(attrName, "resource") == 0) {
+ string value(attributes[3+i*5], stringLength);
+ trim(value);
+ result->addValue(factory->contactHomepageField, value);
+ }
+ }
+ } else if (strcmp(localname, "interest") == 0) {
+ for (int i = 0 ; i < nb_attributes ; i++) {
+ const char* attrName(attributes[0+i*5]);
+ int stringLength = strlen(attributes[3+i*5]) - strlen(attributes[4+i*5]);
+ if (strcmp(attrName, "title") == 0) {
+ string value(attributes[3+i*5], stringLength);
+ trim(value);
+ result->addValue(factory->contactInterestsField, value);
+ }
+ }
}
}
@@ -106,6 +131,8 @@
result->addValue(factory->contactNameField, charContents);
} else if (strcmp(localname, "nick") == 0) {
result->addValue(factory->contactNickField, charContents);
+ } else if (strcmp(localname, "jabberID") == 0) {
+ result->addValue(factory->contactJabberIDField, charContents);
}
}
--- trunk/playground/utils/strigi-foaf/src/foafsaxanalyzer.h #734619:734620
@@ -40,8 +40,13 @@
Strigi::StreamSaxAnalyzer* newInstance() const;
const Strigi::RegisteredField* contactNameField;
+// const Strigi::RegisteredField* contactGivenNameField;
+// const Strigi::RegisteredField* contactFamilyNameField;
const Strigi::RegisteredField* contactNickField;
const Strigi::RegisteredField* contactBlogField;
+ const Strigi::RegisteredField* contactHomepageField;
+ const Strigi::RegisteredField* contactJabberIDField;
+ const Strigi::RegisteredField* contactInterestsField;
};
class FOAFSaxAnalyzer
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic