public void InsertHashDataForTrack(IEnumerable<HashedFingerprint> hashes, IModelReference trackReference)
 {
     foreach (var hashedFingerprint in hashes)
     {
         InsertSubFingerprint(hashedFingerprint, trackReference);
     }
 }
 public SubFingerprintData ReadSubFingerprint(IModelReference subFingerprintReference)
 {
     return(GetCollection <SubFingerprint>(SubFingerprints).AsQueryable()
            .Where(s => s.Id.Equals(subFingerprintReference.Id))
            .Select(s => new SubFingerprintData(s.Signature, new MongoModelReference(s.Id), new MongoModelReference(s.TrackId)))
            .FirstOrDefault());
 }
Ejemplo n.º 3
0
        public IList<HashData> ReadHashDataByTrackReference(IModelReference trackReference)
        {
            var hashes = GetCollection<Hash>(HashBins)
                                .AsQueryable()
                                .Where(hash => hash.TrackId.Equals(trackReference.Id))
                                .ToList();

            var subFingerprintIds = hashes.GroupBy(hash => hash.SubFingerprintId).Select(g => g.Key);

            var hashDatas = new List<HashData>();
            foreach (var subfingerprintId in subFingerprintIds)
            {
                var hashBins = hashes.Where(hash => hash.SubFingerprintId.Equals(subfingerprintId))
                                     .OrderBy(hash => hash.HashTable)
                                     .Select(hash => hash.HashBin)
                                     .ToArray();

                var subFingerprint = GetCollection<SubFingerprint>(SubFingerprintDao.SubFingerprints)
                                                        .AsQueryable()
                                                        .First(s => s.Id.Equals(subfingerprintId));

                hashDatas.Add(new HashData(subFingerprint.Signature, hashBins));
            }

            return hashDatas;
        }
Ejemplo n.º 4
0
 public TrackData ReadTrack(IModelReference trackReference)
 {
     return(PrepareStoredProcedure(SpReadTrackById)
            .WithParameter("Id", trackReference.Id, DbType.Int32)
            .Execute()
            .AsComplexModel(trackReferenceReader));
 }
Ejemplo n.º 5
0
        public IList <HashData> ReadHashDataByTrackReference(IModelReference trackReference)
        {
            var hashes = GetCollection <Hash>(HashBins)
                         .AsQueryable()
                         .Where(hash => hash.TrackId.Equals(trackReference.Id))
                         .ToList();

            var subFingerprintIds = hashes.GroupBy(hash => hash.SubFingerprintId).Select(g => g.Key);

            var hashDatas = new List <HashData>();

            foreach (var subfingerprintId in subFingerprintIds)
            {
                var hashBins = hashes.Where(hash => hash.SubFingerprintId.Equals(subfingerprintId))
                               .OrderBy(hash => hash.HashTable)
                               .Select(hash => hash.HashBin)
                               .ToArray();

                var subFingerprint = GetCollection <SubFingerprint>(SubFingerprintDao.SubFingerprints)
                                     .AsQueryable()
                                     .First(s => s.Id.Equals(subfingerprintId));

                hashDatas.Add(new HashData(subFingerprint.Signature, hashBins));
            }

            return(hashDatas);
        }
Ejemplo n.º 6
0
 public int DeleteTrack(IModelReference trackReference)
 {
     return(PrepareStoredProcedure(SpDeleteTrack)
            .WithParameter("Id", trackReference.Id, DbType.Int32)
            .Execute()
            .AsNonQuery());
 }
 public SpectralImageData(float[] image, int orderNumber, IModelReference trackReference)
     : this()
 {
     Image = image;
     TrackReference = trackReference;
     OrderNumber = orderNumber;
 }
 public SubFingerprintData ReadSubFingerprint(IModelReference subFingerprintReference)
 {
     return GetCollection<SubFingerprint>(SubFingerprints).AsQueryable()
                      .Where(s => s.Id.Equals(subFingerprintReference.Id))
                      .Select(s => new SubFingerprintData(s.Signature, new MongoModelReference(s.Id), new MongoModelReference(s.TrackId)))
                      .FirstOrDefault();
 }
