Revision 52:e0e12bd2978d

View differences:

common/FeatureFileIndex.cpp
33 33
    }
34 34

  
35 35
    m_bs = new BasicStore;
36
    m_bs->setBaseUri(Uri(QUrl::fromLocalFile(m_indexFileName)));
37

  
36 38
    m_index = new TransactionalStore(m_bs);
37 39

  
38 40
    TypeRegistrar::addMappings(m_bs, 0);
......
104 106

  
105 107
    // and again with anything else having the same hash
106 108
    if (tf->hash() != "") {
107
        Triple pattern(Node(), "foaf:sha1", Node(Node::Literal, tf->hash()));
109
        Triple pattern(Node(), store->expand("foaf:sha1"), Node(tf->hash()));
108 110
        Triples results = m_index->match(pattern);
109 111
        std::cerr << "FeatureFileIndex::loadFor: " << results.size() << " audio file(s) found with hash " << tf->hash().toStdString() << std::endl;
110 112
        foreach (Triple t, results) {
......
127 129
    // hash is present in the feature file but does not match, then it
128 130
    // cannot be the right track even if the URI matches.
129 131

  
130
    Triple pattern(Node(), "foaf:primaryTopic", afuri);
132
    Triple pattern(Node(), store->expand("foaf:primaryTopic"), afuri);
131 133
    Triples results = m_index->match(pattern);
132 134
    std::cerr << "FeatureFileIndex::loadFor: " << results.size() << " feature file(s) for audio file " << afuri << std::endl;
133 135

  
......
137 139
        try {
138 140
            BasicStore *b = BasicStore::load(QUrl(t.a.value));
139 141
            Triples ts = b->match
140
                (Triple(afuri, "a", m_index->expand("mo:AudioFile")));
142
                (Triple(afuri, store->expand("a"), m_index->expand("mo:AudioFile")));
141 143
            std::cerr << "FeatureFileIndex::loadFor: feature file "
142 144
                      << t.a << " has " << ts.size() << " type node(s) for this audio file" << std::endl;
143 145
            bool someGood = false;
......
177 179
                // associating these facts with our own URI for this
178 180
                // file, even if they originated from a different URI
179 181
                // with the same hash)
180
                Node from = Node(Node::URI, afuri.toString());
181
                Node to = Node(Node::URI, canonicalUri.toString());
182
                Node from = Node(Uri(afuri.toString()));
183
                Node to = Node(Uri(canonicalUri.toString()));
182 184
                foreach (Triple t, all) {
183 185
                    if (t.a == from) t.a = to;
184 186
                    if (t.c == from) t.c = to;
......
235 237
void
236 238
FeatureFileIndex::index(QUrl fileUrl)
237 239
{
238
    Triple typeTriple(Uri(fileUrl), "a", m_index->expand("foaf:Document"));
240
    Triple typeTriple(Uri(fileUrl), m_index->expand("a"), m_index->expand("foaf:Document"));
239 241

  
240 242
    if (m_index->contains(typeTriple)) {
241 243
        return;
......
247 249
    try {
248 250
        BasicStore *b = BasicStore::load(fileUrl);
249 251
        Triples ts = b->match
250
            (Triple(Node(), "a", m_index->expand("mo:AudioFile")));
252
            (Triple(Node(), m_index->expand("a"), m_index->expand("mo:AudioFile")));
251 253
        foreach (Triple t, ts) {
252
            tx->add(Triple(Uri(fileUrl), "foaf:primaryTopic", t.a));;
254
            tx->add(Triple(Uri(fileUrl), m_index->expand("foaf:primaryTopic"), t.a));;
253 255
            Triples hashts = b->match
254 256
                (Triple(t.a, m_index->expand("foaf:sha1"), Node()));
255 257
            foreach (Triple hasht, hashts) {
common/Objects.cpp
2 2

  
3 3
#include "Objects.h"
4 4

  
5
#include <dataquay/Debug.h>
5
//#include <dataquay/Debug.h>
6 6

  
7 7
#include <cstdlib>
8 8
#include <iostream>
......
274 274
        }
275 275
    }
276 276
    if (surnameMatch != "") {
277
        DEBUG << "namesFuzzyMatch: note: surnameMatch = " << surnameMatch << endl;
277
//        DEBUG << "namesFuzzyMatch: note: surnameMatch = " << surnameMatch << endl;
278 278
        if (matchCount > 1) {
279 279
            return true;
280 280
        } else {
281
            DEBUG << "(but not enough else matched)" << endl;
281
//            DEBUG << "(but not enough else matched)" << endl;
282 282
            return false;
283 283
        }
284 284
    }
......
838 838
        f.open(QIODevice::ReadOnly);
839 839
        //!!! stream this!
840 840
        QByteArray ba = f.readAll();
841
        m_hash = QString::fromAscii
841
        m_hash = QString::fromLatin1
842 842
            (QCryptographicHash::hash(ba, QCryptographicHash::Sha1).toHex());
843 843
    }
844 844
    QString location = source.getLocation();
common/TypeRegistrar.cpp
152 152
	store->addPrefix("property", mapping->getPropertyPrefix());
153 153
	store->addPrefix("rel", mapping->getRelationshipPrefix());
154 154

  
155
	store->add(Triple("classical:Composer", "a", store->expand("owl:Class")));
156
	store->add(Triple("classical:Composer", "rdfs:subClassOf", store->expand("mo:MusicArtist")));
155
	store->add(Triple(store->expand("classical:Composer"), store->expand("a"), store->expand("owl:Class")));
156
	store->add(Triple(store->expand("classical:Composer"), store->expand("rdfs:subClassOf"), store->expand("mo:MusicArtist")));
157 157

  
158
	store->add(Triple("property:birth", "a", store->expand("owl:ObjectProperty")));
159
	store->add(Triple("property:birth", "rdfs:subPropertyOf", store->expand("bio:event")));
158
	store->add(Triple(store->expand("property:birth"), store->expand("a"), store->expand("owl:ObjectProperty")));
159
	store->add(Triple(store->expand("property:birth"), store->expand("rdfs:subPropertyOf"), store->expand("bio:event")));
160 160

  
161
	store->add(Triple("property:death", "a", store->expand("owl:ObjectProperty")));
162
	store->add(Triple("property:death", "rdfs:subPropertyOf", store->expand("bio:event")));
161
	store->add(Triple(store->expand("property:death"), store->expand("a"), store->expand("owl:ObjectProperty")));
162
	store->add(Triple(store->expand("property:death"), store->expand("rdfs:subPropertyOf"), store->expand("bio:event")));
163 163

  
164 164
	mapping->addTypeMapping("ClassicalData::Composer", store->expand("classical:Composer"));
165 165
	mapping->addPropertyMapping("ClassicalData::Composer", "pages", store->expand("foaf:page"));
common/common.pro
1 1
TEMPLATE = lib
2
TARGET = 
2
TARGET = common
3 3

  
4
CONFIG += staticlib
4
QT += network
5

  
6
CONFIG += staticlib debug
5 7

  
6 8
HEADERS += EditDistance.h Objects.h Matcher.h TypeRegistrar.h FeatureFileIndex.h
7 9
SOURCES += EditDistance.cpp Objects.cpp Matcher.cpp TypeRegistrar.cpp FeatureFileIndex.cpp
8 10

  
11
INCLUDEPATH += ../../dataquay
12
INCLUDEPATH += ../../sonic-visualiser/svcore
13

  
9 14
exists(./platform.pri) {
10 15
    include(./platform.pri)
11 16
}
utilities/track/track.cpp
10 10
#include <dataquay/objectmapper/ObjectStorer.h>
11 11
#include <dataquay/objectmapper/ObjectMapper.h>
12 12
#include <dataquay/objectmapper/TypeMapping.h>
13
#include <dataquay/Debug.h>
14 13

  
15 14
#include "data/fileio/AudioFileReaderFactory.h"
16 15
#include "data/fileio/AudioFileReader.h"
......
31 30
using namespace Vamp;
32 31
using namespace Vamp::HostExt;
33 32

  
33
/*
34 34
ostream &operator<<(ostream &target, const QString &str)
35 35
{
36 36
    return target << str.toLocal8Bit().data();
......
40 40
{
41 41
    return target << "<" << u.toString() << ">";
42 42
}
43

  
43
*/
44 44

  
45 45
bool
46 46
load(BasicStore *store, QString fileName)
......
706 706
    }
707 707

  
708 708
    BasicStore localStore;
709
    localStore.setBaseUri(store->getBaseUri());
709 710
    TypeRegistrar::addMappings(&localStore, &tm);
710 711

  
711 712
    ObjectStorer *localStorer = new ObjectStorer(&localStore);
utilities/track/track.pro
2 2
TARGET = track
3 3
#QT -= gui network xml
4 4

  
5
load(../../../all.prf)
5
QT += network
6

  
7
CONFIG += debug
6 8

  
7 9
SOURCES += track.cpp
8 10

  
9 11
PRE_TARGETDEPS += ../../common/libcommon.a
10 12

  
11
INCLUDEPATH += ../../common ../../../svcore
13
INCLUDEPATH += ../../common ../../../dataquay ../../../sonic-visualiser/svcore
12 14

  
13
LIBS += ../../common/libcommon.a -L../../../svcore -lsvcore ../../../../dataquay/libdataquay.a 
15
LIBS += ../../common/libcommon.a -L../../../sonic-visualiser/svcore -lsvcore ../../../dataquay/libdataquay.a -lsndfile -lsamplerate -lid3tag -lmad -I/usr/include/sord-0 -I/usr/include/serd-0 -lsord-0 -lserd-0 -lvamp-hostsdk
14 16

  
17

  
widgets/widgets.pro
1 1
TEMPLATE = lib
2
TARGET = 
2
TARGET = widgets
3 3

  
4
load(../../all.prf)
4
QT += gui widgets network
5 5

  
6 6
CONFIG += staticlib
7 7

  
8 8
INCLUDEPATH += ../common
9 9

  
10
DEPENDPATH += ../../svcore
11
INCLUDEPATH += ../../svcore
10
DEPENDPATH += ../../dataquay ../../sonic-visualiser/svcore
11
INCLUDEPATH += ../../dataquay ../../sonic-visualiser/svcore
12 12

  
13 13
HEADERS += TypingSelectWidget.h
14 14
SOURCES += TypingSelectWidget.cpp

Also available in: Unified diff