Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup: Removing ADAMpro dependencies, unused Code #278

Merged
merged 11 commits into from
Mar 14, 2022
22 changes: 0 additions & 22 deletions .travis.yml

This file was deleted.

4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ subprojects {
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-core', version: version_jackson
implementation group: 'com.fasterxml.jackson.core', name: 'jackson-databind', version: version_jackson

/** Protobuf */
implementation group: 'io.grpc', name: 'grpc-stub', version: '1.45.0'
implementation group: 'io.grpc', name: 'grpc-netty', version: '1.45.0'

/** Test dependencies (JUnit 5) */
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: version_junit
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: version_junit
Expand Down
2 changes: 2 additions & 0 deletions cineast-api/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ dependencies {
implementation group: 'com.fasterxml.jackson.module', name: 'jackson-module-kotlin', version: version_jackson
implementation group: 'de.svenkubiak', name: 'jBCrypt', version: version_jbcrypt
implementation group: 'org.vitrivr', name: 'cineast-proto', version: version_cineast_proto
implementation group: 'it.unimi.dsi', name: 'fastutil', version: '8.5.8'

}


Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ public void getSimilar(CineastGrpc.TemporalQuery query, StreamObserver<CineastGr
continue;
}

Map<String, MediaSegmentDescriptor> segments = mediaSegmentReader.lookUpSegments(segmentIds);
Map<String, MediaSegmentDescriptor> segments = mediaSegmentReader.lookUpSegments(segmentIds, uuid);

responseObserver.onNext(
QueryContainerUtil.queryResult(
Expand All @@ -261,7 +261,7 @@ public void getSimilar(CineastGrpc.TemporalQuery query, StreamObserver<CineastGr
if (objectIds.isEmpty()) {
continue;
}
Map<String, MediaObjectDescriptor> objects = mediaObjectReader.lookUpObjects(objectIds);
Map<String, MediaObjectDescriptor> objects = mediaObjectReader.lookUpObjects(objectIds, uuid);

responseObserver.onNext(
QueryContainerUtil.queryResult(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import org.vitrivr.cineast.core.data.query.containers.InstantQueryTermContainer;
import org.vitrivr.cineast.core.data.query.containers.LocationQueryTermContainer;
import org.vitrivr.cineast.core.data.query.containers.ModelQueryTermContainer;
import org.vitrivr.cineast.core.data.query.containers.MotionQueryTermContainer;
import org.vitrivr.cineast.core.data.query.containers.SemanticMapQueryTermContainer;
import org.vitrivr.cineast.core.data.query.containers.TagQueryTermContainer;
import org.vitrivr.cineast.core.data.query.containers.TextQueryTermContainer;
Expand Down Expand Up @@ -159,13 +158,6 @@ public static ModelQueryTermContainer modelQueryContainer(CineastGrpc.ModelQuery
return null;
}

public static MotionQueryTermContainer motionQueryContainer(CineastGrpc.MotionQueryContainer container) {
MotionQueryTermContainer motionQueryContainer = new MotionQueryTermContainer();
container.getBackgroundPathList().stream().forEach(path -> motionQueryContainer.addBgPath(motionPath(path)));
container.getForegroundPathList().stream().forEach(path -> motionQueryContainer.addPath(motionPath(path)));
return motionQueryContainer;
}

public static LinkedList<Point2D_F32> motionPath(CineastGrpc.MotionQueryContainer.MotionPath path) {
LinkedList<Point2D_F32> list = new LinkedList<>();
list.addAll(path.getPathList().stream().map(QueryContainerUtil::point).collect(Collectors.toList()));
Expand Down Expand Up @@ -199,7 +191,6 @@ public static TextQueryTermContainer textQueryContainer(CineastGrpc.TextQueryCon

public static AbstractQueryTermContainer queryTermContainer(CineastGrpc.QueryTerm term) {
switch (term.getContainerCase()) {

case AUDIOQUERYCONTAINER:
return audioQueryContainer(term.getAudioQueryContainer());
case BOOLEANQUERYCONTAINER:
Expand All @@ -214,8 +205,6 @@ public static AbstractQueryTermContainer queryTermContainer(CineastGrpc.QueryTer
return locationQueryContainer(term.getLocationQueryContainer());
case MODELQUERYCONTAINER:
return modelQueryContainer(term.getModelQueryContainer());
case MOTIONQUERYCONTAINER:
return motionQueryContainer(term.getMotionQueryContainer());
case SEMANTICMAPQUERYCONTAINER:
return semanticMapQueryContainer(term.getSemanticMapQueryContainer());
case TAGQUERYCONTAINER:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import org.vitrivr.cineast.core.data.query.containers.InstantQueryTermContainer;
import org.vitrivr.cineast.core.data.query.containers.LocationQueryTermContainer;
import org.vitrivr.cineast.core.data.query.containers.ModelQueryTermContainer;
import org.vitrivr.cineast.core.data.query.containers.MotionQueryTermContainer;
import org.vitrivr.cineast.core.data.query.containers.ParameterisedLocationQueryTermContainer;
import org.vitrivr.cineast.core.data.query.containers.SemanticMapQueryTermContainer;
import org.vitrivr.cineast.core.data.query.containers.TagQueryTermContainer;
Expand All @@ -26,7 +25,6 @@ public enum QueryTermType {

IMAGE(ImageQueryTermContainer.class),
AUDIO(AudioQueryTermContainer.class),
MOTION(MotionQueryTermContainer.class),
MODEL3D(ModelQueryTermContainer.class),
LOCATION(LocationQueryTermContainer.class),
PARAMETERISED_LOCATION(ParameterisedLocationQueryTermContainer.class),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public static List<TemporalObject> findSegmentsSimilarTemporal(ContinuousRetriev
)
).distinct().collect(Collectors.toList());

var segmentDescriptors = segmentReader.lookUpSegments(segmentIds);
var segmentDescriptors = segmentReader.lookUpSegments(segmentIds, config.getQueryId().toString());
var stagedQueryResults = stagedResults.stream().map(
resultsMap -> resultsMap.values().stream().flatMap(Collection::stream).collect(Collectors.toList())
).collect(Collectors.toList());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
import org.vitrivr.cineast.core.db.dao.reader.MediaSegmentMetadataReader;
import org.vitrivr.cineast.core.db.dao.reader.MediaSegmentReader;
import org.vitrivr.cineast.core.util.LogHelper;
import org.vitrivr.cineast.core.util.QueryIDGenerator;
import org.vitrivr.cineast.core.util.DBQueryIDGenerator;
import org.vitrivr.cineast.core.util.TimeHelper;
import org.vitrivr.cineast.standalone.config.Config;
import org.vitrivr.cineast.standalone.config.ConstrainedQueryConfig;
Expand Down Expand Up @@ -135,36 +135,27 @@ public final void handle(Session session, T message) {
* @param segmentIds List of segment IDs that should be looked up.
* @return List of found {@link MediaSegmentDescriptor}
*/
protected List<MediaSegmentDescriptor> loadSegments(List<String> segmentIds) {
return loadSegments(segmentIds, QueryIDGenerator.generateQueryID());
}

protected List<MediaSegmentDescriptor> loadSegments(List<String> segmentIds, String queryID) {
queryID = queryID + "-loadseg";
LOGGER.trace("Loading segment information for {} segmentIDs, qid {}", segmentIds.size(), queryID);
return TimeHelper.timeCall(() -> {
final Map<String, MediaSegmentDescriptor> map = this.mediaSegmentReader.lookUpSegments(segmentIds);
final Map<String, MediaSegmentDescriptor> map = this.mediaSegmentReader.lookUpSegments(segmentIds, queryID);
final ArrayList<MediaSegmentDescriptor> sdList = new ArrayList<>(map.size());
segmentIds.stream().filter(map::containsKey).forEach(s -> sdList.add(map.get(s)));
return sdList;
}, "loading segment information, qid " + queryID, Level.TRACE);
}


/**
* Performs a lookup for the {@link MediaObjectDescriptor} identified by the provided object IDs and returns a list of the {@link MediaSegmentDescriptor}s that were found.
*
* @param objectIds List of object IDs that should be looked up.
* @return List of found {@link MediaObjectDescriptor}
*/
protected List<MediaObjectDescriptor> loadObjects(List<String> objectIds) {
return loadObjects(objectIds, QueryIDGenerator.generateQueryID());
}

protected List<MediaObjectDescriptor> loadObjects(List<String> objectIds, String queryID) {
queryID = queryID + "-loadobj";
LOGGER.trace("Loading object information for {} segmentIDs, qid {}", objectIds.size(), queryID);
return TimeHelper.timeCall(() -> {
final Map<String, MediaObjectDescriptor> map = this.mediaObjectReader.lookUpObjects(objectIds);
final Map<String, MediaObjectDescriptor> map = this.mediaObjectReader.lookUpObjects(objectIds, queryID);
final ArrayList<MediaObjectDescriptor> vdList = new ArrayList<>(map.size());
objectIds.stream().filter(map::containsKey).forEach(s -> vdList.add(map.get(s)));
return vdList;
Expand All @@ -189,7 +180,7 @@ protected synchronized List<Thread> loadAndWriteObjectMetadata(Session session,
return Lists.partition(objectIds, 100_000).stream().map(list -> loadAndWriteObjectMetadata(session, queryId, list, objectIdsForWhichMetadataIsFetched, metadataAccessSpec)).flatMap(Collection::stream).collect(Collectors.toList());
}
Thread thread = new Thread(() -> {
final List<MediaObjectMetadataDescriptor> objectMetadata = this.objectMetadataReader.findBySpec(objectIds, metadataAccessSpec);
final List<MediaObjectMetadataDescriptor> objectMetadata = this.objectMetadataReader.findBySpec(objectIds, metadataAccessSpec, queryId);
if (objectMetadata.isEmpty()) {
return;
}
Expand Down Expand Up @@ -225,7 +216,7 @@ synchronized List<Thread> loadAndWriteSegmentMetadata(Session session, String qu
return Lists.partition(segmentIds, 100_000).stream().map(list -> loadAndWriteSegmentMetadata(session, queryId, list, segmentIdsForWhichMetadataIsFetched, metadataAccessSpec)).flatMap(Collection::stream).collect(Collectors.toList());
}
Thread fetching = new Thread(() -> {
final List<MediaSegmentMetadataDescriptor> segmentMetadata = this.segmentMetadataReader.findBySpec(segmentIds, metadataAccessSpec);
final List<MediaSegmentMetadataDescriptor> segmentMetadata = this.segmentMetadataReader.findBySpec(segmentIds, metadataAccessSpec, queryId);
if (segmentMetadata.isEmpty()) {
return;
}
Expand Down Expand Up @@ -257,21 +248,21 @@ synchronized List<Thread> loadAndWriteSegmentMetadata(Session session, String qu
*
* @return objectIds retrieved for the segmentIds
*/
protected List<String> submitSegmentAndObjectInformation(Session session, String queryId, List<String> segmentIds) {
protected List<String> submitSegmentAndObjectInformation(Session session, String queryID, List<String> segmentIds) {
/* Load segment & object information. */
LOGGER.trace("Loading segment and object information for submission, {} segments, qid {}", segmentIds.size(), queryId);
final List<MediaSegmentDescriptor> segments = this.loadSegments(segmentIds, queryId);
return submitPrefetchedSegmentAndObjectInformation(session, queryId, segments);
LOGGER.trace("Loading segment and object information for submission, {} segments, qid {}", segmentIds.size(), queryID);
final List<MediaSegmentDescriptor> segments = this.loadSegments(segmentIds, queryID);
return submitPrefetchedSegmentAndObjectInformation(session, queryID, segments);
}

protected List<String> submitPrefetchedSegmentAndObjectInformation(Session session, String queryId, List<MediaSegmentDescriptor> segments) {
protected List<String> submitPrefetchedSegmentAndObjectInformation(Session session, String queryID, List<MediaSegmentDescriptor> segments) {
final List<String> objectIds = segments.stream().map(MediaSegmentDescriptor::getObjectId).collect(Collectors.toList());
return submitPrefetchedSegmentandObjectInformationfromIDs(session, queryId, segments, objectIds);
return submitPrefetchedSegmentandObjectInformationfromIDs(session, queryID, segments, objectIds);
}

List<String> submitPrefetchedSegmentandObjectInformationfromIDs(Session session, String queryId, List<MediaSegmentDescriptor> segments, List<String> objectIds) {
List<String> submitPrefetchedSegmentandObjectInformationfromIDs(Session session, String queryID, List<MediaSegmentDescriptor> segments, List<String> objectIds) {
LOGGER.trace("Loading object information");
final List<MediaObjectDescriptor> objects = this.loadObjects(objectIds, queryId.substring(0, 3));
final List<MediaObjectDescriptor> objects = this.loadObjects(objectIds, queryID);

if (segments.isEmpty() || objects.isEmpty()) {
LOGGER.traceEntry("Segment / Objectlist is Empty, ignoring this iteration");
Expand All @@ -280,8 +271,8 @@ List<String> submitPrefetchedSegmentandObjectInformationfromIDs(Session session,
LOGGER.trace("Writing results to the websocket");

/* Write segments, objects and similarity search data to stream. */
this.write(session, new MediaObjectQueryResult(queryId, objects));
this.write(session, new MediaSegmentQueryResult(queryId, segments));
this.write(session, new MediaObjectQueryResult(queryID, objects));
this.write(session, new MediaSegmentQueryResult(queryID, segments));
return objectIds;
}

Expand All @@ -291,7 +282,7 @@ List<String> submitPrefetchedSegmentandObjectInformationfromIDs(Session session,
void submitSegmentAndObjectInformationFromIds(Session session, String queryId, List<String> segmentIds, List<String> objectIds) {
/* Load segment & object information. */
LOGGER.trace("Loading segment and object information for submission, {} segments {} objects", segmentIds.size(), objectIds.size());
final List<MediaSegmentDescriptor> segments = this.loadSegments(segmentIds, queryId.substring(0, 3));
final List<MediaSegmentDescriptor> segments = this.loadSegments(segmentIds, queryId);
submitPrefetchedSegmentandObjectInformationfromIDs(session, queryId, segments, objectIds);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ public void execute(Session session, QueryConfig qconf, SegmentQuery message, Se
/* Retrieve segments; if empty, abort query. */
final List<String> segmentId = new ArrayList<>(0);
segmentId.add(message.getSegmentId());
final List<MediaSegmentDescriptor> segment = this.loadSegments(segmentId);
final List<MediaSegmentDescriptor> segment = this.loadSegments(segmentId, uuid);
if (segment.isEmpty()) {
return;
}

/* Retrieve media objects; if empty, abort query. */
final List<String> objectId = segment.stream().map(MediaSegmentDescriptor::getObjectId).collect(Collectors.toList());
final List<MediaObjectDescriptor> object = this.loadObjects(objectId);
final List<MediaObjectDescriptor> object = this.loadObjects(objectId, uuid);
if (object.isEmpty()) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package org.vitrivr.cineast.api.websocket.handlers.queries;

import io.netty.util.collection.IntObjectHashMap;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
Expand Down Expand Up @@ -53,7 +52,7 @@ public void execute(Session session, QueryConfig qconf, TemporalQuery message, S
List<Thread> cleanupThreads = new ArrayList<>();

/* We need a set of segments and objects to be used for temporal scoring as well as a storage of all container results where are the index of the outer list is where container i was scored */
Map<Integer, List<StringDoublePair>> containerResults = new IntObjectHashMap<>();
Map<Integer, List<StringDoublePair>> containerResults = new HashMap<>();
Set<MediaSegmentDescriptor> segments = new HashSet<>();

Set<String> sentSegmentIds = new HashSet<>();
Expand Down
9 changes: 1 addition & 8 deletions cineast-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,6 @@ signing {
sign publishing.publications.mavenJava
}


/**
* We cannot switch to implementation yet in multi-module setups.
* With Gradle 6.7 and MacOS, declaring dependencies as implementation means they do not get exposed to other projects
*/
dependencies {

/** THE Cottontail DB proto dependency */
Expand All @@ -89,9 +84,6 @@ dependencies {
/** THE Polypheny dependency */
api group: "org.polypheny", name: "polypheny-jdbc-driver", version: version_polypheny

/** THE ADAMpro proto dependency (legacy) */
api group: 'org.vitrivr', name: 'adampro-proto', version: version_adampro

/* Google Json: GSON, since JSON db layer is based on this */
api group: 'com.google.code.gson', name: 'gson', version: version_gson

Expand Down Expand Up @@ -152,6 +144,7 @@ dependencies {
/** Java 9+ compatibility. */
api group: 'javax.annotation', name: 'javax.annotation-api', version: '1.3.2'
api group: 'javax.activation', name: 'activation', version: '1.1.1'

}

shadowJar {
Expand Down

This file was deleted.

Loading