Ejemplo n.º 9
0
        public TrackData ReadTrackByReference(IModelReference trackReference)
        {
            var track = _context.Track
                        .Single(t => t.Id == (int)trackReference.Id);

            return(CopyToTrackData(track));
        }
Ejemplo n.º 10
0
        public int DeleteSubFingerprintsByTrackReference(IModelReference trackReference)
        {
            using var tx = databaseContext.OpenReadWriteTransaction();
            try
            {
                var count   = 0;
                var trackId = trackReference.Get <ulong>();

                foreach (var subFingerprint in tx.GetSubFingerprintsForTrack(trackId))
                {
                    // Remove hashes from hashTable
                    var table = 0;
                    foreach (var hash in subFingerprint.Hashes)
                    {
                        tx.RemoveSubFingerprintsByHashTableAndHash(table, hash, subFingerprint.SubFingerprintReference);
                        count++;
                        table++;
                    }

                    tx.RemoveSubFingerprint(subFingerprint);
                    count++;
                }
                tx.Commit();
                return(count);
            }
            catch (Exception)
            {
                tx.Abort();
                throw;
            }
        }
Ejemplo n.º 11
0
 public int DeleteTrack(IModelReference trackReference)
 {
     return PrepareStoredProcedure(SpDeleteTrack)
                 .WithParameter("Id", trackReference.Id, DbType.Int32)
                 .Execute()
                 .AsNonQuery();
 }
Ejemplo n.º 12
0
 public TrackData ReadTrack(IModelReference trackReference)
 {
     return PrepareStoredProcedure(SpReadTrackById)
                 .WithParameter("Id", trackReference.Id, DbType.Int32)
                 .Execute()
                 .AsComplexModel(trackReferenceReader);
 }
