changeset 730:27c861cce97b dataquay

Further fixes for Dataquay compatibility
author Chris Cannam
date Mon, 21 May 2012 14:33:35 +0100
parents 11289d40a57a
children 760feced8380
files configure configure.ac rdf/PluginRDFDescription.cpp rdf/PluginRDFIndexer.cpp rdf/RDFFeatureWriter.cpp rdf/RDFFeatureWriter.h rdf/RDFImporter.cpp rdf/RDFTransformFactory.cpp
diffstat 8 files changed, 175 insertions(+), 288 deletions(-) [+]
line wrap: on
line diff
--- a/configure	Sat May 19 18:57:52 2012 +0100
+++ b/configure	Mon May 21 14:33:35 2012 +0100
@@ -631,10 +631,8 @@
 portaudio_2_0_CFLAGS
 liblo_LIBS
 liblo_CFLAGS
-redland_LIBS
-redland_CFLAGS
-rasqal_LIBS
-rasqal_CFLAGS
+dataquay_LIBS
+dataquay_CFLAGS
 rubberband_LIBS
 rubberband_CFLAGS
 vamphostsdk_LIBS
@@ -746,10 +744,8 @@
 vamphostsdk_LIBS
 rubberband_CFLAGS
 rubberband_LIBS
-rasqal_CFLAGS
-rasqal_LIBS
-redland_CFLAGS
-redland_LIBS
+dataquay_CFLAGS
+dataquay_LIBS
 liblo_CFLAGS
 liblo_LIBS
 portaudio_2_0_CFLAGS
@@ -1423,13 +1419,10 @@
               C compiler flags for rubberband, overriding pkg-config
   rubberband_LIBS
               linker flags for rubberband, overriding pkg-config
-  rasqal_CFLAGS
-              C compiler flags for rasqal, overriding pkg-config
-  rasqal_LIBS linker flags for rasqal, overriding pkg-config
-  redland_CFLAGS
-              C compiler flags for redland, overriding pkg-config
-  redland_LIBS
-              linker flags for redland, overriding pkg-config
+  dataquay_CFLAGS
+              C compiler flags for dataquay, overriding pkg-config
+  dataquay_LIBS
+              linker flags for dataquay, overriding pkg-config
   liblo_CFLAGS
               C compiler flags for liblo, overriding pkg-config
   liblo_LIBS  linker flags for liblo, overriding pkg-config
@@ -5458,18 +5451,18 @@
 fi
 
 
-SV_MODULE_MODULE=rasqal
-SV_MODULE_VERSION_TEST="rasqal >= 0.9.19"
-SV_MODULE_HEADER=rasqal/rasqal.h
-SV_MODULE_LIB=rasqal
-SV_MODULE_FUNC=rasqal_new_world
-SV_MODULE_HAVE=HAVE_$(echo rasqal | tr 'a-z' 'A-Z')
+SV_MODULE_MODULE=dataquay
+SV_MODULE_VERSION_TEST="dataquay >= 0.9"
+SV_MODULE_HEADER=dataquay/Uri.h
+SV_MODULE_LIB=dataquay
+SV_MODULE_FUNC=
+SV_MODULE_HAVE=HAVE_$(echo dataquay | tr 'a-z' 'A-Z')
 SV_MODULE_FAILED=1
-if test -n "$rasqal_LIBS" ; then
+if test -n "$dataquay_LIBS" ; then
    { $as_echo "$as_me:${as_lineno-$LINENO}: User set ${SV_MODULE_MODULE}_LIBS explicitly, skipping test for $SV_MODULE_MODULE" >&5
 $as_echo "$as_me: User set ${SV_MODULE_MODULE}_LIBS explicitly, skipping test for $SV_MODULE_MODULE" >&6;}
-   CXXFLAGS="$CXXFLAGS $rasqal_CFLAGS"
-   LIBS="$LIBS $rasqal_LIBS"
+   CXXFLAGS="$CXXFLAGS $dataquay_CFLAGS"
+   LIBS="$LIBS $dataquay_LIBS"
    SV_MODULE_FAILED=""
 fi
 if test -z "$SV_MODULE_VERSION_TEST" ; then
@@ -5478,11 +5471,11 @@
 if test -n "$SV_MODULE_FAILED" && test -n "$PKG_CONFIG"; then
 
 pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rasqal" >&5
-$as_echo_n "checking for rasqal... " >&6; }
-
-if test -n "$rasqal_CFLAGS"; then
-    pkg_cv_rasqal_CFLAGS="$rasqal_CFLAGS"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dataquay" >&5
+$as_echo_n "checking for dataquay... " >&6; }
+
+if test -n "$dataquay_CFLAGS"; then
+    pkg_cv_dataquay_CFLAGS="$dataquay_CFLAGS"
  elif test -n "$PKG_CONFIG"; then
     if test -n "$PKG_CONFIG" && \
     { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$SV_MODULE_VERSION_TEST\""; } >&5
@@ -5490,7 +5483,7 @@
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-  pkg_cv_rasqal_CFLAGS=`$PKG_CONFIG --cflags "$SV_MODULE_VERSION_TEST" 2>/dev/null`
+  pkg_cv_dataquay_CFLAGS=`$PKG_CONFIG --cflags "$SV_MODULE_VERSION_TEST" 2>/dev/null`
 		      test "x$?" != "x0" && pkg_failed=yes
 else
   pkg_failed=yes
@@ -5498,8 +5491,8 @@
  else
     pkg_failed=untried
 fi
