diff rdf/PluginRDFIndexer.cpp @ 520:e340b2fb9471

* Make FileSource able to indicate its preferred content type (e.g. application/rdf+xml in preference to text/html for rdf content) * Temp directory on Windows -- make $HOME expand to homedrive+homepath instead of user profile location (which may be networked)
author Chris Cannam
date Thu, 11 Dec 2008 15:18:10 +0000
parents 1b8c748fd7ea
children b4a8d8221eaf
line wrap: on
line diff
--- a/rdf/PluginRDFIndexer.cpp	Thu Dec 11 12:37:16 2008 +0000
+++ b/rdf/PluginRDFIndexer.cpp	Thu Dec 11 15:18:10 2008 +0000
@@ -43,6 +43,9 @@
 PluginRDFIndexer *
 PluginRDFIndexer::m_instance = 0;
 
+bool
+PluginRDFIndexer::m_prefixesLoaded = false;
+
 PluginRDFIndexer *
 PluginRDFIndexer::getInstance() 
 {
@@ -236,6 +239,8 @@
 {
     Profiler profiler("PluginRDFIndexer::indexURL");
 
+    loadPrefixes();
+
 //    std::cerr << "PluginRDFIndexer::indexURL(" << urlString.toStdString() << ")" << std::endl;
 
     QMutexLocker locker(&m_mutex);
@@ -245,7 +250,7 @@
     if (FileSource::isRemote(urlString) &&
         FileSource::canHandleScheme(urlString)) {
 
-        CachedFile cf(urlString);
+        CachedFile cf(urlString, 0, "application/rdf+xml");
         if (!cf.isOK()) {
             return false;
         }
@@ -367,5 +372,22 @@
     return addedSomething;
 }
 
+void
+PluginRDFIndexer::loadPrefixes()
+{
+    return;
+//!!!
+    if (m_prefixesLoaded) return;
+    const char *prefixes[] = {
+        "http://purl.org/ontology/vamp/"
+    };
+    for (size_t i = 0; i < sizeof(prefixes)/sizeof(prefixes[0]); ++i) {
+        CachedFile cf(prefixes[i], 0, "application/rdf+xml");
+        if (!cf.isOK()) continue;
+        SimpleSPARQLQuery::addSourceToModel
+            (QUrl::fromLocalFile(cf.getLocalFilename()).toString());
+    }
+    m_prefixesLoaded = true;
+}