Ejemplo n.º 13
0
        public int DeleteTrack(IModelReference trackReference)
        {
            int count   = 0;
            int trackId = (int)trackReference.Id;

            if (Tracks.Remove(trackId))
            {
                count++;
                var subFingerprintReferences = SubFingerprints
                                               .Where(pair => pair.Value.TrackReference.Equals(trackReference)).Select(pair => pair.Key).ToList();

                count += subFingerprintReferences.Count;
                foreach (var subFingerprintReference in subFingerprintReferences)
                {
                    SubFingerprints.Remove(subFingerprintReference);
                }

                foreach (var hashTable in HashTables)
                {
                    foreach (var hashBins in hashTable)
                    {
                        foreach (var subFingerprintReference in subFingerprintReferences)
                        {
                            if (hashBins.Value.Remove(subFingerprintReference))
                            {
                                count++;
                            }
                        }
                    }
                }
            }

            return(count);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Finds the by id.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <param name="context">The context. If context is null, look inside all registered assemblies</param>
        /// <returns></returns>
        public IModelReference FindById(string id)
        {
            IModelReference refFound = null;

            _mapIdToModelElement.TryGetValue(id, out refFound);
            return(refFound);
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Stores the fingerprints of the given file into the ModelService.
        /// Uses HighPrecisionFingerprintConfiguration.
        /// </summary>
        /// <param name="waveFile"></param>
        private void StoreNewAudioFileData(IAudioFile waveFile)
        {
            TrackData track = new TrackData(
                isrc: "TD100INPROG", // International Standart Recording Code.
                artist: "The TD's",
                title: waveFile.FilePath.NameWithoutExtension,
                album: waveFile.FilePath.DirectoryPath,
                releaseYear: DateTime.Today.Year,
                length: waveFile.DurationInSeconds);

            // Stores track metadata in the datasource.
            //TRack trackReference = new TrackReference<int>(mModelService.InsertTrack(track).Id);
            IModelReference      trackReference  = mModelService.InsertTrack(track);
            ModelReference <int> trackReference2 = trackReference as ModelReference <int>;

            // Creates hashed fingerprints.
            List <HashedFingerprint> hashedFingerprints = FingerprintCommandBuilder.Instance
                                                          .BuildFingerprintCommand()
                                                          .From(waveFile.FilePath.FileFullPath)
                                                          .WithFingerprintConfig(new DefaultFingerprintConfiguration())
                                                          .UsingServices(mAudioService)
                                                          .Hash()
                                                          .Result;

            // Stores hashes in the database.
            //SaveFingerPrintsInMemory(hashedFingerprints, trackReference2, waveFile.FilePath.NameWithoutExtension); // Currenntly not using fp.
            mModelService.InsertHashDataForTrack(hashedFingerprints, trackReference);
            mLogger.WriteLine($"Stored {hashedFingerprints.Count} hashed fingerprints from {waveFile.FilePath.Name}");
        }
Ejemplo n.º 16
0
        public void AddSpectralImages(IEnumerable <float[]> spectralImages, IModelReference trackReference)
        {
            int orderNumber = 0;
            var dtos        = spectralImages.Select(spectralImage => new SpectralImageData(
                                                        spectralImage,
                                                        orderNumber++,
                                                        new ModelReference <ulong>((ulong)Interlocked.Increment(ref spectralImagesCounter)),
                                                        trackReference))
                              .ToList();

            lock (SpectralImages)
            {
                if (SpectralImages.TryGetValue(trackReference, out var existing))
                {
                    foreach (var dto in dtos)
                    {
                        existing.Add(dto);
                    }
                }
                else
                {
                    SpectralImages[trackReference] = dtos;
                }
            }
        }
Ejemplo n.º 17
0
 public Candidates(IModelReference trackReference, params MatchedWith[] candidates)
 {
     foreach (var candidate in candidates)
     {
         AddOrUpdateNewMatch(trackReference, candidate);
     }
 }
Ejemplo n.º 18
0
 public int DeleteTrack(IModelReference trackReference)
 {
     int subIds = this.DeleteSubFingerprintsForTrack(trackReference);
     this.solrForTracksCore.Delete(SolrModelReference.GetId(trackReference));
     this.solrForTracksCore.Commit();
     return 1 + subIds;
 }
Ejemplo n.º 19
0
 public void InsertHashDataForTrack(IEnumerable <HashedFingerprint> hashes, IModelReference trackReference)
 {
     foreach (var hashedFingerprint in hashes)
     {
         storage.AddSubfingerprint(hashedFingerprint, trackReference);
     }
 }
 private void InsertHashDataForTrack(IEnumerable <HashData> hashData, IModelReference trackReference)
 {
     foreach (var hash in hashData)
     {
         var subFingerprintId = SubFingerprintDao.InsertSubFingerprint(hash.SubFingerprint, trackReference);
         HashBinDao.InsertHashBins(hash.HashBins, subFingerprintId, trackReference);
     }
 }
 public SubFingerprintData(byte[] signature, int sequenceNumber, double sequenceAt, IModelReference subFingerprintReference, IModelReference trackReference)
 {
     Signature = signature;
     SubFingerprintReference = subFingerprintReference;
     TrackReference = trackReference;
     SequenceNumber = sequenceNumber;
     SequenceAt = sequenceAt;
 }
Ejemplo n.º 22
0
 public ModelReferenceInfo(IModelReference target,
                           ModelReferencePosition targetType, string path, string expression)
 {
     Target     = target;
     TargetType = targetType;
     Path       = path;
     Expression = expression;
 }
Ejemplo n.º 23
0
        public void InsertHashDataForTrack(IEnumerable <HashedFingerprint> hashes, IModelReference trackReference)
        {
            var dtos = hashes.Select(hash => GetSubFingerprintDto(trackReference, hash))
                       .ToList();

            solr.AddRange(dtos);
            solr.Commit();
        }
Ejemplo n.º 24
0
        public void InsertHashDataForTrack(IEnumerable <HashedFingerprint> hashes, IModelReference trackReference)
        {
            var subFingerprints = hashes.Select(hash => CopyToSubFingerprint(trackReference, hash))
                                  .ToList();

            _context.SubFingerprint.AddRange(subFingerprints);
            _context.SaveChanges();
        }
Ejemplo n.º 25
0
 public void InsertHashDataForTrack(IEnumerable <HashedFingerprint> hashes, IModelReference trackReference)
 {
     foreach (var hashData in hashes)
     {
         var subFingerprintReference = subFingerprintDao.InsertSubFingerprint(hashData.SubFingerprint, hashData.SequenceNumber, hashData.Timestamp, trackReference);
         hashBinDao.InsertHashBins(hashData.HashBins, subFingerprintReference, trackReference);
     }
 }
 public SubFingerprintData(byte[] signature, int sequenceNumber, double sequenceAt, IModelReference subFingerprintReference, IModelReference trackReference)
 {
     Signature = signature;
     SubFingerprintReference = subFingerprintReference;
     TrackReference          = trackReference;
     SequenceNumber          = sequenceNumber;
     SequenceAt = sequenceAt;
 }
Ejemplo n.º 27
0
        public int DeleteTrack(IModelReference trackReference)
        {
            int subIds = this.DeleteSubFingerprintsForTrack(trackReference);

            this.solrForTracksCore.Delete(SolrModelReference.GetId(trackReference));
            this.solrForTracksCore.Commit();
            return(1 + subIds);
        }
Ejemplo n.º 28
0
        public TrackData ReadTrack(IModelReference trackReference)
        {
            var trackId = SolrModelReference.GetId(trackReference);
            var query = new SolrQuery(string.Format("trackId:{0}", trackId));

            var results = this.solrForTracksCore.Query(query);
            return FirstFromResultSet(results);
        }
Ejemplo n.º 29
0
 public void InsertHashDataForTrack(IEnumerable<HashData> hashes, IModelReference trackReference)
 {
     foreach (var hashData in hashes)
     {
         var subFingerprintReference = subFingerprintDao.InsertSubFingerprint(hashData.SubFingerprint, trackReference);
         hashBinDao.InsertHashBins(hashData.HashBins, subFingerprintReference, trackReference);
     }
 }
Ejemplo n.º 30
0
 public SubFingerprintData(long[] hashes, int sequenceNumber, double sequenceAt, IModelReference subFingerprintReference, IModelReference trackReference) : this()
 {
     Hashes = hashes;
     SubFingerprintReference = subFingerprintReference;
     TrackReference          = trackReference;
     SequenceNumber          = sequenceNumber;
     SequenceAt = sequenceAt;
 }
Ejemplo n.º 31
0
        public IEnumerable <SpectralImageData> GetSpectralImagesByTrackReference(IModelReference trackReference)
        {
            if (SpectralImages.TryGetValue(trackReference, out var spectralImageDatas))
            {
                return(spectralImageDatas);
            }

            return(Enumerable.Empty <SpectralImageData>().ToList());
        }
        public IEnumerable <SpectralImageData> GetSpectralImagesByTrackReference(IModelReference trackReference)
        {
            if (ramStorage.SpectralImages.ContainsKey(trackReference))
            {
                return(ramStorage.SpectralImages[trackReference]);
            }

            return(Enumerable.Empty <SpectralImageData>());
        }
Ejemplo n.º 33
0
        public IList<FingerprintData> ReadFingerprintsByTrackReference(IModelReference trackReference)
        {
            if (storage.Fingerprints.ContainsKey(trackReference))
            {
                return storage.Fingerprints[trackReference];
            }

            return Enumerable.Empty<FingerprintData>().ToList();
        }
Ejemplo n.º 34
0
        public SubFingerprintData ReadSubFingerprint(IModelReference subFingerprintReference)
        {
            if (storage.SubFingerprints.ContainsKey(subFingerprintReference))
            {
                return storage.SubFingerprints[subFingerprintReference];
            }

            return null;
        }
Ejemplo n.º 35
0
 public DeliveryQueue(
     IQueue queue,
     IModelReference modelReference,
     ISubscriptionFailureStrategy subscriptionFailureStrategy)
 {
     this.queue = queue;
     this.modelReference = modelReference;
     this.subscriptionFailureStrategy = subscriptionFailureStrategy;
 }
Ejemplo n.º 36
0
        public int GetHammingSimilaritySumForTrack(IModelReference trackReference)
        {
            if (similaritySumPerTrack.TryGetValue(trackReference, out int sum))
            {
                return(sum);
            }

            return(0);
        }
Ejemplo n.º 37
0
        public TrackData ReadTrack(IModelReference trackReference)
        {
            var trackId = SolrModelReference.GetId(trackReference);
            var query   = new SolrQuery(string.Format("trackId:{0}", trackId));

            var results = this.solrForTracksCore.Query(query);

            return(FirstFromResultSet(results));
        }
Ejemplo n.º 38
0
        public TrackData ReadTrack(IModelReference trackReference)
        {
            if (storage.Tracks.ContainsKey(trackReference))
            {
                return storage.Tracks[trackReference];
            }

            return null;
        }
Ejemplo n.º 39
0
 public CompoundModelReference(T prefix, IModelReference reference)
 {
     if (prefix == null)
     {
         throw new ArgumentNullException(nameof(prefix));
     }
     Prefix    = prefix;
     Reference = reference ?? throw new ArgumentNullException(nameof(reference));
 }
Ejemplo n.º 40
0
        public IList <HashedFingerprint> ReadHashedFingerprintsByTrackReference(IModelReference trackReference)
        {
            if (storage.TracksHashes.ContainsKey(trackReference))
            {
                return(storage.TracksHashes[trackReference].Values.ToList());
            }

            return(Enumerable.Empty <HashedFingerprint>().ToList());
        }
Ejemplo n.º 41
0
 internal TrackDataDTO(TrackInfo trackInfo, double duration, IModelReference modelReference)
 {
     Id             = trackInfo.Id;
     Artist         = trackInfo.Artist;
     Title          = trackInfo.Title;
     Length         = duration;
     TrackReference = modelReference.Get <ulong>();
     MetaFields     = trackInfo.MetaFields;
 }
Ejemplo n.º 42
0
 internal SubFingerprintDataDTO(int[] hashes, uint sequenceNumber, float sequenceAt,
                                IModelReference subFingerprintReference, IModelReference trackReference) : this()
 {
     Hashes = hashes;
     SubFingerprintReference = (ulong)subFingerprintReference.Id;
     TrackReference          = (ulong)trackReference.Id;
     SequenceNumber          = sequenceNumber;
     SequenceAt = sequenceAt;
 }
Ejemplo n.º 43
0
        public double GetScoreSumForTrack(IModelReference trackReference)
        {
            if (scoreSumPerTrack.TryGetValue(trackReference, out double scoreSum))
            {
                return(scoreSum);
            }

            return(0);
        }
Ejemplo n.º 44
0
        public IList<HashedFingerprint> ReadHashedFingerprintsByTrackReference(IModelReference trackReference)
        {
            if (storage.TracksHashes.ContainsKey(trackReference))
            {
                return storage.TracksHashes[trackReference].Values.ToList();
            }

            return Enumerable.Empty<HashedFingerprint>().ToList();
        }
Ejemplo n.º 45
0
        public TrackData ReadTrack(IModelReference trackReference)
        {
            if (storage.Tracks.ContainsKey(trackReference))
            {
                return(storage.Tracks[trackReference]);
            }

            return(null);
        }
 public IModelReference InsertSubFingerprint(byte[] signature, IModelReference trackReference)
 {
     var subFingerprint = new SubFingerprint
         {
             Signature = signature, TrackId = (ObjectId)trackReference.Id
         };
     GetCollection<SubFingerprint>(SubFingerprints).Insert(subFingerprint);
     return new MongoModelReference(subFingerprint.Id);
 }
        public IEnumerable<SpectralImageData> GetSpectralImagesByTrackReference(IModelReference trackReference)
        {
            if (ramStorage.SpectralImages.ContainsKey(trackReference))
            {
                return ramStorage.SpectralImages[trackReference];
            }

            return Enumerable.Empty<SpectralImageData>();
        }
 public SubFingerprintData(long[] hashes, int sequenceNumber, double sequenceAt, IModelReference subFingerprintReference, IModelReference trackReference)
     : this()
 {
     Hashes = hashes;
     SubFingerprintReference = subFingerprintReference;
     TrackReference = trackReference;
     SequenceNumber = sequenceNumber;
     SequenceAt = sequenceAt;
 }
Ejemplo n.º 49
0
 public IList<FingerprintData> ReadFingerprintsByTrackReference(IModelReference trackReference)
 {
     return GetCollection<Fingerprint>(Fingerprints).AsQueryable()
                                       .Where(fingerprint => fingerprint.TrackId.Equals(trackReference.Id))
                                       .Select(fingerprint => new FingerprintData(fingerprint.Signature, new MongoModelReference(fingerprint.TrackId))
                                           {
                                               FingerprintReference = new MongoModelReference(fingerprint.Id)
                                           })
                                       .ToList();
 }
        public IModelReference InsertSubFingerprint(byte[] signature, IModelReference trackReference)
        {
            long subFingerprintId = PrepareStoredProcedure(SpInsertSubFingerprint)
                                .WithParameter("Signature", signature)
                                .WithParameter("TrackId", trackReference.Id, DbType.Int32)
                                .Execute()
                                .AsScalar<long>();

            return new ModelReference<long>(subFingerprintId);
        }
 public SubFingerprintData ReadSubFingerprint(IModelReference subFingerprintReference)
 {
     return PrepareStoredProcedure(SpReadSubFingerprintById)
                 .WithParameter("Id", subFingerprintReference.Id, DbType.Int64)
                 .Execute()
                 .AsComplexModel<SubFingerprintData>((item, reader) =>
                     {
                         item.SubFingerprintReference = new ModelReference<long>(reader.GetInt64("Id"));
                         item.TrackReference = new ModelReference<int>(reader.GetInt32("TrackId"));
                     });
 }
        public IModelReference InsertSubFingerprint(byte[] signature, IModelReference trackReference)
        {
            var subFingerprintReference = new ModelReference<long>(Interlocked.Increment(ref counter));
            storage.SubFingerprints[subFingerprintReference] = new SubFingerprintData(signature, subFingerprintReference, trackReference);
            if (!storage.TracksHashes.ContainsKey(trackReference))
            {
                storage.TracksHashes[trackReference] = new ConcurrentDictionary<IModelReference, HashData>();
            }

            storage.TracksHashes[trackReference][subFingerprintReference] = new HashData { SubFingerprint = signature };
            return subFingerprintReference;
        }
Ejemplo n.º 53
0
        public IModelReference InsertSubFingerprint(byte[] signature, int sequenceNumber, double sequenceAt, IModelReference trackReference)
        {
            var subFingerprintReference = new ModelReference<long>(Interlocked.Increment(ref counter));
            storage.SubFingerprints[subFingerprintReference] = new SubFingerprintData(signature, sequenceNumber, sequenceAt, subFingerprintReference, trackReference);
            if (!storage.TracksHashes.ContainsKey(trackReference))
            {
                storage.TracksHashes[trackReference] = new ConcurrentDictionary<IModelReference, HashedFingerprint>();
            }

            storage.TracksHashes[trackReference][subFingerprintReference] = new HashedFingerprint(signature, null, sequenceNumber, sequenceAt);
            return subFingerprintReference;
        }
Ejemplo n.º 54
0
        public int DeleteTrack(IModelReference trackReference)
        {
            var deleteTracksResult = DeleteTracks(trackReference);
            var deleteSubFingerprintsResult = DeleteSubFingerprints(trackReference);
            var deleteHashResult = DeleteHashBins(trackReference);
            var deleteFingerprintsResult = DeleteFingerprints(trackReference);

            return
                (int)
                (deleteTracksResult.DocumentsAffected + deleteSubFingerprintsResult.DocumentsAffected
                 + deleteHashResult.DocumentsAffected + deleteFingerprintsResult.DocumentsAffected);
        }
Ejemplo n.º 55
0
        public Subscription(
            string name,
            IModelReference modelReference,
            IDeliveryStrategy deliveryStrategy,
            IDeliveryQueue[] queues)
        {
            this.modelReference = modelReference;
            this.deliveryStrategy = deliveryStrategy;

            Name = name;
            Queues = queues;
        }
 public void InsertHashBins(long[] hashBins, IModelReference subFingerprintReference, IModelReference trackReference)
 {
     var hashTables = dictionaryToHashConverter.FromHashes(hashBins);
     solr.Add(
         new SubFingerprintDTO
             {
                 SubFingerprintId = SolrModelReference.GetId(subFingerprintReference),
                 Hashes = hashTables,
                 TrackId = SolrModelReference.GetId(trackReference)
             });
     solr.Commit();
 }
Ejemplo n.º 57
0
 public TrackData(
     string isrc,
     string artist,
     string title,
     string album,
     int releaseYear,
     double length,
     IModelReference trackReference)
     : this(isrc, artist, title, album, releaseYear, length)
 {
     TrackReference = trackReference;
 }
Ejemplo n.º 58
0
 /// <summary>
 /// Initializes a new instance of the <see cref="NTopic"/> class.
 /// </summary>
 /// <param name="reference">The reference.</param>
 public NTopic(IModelReference reference)
 {
     SubTopics = new List<NTopic>();
     Resources = new List<string>();
     Excludes = new List<string>();
     Id = reference.Id;
     Index = reference.Index;
     PageId = reference.PageId;
     PageTitle = reference.PageTitle;
     Name = reference.Name;
     FullName = reference.FullName;
     Category = reference.Category;
 }
Ejemplo n.º 59
0
        public void InsertHashBins(long[] hashBins, IModelReference subFingerprintReference, IModelReference trackReference)
        {
            StringBuilder sqlToExecute = new StringBuilder();
            for (int hashTable = 0; hashTable < hashBins.Length; hashTable++)
            {
                sqlToExecute.Append("INSERT INTO HashTable_" + (hashTable + 1) + "(HashBin, SubFingerprintId) VALUES(" + hashBins[hashTable] + "," + subFingerprintReference.Id + ");");
                if (hashBins.Length > hashTable + 1)
                {
                    sqlToExecute.Append("\n\r");
                }
            }

            PrepareSQLText(sqlToExecute.ToString()).AsNonQuery();
        }
Ejemplo n.º 60
0
        public void InsertHashBins(long[] hashBins, IModelReference subFingerprintReference, IModelReference trackReference)
        {
            var hashes = new List<Hash>();
            for (int hashtable = 1; hashtable <= hashBins.Length; hashtable++)
            {
                var hash = new Hash
                    {
                        HashTable = hashtable,
                        HashBin = hashBins[hashtable - 1],
                        SubFingerprintId = (ObjectId)subFingerprintReference.Id,
                        TrackId = (ObjectId)trackReference.Id
                    };
                hashes.Add(hash);
            }

            GetCollection<Hash>(HashBins).InsertBatch(hashes);
        }