-if test -n "$rasqal_LIBS"; then
-    pkg_cv_rasqal_LIBS="$rasqal_LIBS"
+if test -n "$dataquay_LIBS"; then
+    pkg_cv_dataquay_LIBS="$dataquay_LIBS"
  elif test -n "$PKG_CONFIG"; then
     if test -n "$PKG_CONFIG" && \
     { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$SV_MODULE_VERSION_TEST\""; } >&5
@@ -5507,7 +5500,7 @@
   ac_status=$?
   $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
   test $ac_status = 0; }; then
-  pkg_cv_rasqal_LIBS=`$PKG_CONFIG --libs "$SV_MODULE_VERSION_TEST" 2>/dev/null`
+  pkg_cv_dataquay_LIBS=`$PKG_CONFIG --libs "$SV_MODULE_VERSION_TEST" 2>/dev/null`
 		      test "x$?" != "x0" && pkg_failed=yes
 else
   pkg_failed=yes
@@ -5528,12 +5521,12 @@
         _pkg_short_errors_supported=no
 fi
         if test $_pkg_short_errors_supported = yes; then
-	        rasqal_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$SV_MODULE_VERSION_TEST" 2>&1`
+	        dataquay_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$SV_MODULE_VERSION_TEST" 2>&1`
         else
-	        rasqal_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$SV_MODULE_VERSION_TEST" 2>&1`
+	        dataquay_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$SV_MODULE_VERSION_TEST" 2>&1`
         fi
 	# Put the nasty error message in config.log where it belongs
-	echo "$rasqal_PKG_ERRORS" >&5
+	echo "$dataquay_PKG_ERRORS" >&5
 
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: Failed to find required module $SV_MODULE_MODULE using pkg-config, trying again by old-fashioned means" >&5
 $as_echo "$as_me: Failed to find required module $SV_MODULE_MODULE using pkg-config, trying again by old-fashioned means" >&6;}
@@ -5543,162 +5536,11 @@
 	{ $as_echo "$as_me:${as_lineno-$LINENO}: Failed to find required module $SV_MODULE_MODULE using pkg-config, trying again by old-fashioned means" >&5
 $as_echo "$as_me: Failed to find required module $SV_MODULE_MODULE using pkg-config, trying again by old-fashioned means" >&6;}
 else
-	rasqal_CFLAGS=$pkg_cv_rasqal_CFLAGS
-	rasqal_LIBS=$pkg_cv_rasqal_LIBS
+	dataquay_CFLAGS=$pkg_cv_dataquay_CFLAGS
+	dataquay_LIBS=$pkg_cv_dataquay_LIBS
         { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
-	HAVES="$HAVES $SV_MODULE_HAVE";CXXFLAGS="$CXXFLAGS $rasqal_CFLAGS";LIBS="$LIBS $rasqal_LIBS";SV_MODULE_FAILED=""
-fi
-fi
-if test -n "$SV_MODULE_FAILED"; then
-   as_ac_Header=`$as_echo "ac_cv_header_$SV_MODULE_HEADER" | $as_tr_sh`
-ac_fn_cxx_check_header_mongrel "$LINENO" "$SV_MODULE_HEADER" "$as_ac_Header" "$ac_includes_default"
-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
-  HAVES="$HAVES $SV_MODULE_HAVE"
-else
-  as_fn_error $? "Failed to find header $SV_MODULE_HEADER for required module $SV_MODULE_MODULE" "$LINENO" 5
-fi
-
-
-   if test -n "$SV_MODULE_LIB"; then
-     as_ac_Lib=`$as_echo "ac_cv_lib_$SV_MODULE_LIB''_$SV_MODULE_FUNC" | $as_tr_sh`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $SV_MODULE_FUNC in -l$SV_MODULE_LIB" >&5
-$as_echo_n "checking for $SV_MODULE_FUNC in -l$SV_MODULE_LIB... " >&6; }
-if eval \${$as_ac_Lib+:} false; then :
-  $as_echo_n "(cached) " >&6
-else
-  ac_check_lib_save_LIBS=$LIBS
-LIBS="-l$SV_MODULE_LIB  $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $SV_MODULE_FUNC ();
-int
-main ()
-{
-return $SV_MODULE_FUNC ();
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_cxx_try_link "$LINENO"; then :
-  eval "$as_ac_Lib=yes"
-else
-  eval "$as_ac_Lib=no"
-fi
-rm -f core conftest.err conftest.$ac_objext \
-    conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-eval ac_res=\$$as_ac_Lib
-	       { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-if eval test \"x\$"$as_ac_Lib"\" = x"yes"; then :
-  LIBS="$LIBS -l$SV_MODULE_LIB"
-else
-  as_fn_error $? "Failed to find library $SV_MODULE_LIB for required module $SV_MODULE_MODULE" "$LINENO" 5
-fi
-
-   fi
-fi
-
-
-SV_MODULE_MODULE=redland
-SV_MODULE_VERSION_TEST="redland >= 1.0.10"
-SV_MODULE_HEADER=librdf.h
-SV_MODULE_LIB=rdf
-SV_MODULE_FUNC=librdf_new_world
-SV_MODULE_HAVE=HAVE_$(echo redland | tr 'a-z' 'A-Z')
-SV_MODULE_FAILED=1
-if test -n "$redland_LIBS" ; then
-   { $as_echo "$as_me:${as_lineno-$LINENO}: User set ${SV_MODULE_MODULE}_LIBS explicitly, skipping test for $SV_MODULE_MODULE" >&5
-$as_echo "$as_me: User set ${SV_MODULE_MODULE}_LIBS explicitly, skipping test for $SV_MODULE_MODULE" >&6;}
-   CXXFLAGS="$CXXFLAGS $redland_CFLAGS"
-   LIBS="$LIBS $redland_LIBS"
-   SV_MODULE_FAILED=""
-fi
-if test -z "$SV_MODULE_VERSION_TEST" ; then
-   SV_MODULE_VERSION_TEST=$SV_MODULE_MODULE
-fi
-if test -n "$SV_MODULE_FAILED" && test -n "$PKG_CONFIG"; then
-
-pkg_failed=no
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for redland" >&5
-$as_echo_n "checking for redland... " >&6; }
-
-if test -n "$redland_CFLAGS"; then
-    pkg_cv_redland_CFLAGS="$redland_CFLAGS"
- elif test -n "$PKG_CONFIG"; then
-    if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$SV_MODULE_VERSION_TEST\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "$SV_MODULE_VERSION_TEST") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; then
-  pkg_cv_redland_CFLAGS=`$PKG_CONFIG --cflags "$SV_MODULE_VERSION_TEST" 2>/dev/null`
-		      test "x$?" != "x0" && pkg_failed=yes
-else
-  pkg_failed=yes
-fi
- else
-    pkg_failed=untried
-fi
-if test -n "$redland_LIBS"; then
-    pkg_cv_redland_LIBS="$redland_LIBS"
- elif test -n "$PKG_CONFIG"; then
-    if test -n "$PKG_CONFIG" && \
-    { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"\$SV_MODULE_VERSION_TEST\""; } >&5
-  ($PKG_CONFIG --exists --print-errors "$SV_MODULE_VERSION_TEST") 2>&5
-  ac_status=$?
-  $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
-  test $ac_status = 0; }; then
-  pkg_cv_redland_LIBS=`$PKG_CONFIG --libs "$SV_MODULE_VERSION_TEST" 2>/dev/null`
-		      test "x$?" != "x0" && pkg_failed=yes
-else
-  pkg_failed=yes
-fi
- else
-    pkg_failed=untried
-fi
-
-
-
-if test $pkg_failed = yes; then
-   	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-
-if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
-        _pkg_short_errors_supported=yes
-else
-        _pkg_short_errors_supported=no
-fi
-        if test $_pkg_short_errors_supported = yes; then
-	        redland_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$SV_MODULE_VERSION_TEST" 2>&1`
-        else
-	        redland_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$SV_MODULE_VERSION_TEST" 2>&1`
-        fi
-	# Put the nasty error message in config.log where it belongs
-	echo "$redland_PKG_ERRORS" >&5
-
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: Failed to find required module $SV_MODULE_MODULE using pkg-config, trying again by old-fashioned means" >&5
-$as_echo "$as_me: Failed to find required module $SV_MODULE_MODULE using pkg-config, trying again by old-fashioned means" >&6;}
-elif test $pkg_failed = untried; then
-     	{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-	{ $as_echo "$as_me:${as_lineno-$LINENO}: Failed to find required module $SV_MODULE_MODULE using pkg-config, trying again by old-fashioned means" >&5
-$as_echo "$as_me: Failed to find required module $SV_MODULE_MODULE using pkg-config, trying again by old-fashioned means" >&6;}
-else
-	redland_CFLAGS=$pkg_cv_redland_CFLAGS
-	redland_LIBS=$pkg_cv_redland_LIBS
-        { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-	HAVES="$HAVES $SV_MODULE_HAVE";CXXFLAGS="$CXXFLAGS $redland_CFLAGS";LIBS="$LIBS $redland_LIBS";SV_MODULE_FAILED=""
+	HAVES="$HAVES $SV_MODULE_HAVE";CXXFLAGS="$CXXFLAGS $dataquay_CFLAGS";LIBS="$LIBS $dataquay_LIBS";SV_MODULE_FAILED=""
 fi
 fi
 if test -n "$SV_MODULE_FAILED"; then
--- a/configure.ac	Sat May 19 18:57:52 2012 +0100
+++ b/configure.ac	Mon May 21 14:33:35 2012 +0100
@@ -82,8 +82,7 @@
 SV_MODULE_REQUIRED([vamp],[vamp >= 2.1],[vamp/vamp.h],[],[])
 SV_MODULE_REQUIRED([vamphostsdk],[vamp-hostsdk >= 2.0],[vamp-hostsdk/PluginLoader.h],[],[])
 SV_MODULE_REQUIRED([rubberband],[rubberband],[rubberband/RubberBandStretcher.h],[rubberband],[rubberband_new])
-SV_MODULE_REQUIRED([rasqal],[rasqal >= 0.9.19],[rasqal/rasqal.h],[rasqal],[rasqal_new_world])
-SV_MODULE_REQUIRED([redland],[redland >= 1.0.10],[librdf.h],[rdf],[librdf_new_world])
+SV_MODULE_REQUIRED([dataquay],[dataquay >= 0.9],[dataquay/Uri.h],[dataquay],[])
 
 SV_MODULE_OPTIONAL([liblo],[],[lo/lo.h],[lo],[lo_address_new])
 SV_MODULE_OPTIONAL([portaudio_2_0],[portaudio-2.0 >= 19],[portaudio.h],[portaudio],[Pa_IsFormatSupported])
--- a/rdf/PluginRDFDescription.cpp	Sat May 19 18:57:52 2012 +0100
+++ b/rdf/PluginRDFDescription.cpp	Mon May 21 14:33:35 2012 +0100
@@ -184,19 +184,25 @@
     const BasicStore *index = indexer->getIndex();
     Uri plugin(m_pluginUri);
 
-    Node n = index->matchFirst(Triple(plugin, "vamp:name", Node())).c;
+    Node n = index->complete
+        (Triple(plugin, index->expand("vamp:name"), Node()));
+
     if (n.type == Node::Literal && n.value != "") {
         m_pluginName = n.value;
     }
 
-    n = index->matchFirst(Triple(plugin, "dc:description", Node())).c;
+    n = index->complete
+        (Triple(plugin, index->expand("dc:description"), Node()));
+
     if (n.type == Node::Literal && n.value != "") {
         m_pluginDescription = n.value;
     }
 
-    n = index->matchFirst(Triple(plugin, "foaf:maker", Node())).c;
+    n = index->complete
+        (Triple(plugin, index->expand("foaf:maker"), Node()));
+
     if (n.type == Node::URI || n.type == Node::Blank) {
-        n = index->matchFirst(Triple(n, "foaf:name", Node())).c;
+        n = index->complete(Triple(n, index->expand("foaf:name"), Node()));
         if (n.type == Node::Literal && n.value != "") {
             m_pluginMaker = n.value;
         }
@@ -206,14 +212,18 @@
     // that.  Otherwise, a more-information URL for the plugin library
     // would do nicely.
 
-    n = index->matchFirst(Triple(plugin, "foaf:page", Node())).c;
+    n = index->complete
+        (Triple(plugin, index->expand("foaf:page"), Node()));
+
     if (n.type == Node::URI && n.value != "") {
         m_pluginInfoURL = n.value;
     }
 
-    n = index->matchFirst(Triple(Node(), "vamp:available_plugin", plugin)).a;
+    n = index->complete
+        (Triple(Node(), index->expand("vamp:available_plugin"), plugin));
+
     if (n.value != "") {
-        n = index->matchFirst(Triple(n, "foaf:page", Node())).c;
+        n = index->complete(Triple(n, index->expand("foaf:page"), Node()));
         if (n.type == Node::URI && n.value != "") {
             m_pluginInfoURL = n.value;
         }
@@ -231,7 +241,8 @@
     const BasicStore *index = indexer->getIndex();
     Uri plugin(m_pluginUri);
 
-    Nodes outputs = index->match(Triple(plugin, "vamp:output", Node())).a();
+    Nodes outputs = index->match
+        (Triple(plugin, index->expand("vamp:output"), Node())).objects();
 
     if (outputs.empty()) {
         cerr << "ERROR: PluginRDFDescription::indexURL: NOTE: No outputs defined for <"
@@ -247,23 +258,23 @@
             return false;
         }
         
-        Node n = index->matchFirst(Triple(output, "vamp:identifier", Node())).c;
+        Node n = index->complete(Triple(output, index->expand("vamp:identifier"), Node()));
         if (n.type != Node::Literal || n.value == "") {
             cerr << "ERROR: PluginRDFDescription::indexURL: No vamp:identifier for output <" << output << ">" << endl;
             return false;
         }
         QString outputId = n.value;
 
-        n = index->matchFirst(Triple(output, "a", Node())).c;
+        m_outputUriMap[outputId] = output.value;
+
+        n = index->complete(Triple(output, Uri("a"), Node()));
         QString outputType;
         if (n.type == Node::URI) outputType = n.value;
 
-        n = index->matchFirst(Triple(output, "vamp:unit", Node())).c;
+        n = index->complete(Triple(output, index->expand("vamp:unit"), Node()));
         QString outputUnit;
         if (n.type == Node::Literal) outputUnit = n.value;
 
-        m_outputUriMap[outputId] = output.value;
-
         if (outputType.contains("DenseOutput")) {
             m_outputDispositions[outputId] = OutputDense;
         } else if (outputType.contains("SparseOutput")) {
@@ -273,27 +284,30 @@
         } else {
             m_outputDispositions[outputId] = OutputDispositionUnknown;
         }
+        cerr << "output " << output << " -> id " << outputId << ", type " << outputType << ", unit " 
+             << outputUnit << ", disposition " << m_outputDispositions[outputId] << endl;
             
         if (outputUnit != "") {
             m_outputUnitMap[outputId] = outputUnit;
         }
 
-        n = index->matchFirst(Triple(output, "dc:title", Node())).c;
+        n = index->complete(Triple(output, index->expand("dc:title"), Node()));
         if (n.type == Node::Literal && n.value != "") {
             m_outputNames[outputId] = n.value;
         }
 
-        n = index->matchFirst(Triple(output, "vamp:computes_event_type", Node())).c;
+        n = index->complete(Triple(output, index->expand("vamp:computes_event_type"), Node()));
+        cerr << output << " -> computes_event_type " << n << endl;
         if (n.type == Node::URI && n.value != "") {
             m_outputEventTypeURIMap[outputId] = n.value;
         }
 
-        n = index->matchFirst(Triple(output, "vamp:computes_feature", Node())).c;
+        n = index->complete(Triple(output, index->expand("vamp:computes_feature"), Node()));
         if (n.type == Node::URI && n.value != "") {
             m_outputFeatureAttributeURIMap[outputId] = n.value;
         }
 
-        n = index->matchFirst(Triple(output, "vamp:computes_signal_type", Node())).c;
+        n = index->complete(Triple(output, index->expand("vamp:computes_signal_type"), Node()));
         if (n.type == Node::URI && n.value != "") {
             m_outputSignalTypeURIMap[outputId] = n.value;
         }
--- a/rdf/PluginRDFIndexer.cpp	Sat May 19 18:57:52 2012 +0100
+++ b/rdf/PluginRDFIndexer.cpp	Mon May 21 14:33:35 2012 +0100
@@ -85,6 +85,8 @@
 {
     vector<string> paths = PluginHostAdapter::getPluginPath();
 
+//    std::cerr << "\nPluginRDFIndexer::indexInstalledURLs: pid is " << getpid() << std::endl;
+
     QStringList filters;
     filters << "*.n3";
     filters << "*.N3";
@@ -258,7 +260,7 @@
 {
     Profiler profiler("PluginRDFIndexer::indexURL");
 
-//    SVDEBUG << "PluginRDFIndexer::indexURL(" << urlString << ")" << endl;
+//    std::cerr << "PluginRDFIndexer::indexURL(" << urlString.toStdString() << ")" << std::endl;
 
     QMutexLocker locker(&m_mutex);
 
@@ -274,6 +276,10 @@
 
         local = QUrl::fromLocalFile(cf.getLocalFilename());
 
+    } else if (urlString.startsWith("file:")) {
+
+        local = QUrl(urlString);
+
     } else {
 
         local = QUrl::fromLocalFile(urlString);
@@ -282,10 +288,12 @@
     try {
         m_index->import(local, BasicStore::ImportFailOnDuplicates);
     } catch (RDFDuplicateImportException &e) {
+        cerr << e.what() << endl;
         cerr << "PluginRDFIndexer::pullURL: Document at " << urlString
-             << " duplicates triples found in earlier loaded document" << endl;
+             << " duplicates triples found in earlier loaded document -- skipping it" << endl;
         return false;
     } catch (RDFException &e) {
+        cerr << e.what() << endl;
         cerr << "PluginRDFIndexer::pullURL: Failed to import document from "
              << urlString << ": " << e.what() << endl;
         return false;
@@ -297,8 +305,8 @@
 PluginRDFIndexer::reindex()
 {
     Triples tt = m_index->match
-        (Triple(Node(), "a", m_index->expand("vamp:Plugin")));
-    Nodes plugins = tt.a();
+        (Triple(Node(), Uri("a"), m_index->expand("vamp:Plugin")));
+    Nodes plugins = tt.subjects();
 
     bool foundSomething = false;
     bool addedSomething = false;
@@ -311,36 +319,36 @@
             continue;
         }
         
-        Triple idt = m_index->matchFirst
-            (Triple(plugin, "vamp:identifier", Node()));
-        
-        if (idt.c.type != Node::Literal) {
+        Node idn = m_index->complete
+            (Triple(plugin, m_index->expand("vamp:identifier"), Node()));
+
+        if (idn.type != Node::Literal) {
             cerr << "PluginRDFIndexer::reindex: Plugin " << plugin
                  << " lacks vamp:identifier literal" << endl;
             continue;
         }
 
-        Triple libt = m_index->matchFirst
-            (Triple(Node(), "vamp:available_plugin", plugin));
+        Node libn = m_index->complete
+            (Triple(Node(), m_index->expand("vamp:available_plugin"), plugin));
 
-        if (libt.a.type != Node::URI) {
+        if (libn.type != Node::URI) {
             cerr << "PluginRDFIndexer::reindex: Plugin " << plugin 
                  << " is not vamp:available_plugin in any library" << endl;
             continue;
         }
 
-        Triple sot = m_index->matchFirst
-            (Triple(libt.a, "vamp:identifier", Node()));
+        Node son = m_index->complete
+            (Triple(libn, m_index->expand("vamp:identifier"), Node()));
 
-        if (sot.c.type != Node::Literal) {
-            cerr << "PluginRDFIndexer::reindex: Library " << libt.a
+        if (son.type != Node::Literal) {
+            cerr << "PluginRDFIndexer::reindex: Library " << libn
                  << " lacks vamp:identifier for soname" << endl;
             continue;
         }
 
         QString pluginUri = plugin.value;
-        QString identifier = idt.c.value;
-        QString soname = sot.c.value;
+        QString identifier = idn.value;
+        QString soname = son.value;
 
         QString pluginId = PluginIdentifier::createIdentifier
             ("vamp", soname, identifier);
--- a/rdf/RDFFeatureWriter.cpp	Sat May 19 18:57:52 2012 +0100
+++ b/rdf/RDFFeatureWriter.cpp	Mon May 21 14:33:35 2012 +0100
@@ -174,7 +174,8 @@
         m_startedStreamTransforms[stream].end()) {
         m_startedStreamTransforms[stream].insert(transform);
         writeLocalFeatureTypes
-            (stream, transform, output, m_rdfDescriptions[pluginId]);
+            (stream, transform, output, m_rdfDescriptions[pluginId],
+             summaryType);
     }
 
     if (m_singleFileName != "" || m_stdout) {
@@ -397,7 +398,8 @@
 RDFFeatureWriter::writeLocalFeatureTypes(QTextStream *sptr,
                                          const Transform &transform,
                                          const Plugin::OutputDescriptor &od,
-                                         PluginRDFDescription &desc)
+                                         PluginRDFDescription &desc, 
+                                         std::string summaryType)
 {
     QString outputId = od.identifier.c_str();
     QTextStream &stream = *sptr;
@@ -412,7 +414,8 @@
 
     //!!! bin names, extents and so on can be written out using e.g. vamp:bin_names ( "a" "b" "c" ) 
 
-    if (desc.getOutputDisposition(outputId) == 
+    if (summaryType == "" &&
+        desc.getOutputDisposition(outputId) == 
         PluginRDFDescription::OutputDense) {
 
         // no feature events, so may need signal type but won't need
@@ -476,7 +479,7 @@
     if (needEventType && m_fixedEventTypeURI == "") {
 
         QString uri;
-        if (m_syntheticEventTypeURIs.find(transform) !=
+        if (m_syntheticEventTypeURIs.find(transform) ==
             m_syntheticEventTypeURIs.end()) {
             uri = m_syntheticEventTypeURIs[transform];
         } else {
--- a/rdf/RDFFeatureWriter.h	Sat May 19 18:57:52 2012 +0100
+++ b/rdf/RDFFeatureWriter.h	Mon May 21 14:33:35 2012 +0100
@@ -77,7 +77,8 @@
     void writeLocalFeatureTypes(QTextStream *,
                                 const Transform &,
                                 const Vamp::Plugin::OutputDescriptor &,
-                                PluginRDFDescription &);
+                                PluginRDFDescription &,
+                                std::string summaryType);
 
     void writeSparseRDF(QTextStream *stream,
                         const Transform &transform,
--- a/rdf/RDFImporter.cpp	Sat May 19 18:57:52 2012 +0100
+++ b/rdf/RDFImporter.cpp	Mon May 21 14:33:35 2012 +0100
@@ -65,6 +65,7 @@
 
 protected:
     BasicStore *m_store;
+    Uri expand(QString s) { return m_store->expand(s); }
 
     QString m_uristring;
     QString m_errorString;
@@ -202,13 +203,13 @@
                                     ProgressReporter *reporter)
 {
     Nodes sigs = m_store->match
-        (Triple(Node(), "a", m_store->expand("mo:Signal"))).a();
+        (Triple(Node(), Uri("a"), expand("mo:Signal"))).subjects();
 
     foreach (Node sig, sigs) {
         
-        Node file = m_store->matchFirst(Triple(Node(), "mo:encodes", sig)).a;
+        Node file = m_store->complete(Triple(Node(), expand("mo:encodes"), sig));
         if (file == Node()) {
-            file = m_store->matchFirst(Triple(sig, "mo:available_as", Node())).c;
+            file = m_store->complete(Triple(sig, expand("mo:available_as"), Node()));
         }
         if (file == Node()) {
             std::cerr << "RDFImporterImpl::getDataModelsAudio: ERROR: No source for signal " << sig << std::endl;
@@ -287,14 +288,14 @@
     }
 
     Nodes sigFeatures = m_store->match
-        (Triple(Node(), "af:signal_feature", Node())).c();
+        (Triple(Node(), expand("af:signal_feature"), Node())).objects();
 
     foreach (Node sf, sigFeatures) {
 
         if (sf.type != Node::URI && sf.type != Node::Blank) continue;
         
-        Node t = m_store->matchFirst(Triple(sf, "a", Node())).c;
-        Node v = m_store->matchFirst(Triple(sf, "af:value", Node())).c;
+        Node t = m_store->complete(Triple(sf, expand("a"), Node()));
+        Node v = m_store->complete(Triple(sf, expand("af:value"), Node()));
 
         QString feature = sf.value;
         QString type = t.value;
@@ -386,8 +387,8 @@
                                     QString featureUri,
                                     QString featureTypeUri)
 {
-    Node n = m_store->matchFirst
-        (Triple(Uri(featureUri), "dc:title", Node())).c;
+    Node n = m_store->complete
+        (Triple(Uri(featureUri), expand("dc:title"), Node()));
 
     if (n.type == Node::Literal && n.value != "") {
         SVDEBUG << "RDFImporterImpl::getDenseModelTitle: Title (from signal) \"" << n.value << "\"" << endl;
@@ -395,8 +396,8 @@
         return;
     }
 
-    n = m_store->matchFirst
-        (Triple(Uri(featureTypeUri), "dc:title", Node())).c;
+    n = m_store->complete
+        (Triple(Uri(featureTypeUri), expand("dc:title"), Node()));
 
     if (n.type == Node::Literal && n.value != "") {
         SVDEBUG << "RDFImporterImpl::getDenseModelTitle: Title (from signal type) \"" << n.value << "\"" << endl;
@@ -412,8 +413,8 @@
                                            int &sampleRate, int &windowLength,
                                            int &hopSize, int &width, int &height)
 {
-    Node dim = m_store->matchFirst
-        (Triple(Uri(featureUri), "af:dimensions", Node())).c;
+    Node dim = m_store->complete
+        (Triple(Uri(featureUri), expand("af:dimensions"), Node()));
 
     cerr << "Dimensions = \"" << dim.value << "\"" << endl;
 
@@ -434,15 +435,15 @@
     // ?map tl:hopSize ?hop .
     // ?map tl:windowLength ?window .
 
-    Node interval = m_store->matchFirst(Triple(Uri(featureUri), "mo:time", Node())).c;
+    Node interval = m_store->complete(Triple(Uri(featureUri), expand("mo:time"), Node()));
 
-    if (!m_store->contains(Triple(interval, "a", m_store->expand("tl:Interval")))) {
+    if (!m_store->contains(Triple(interval, expand("a"), expand("tl:Interval")))) {
         cerr << "RDFImporterImpl::getDenseFeatureProperties: Feature time node "
              << interval << " is not a tl:Interval" << endl;
         return;
     }
 
-    Node tl = m_store->matchFirst(Triple(interval, "tl:onTimeLine", Node())).c;
+    Node tl = m_store->complete(Triple(interval, expand("tl:onTimeLine"), Node()));
     
     if (tl == Node()) {
         cerr << "RDFImporterImpl::getDenseFeatureProperties: Interval node "
@@ -450,7 +451,7 @@
         return;
     }
 
-    Node map = m_store->matchFirst(Triple(Node(), "tl:rangeTimeLine", tl)).a;
+    Node map = m_store->complete(Triple(Node(), expand("tl:rangeTimeLine"), tl));
     
     if (map == Node()) {
         cerr << "RDFImporterImpl::getDenseFeatureProperties: No map for "
@@ -499,7 +500,7 @@
     */
 
     Nodes sigs = m_store->match
-        (Triple(Node(), "a", m_store->expand("mo:Signal"))).a();
+        (Triple(Node(), expand("a"), expand("mo:Signal"))).subjects();
 
     // Map from timeline uri to event type to dimensionality to
     // presence of duration to model ptr.  Whee!
@@ -508,24 +509,24 @@
 
     foreach (Node sig, sigs) {
         
-        Node interval = m_store->matchFirst(Triple(sig, "mo:time", Node())).c;
+        Node interval = m_store->complete(Triple(sig, expand("mo:time"), Node()));
         if (interval == Node()) continue;
 
-        Node tl = m_store->matchFirst(Triple(interval, "tl:onTimeLine", Node())).c;
+        Node tl = m_store->complete(Triple(interval, expand("tl:onTimeLine"), Node()));
         if (tl == Node()) continue;
 
-        Nodes times = m_store->match(Triple(Node(), "tl:onTimeLine", tl)).a();
+        Nodes times = m_store->match(Triple(Node(), expand("tl:onTimeLine"), tl)).subjects();
         
         foreach (Node tn, times) {
             
-            Nodes timedThings = m_store->match(Triple(Node(), "event:time", tn)).a();
+            Nodes timedThings = m_store->match(Triple(Node(), expand("event:time"), tn)).subjects();
 
             foreach (Node thing, timedThings) {
                 
-                Node typ = m_store->matchFirst(Triple(thing, "a", Node())).c;
+                Node typ = m_store->complete(Triple(thing, expand("a"), Node()));
                 if (typ == Node()) continue;
 
-                Node valu = m_store->matchFirst(Triple(thing, "af:feature", Node())).c;
+                Node valu = m_store->complete(Triple(thing, expand("af:feature"), Node()));
 
                 QString source = sig.value;
                 QString timeline = tl.value;
@@ -559,11 +560,11 @@
                 bool note = (type.contains("Note") || type.contains("note")); // Guffaw
 
                 if (text) {
-                    label = m_store->matchFirst(Triple(thing, "af:text", Node())).c.value;
+                    label = m_store->complete(Triple(thing, expand("af:text"), Node())).value;
                 }
                 
                 if (label == "") {
-                    label = m_store->matchFirst(Triple(thing, "rdfs:label", Node())).c.value;
+                    label = m_store->complete(Triple(thing, expand("rdfs:label"), Node())).value;
                 }
 
                 RealTime time;
@@ -572,7 +573,7 @@
                 bool haveTime = false;
                 bool haveDuration = false;
 
-                Node at = m_store->matchFirst(Triple(tn, "tl:at", Node())).c;
+                Node at = m_store->complete(Triple(tn, expand("tl:at"), Node()));
 
                 if (at != Node()) {
                     time = RealTime::fromXsdDuration(at.value.toStdString());
@@ -582,8 +583,8 @@
     // beginsAt -> start
     // onTimeLine -> timeline
 
-                    Node start = m_store->matchFirst(Triple(tn, "tl:beginsAt", Node())).c;
-                    Node dur = m_store->matchFirst(Triple(tn, "tl:duration", Node())).c;
+                    Node start = m_store->complete(Triple(tn, expand("tl:beginsAt"), Node()));
+                    Node dur = m_store->complete(Triple(tn, expand("tl:duration"), Node()));
                     if (start != Node() && dur != Node()) {
                         time = RealTime::fromXsdDuration
                             (start.value.toStdString());
@@ -663,8 +664,8 @@
                         model->setSourceModel(m_audioModelMap[source]);
                     }
 
-                    QString title = m_store->matchFirst
-                        (Triple(typ, "dc:title", Node())).a.value;
+                    QString title = m_store->complete
+                        (Triple(typ, expand("dc:title"), Node())).value;
                     if (title == "") {
                         // take it from the end of the event type
                         title = type;
@@ -806,7 +807,7 @@
     try {
         //!!! non-local document? + may throw!!!
         store = BasicStore::load(QUrl(url));
-        Triple t = store->matchFirst(Triple());
+        Triple t = store->matchOnce(Triple());
         if (t != Triple()) haveRDF = true;
     } catch (...) {
     }
@@ -822,7 +823,7 @@
 
     // "MO-conformant" structure for audio files
 
-    Node n = store->matchFirst(Triple(Node(), "a", store->expand("mo:AudioFile"))).a;
+    Node n = store->complete(Triple(Node(), Uri("a"), store->expand("mo:AudioFile")));
     if (n != Node() && n.type == Node::URI) {
 
         haveAudio = true;
@@ -833,9 +834,9 @@
         // (which is not properly in conformance with the Music
         // Ontology)
 
-        Nodes sigs = store->match(Triple(Node(), "a", store->expand("mo:Signal"))).a();
+        Nodes sigs = store->match(Triple(Node(), Uri("a"), store->expand("mo:Signal"))).subjects();
         foreach (Node sig, sigs) {
-            Node aa = store->matchFirst(Triple(sig, "mo:available_as", Node())).c;
+            Node aa = store->complete(Triple(sig, store->expand("mo:available_as"), Node()));
             if (aa != Node()) {
                 haveAudio = true;
                 break;
@@ -846,13 +847,13 @@
     SVDEBUG << "NOTE: RDFImporter::identifyDocumentType: haveAudio = "
               << haveAudio << endl;
 
-    n = store->matchFirst(Triple(Node(), "event:time", Node())).a;
+    n = store->complete(Triple(Node(), store->expand("event:time"), Node()));
     if (n != Node()) {
         haveAnnotations = true;
     }
 
     if (!haveAnnotations) {
-        n = store->matchFirst(Triple(Node(), "af:signal_feature", Node())).a;
+        n = store->complete(Triple(Node(), store->expand("af:signal_feature"), Node()));
         if (n != Node()) {
             haveAnnotations = true;
         }
--- a/rdf/RDFTransformFactory.cpp	Sat May 19 18:57:52 2012 +0100
+++ b/rdf/RDFTransformFactory.cpp	Mon May 21 14:33:35 2012 +0100
@@ -124,7 +124,13 @@
     //!!! retrieve data if remote... then
     m_store->addPrefix("vamp", Uri("http://purl.org/ontology/vamp/"));
     try {
-        m_store->import(QUrl::fromLocalFile(url), BasicStore::ImportIgnoreDuplicates);
+        QUrl qurl;
+        if (url.startsWith("file:")) {
+            qurl = QUrl(url);
+        } else {
+            qurl = QUrl::fromLocalFile(url);
+        }
+        m_store->import(qurl, BasicStore::ImportIgnoreDuplicates);
         m_isRDF = true;
     } catch (...) { }
 }
@@ -160,14 +166,14 @@
     std::map<QString, Transform> uriTransformMap;
 
     Nodes tnodes = m_store->match
-        (Triple(Node(), "a", m_store->expand("vamp:Transform"))).a();
+        (Triple(Node(), Uri("a"), m_store->expand("vamp:Transform"))).subjects();
 
     PluginRDFIndexer *indexer = PluginRDFIndexer::getInstance();
 
     foreach (Node tnode, tnodes) {
 
-        Node pnode = m_store->matchFirst
-            (Triple(tnode, "vamp:plugin", Node())).c;
+        Node pnode = m_store->complete
+            (Triple(tnode, m_store->expand("vamp:plugin"), Node()));
 
         if (pnode == Node()) {
             cerr << "RDFTransformFactory: WARNING: No vamp:plugin for "
@@ -216,8 +222,9 @@
 
             QString optional = optionals[j];
 
-            Node onode = m_store->matchFirst
-                (Triple(Uri(transformUri), optional, Node())).c;
+            Node onode = m_store->complete
+                (Triple(Uri(transformUri),
+                        m_store->expand(QString("vamp:") + optional), Node()));
 
             if (onode.type != Node::Literal) continue;
 
@@ -247,7 +254,7 @@
             }
         }
 
-        SVDEBUG << "RDFTransformFactory: NOTE: Transform is: " << endl;
+        cerr << "RDFTransformFactory: NOTE: Transform is: " << endl;
         cerr << transform.toXmlString() << endl;
 
         transforms.push_back(transform);
@@ -260,8 +267,8 @@
 RDFTransformFactoryImpl::setOutput(Transform &transform,
                                    QString transformUri)
 {
-    Node outputNode = m_store->matchFirst
-        (Triple(Uri(transformUri), "vamp:output", Node())).c;
+    Node outputNode = m_store->complete
+        (Triple(Uri(transformUri), m_store->expand("vamp:output"), Node()));
     
     if (outputNode == Node()) return true;
 
@@ -274,14 +281,14 @@
     // that tells us the vamp:identifier, or it might be the subject
     // of a triple within the indexer that tells us it
 
-    Node identNode = m_store->matchFirst
-        (Triple(outputNode, "vamp:identifier", Node())).c;
+    Node identNode = m_store->complete
+        (Triple(outputNode, m_store->expand("vamp:identifier"), Node()));
 
     if (identNode == Node()) {
         PluginRDFIndexer *indexer = PluginRDFIndexer::getInstance();
         const BasicStore *index = indexer->getIndex();
-        identNode = index->matchFirst
-            (Triple(outputNode, "vamp:identifier", Node())).c;
+        identNode = index->complete
+            (Triple(outputNode, index->expand("vamp:identifier"), Node()));
     }
 
     if (identNode == Node() || identNode.type != Node::Literal) {
@@ -300,30 +307,42 @@
                                        QString transformUri)
 {
     Nodes bindings = m_store->match
-        (Triple(Uri(transformUri), "vamp:parameter_binding", Node())).c();
+        (Triple(Uri(transformUri), m_store->expand("vamp:parameter_binding"), Node())).objects();
     
     foreach (Node binding, bindings) {
 
-        Node paramNode = m_store->matchFirst
-            (Triple(binding, "vamp:parameter", Node())).c;
+        Node paramNode = m_store->complete
+            (Triple(binding, m_store->expand("vamp:parameter"), Node()));
 
         if (paramNode == Node()) {
             cerr << "RDFTransformFactoryImpl::setParameters: No vamp:parameter for binding " << binding << endl;
             continue;
         }
 
-        Node valueNode = m_store->matchFirst
-            (Triple(binding, "vamp:value", Node())).c;
+        Node valueNode = m_store->complete
+            (Triple(binding, m_store->expand("vamp:value"), Node()));
 
         if (paramNode == Node()) {
             cerr << "RDFTransformFactoryImpl::setParameters: No vamp:value for binding " << binding << endl;
             continue;
         }
+        
+        // As with output above, paramNode might be the subject of a
+        // triple within m_store that tells us the vamp:identifier, or
+        // it might be the subject of a triple within the indexer that
+        // tells us it
 
-        Node idNode = m_store->matchFirst
-            (Triple(paramNode, "vamp:identifier", Node())).c;
-        
+        Node idNode = m_store->complete
+            (Triple(paramNode, m_store->expand("vamp:identifier"), Node()));
+
         if (idNode == Node()) {
+            PluginRDFIndexer *indexer = PluginRDFIndexer::getInstance();
+            const BasicStore *index = indexer->getIndex();
+            idNode = index->complete
+                (Triple(paramNode, index->expand("vamp:identifier"), Node()));
+        }
+
+        if (idNode == Node() || idNode.type != Node::Literal) {
             cerr << "RDFTransformFactoryImpl::setParameters: No vamp:identifier for parameter " << paramNode << endl;
             continue;
         }