All Downloads are FREE. Search and download functionalities are using the official Maven repository.

angry1980.audio.dao.NetflixData Maven / Gradle / Ivy

package angry1980.audio.dao;

import angry1980.audio.model.FingerprintType;
import angry1980.audio.model.NetflixNodeType;
import angry1980.audio.model.NetflixRelationType;
import com.netflix.nfgraph.build.NFBuildGraph;
import com.netflix.nfgraph.spec.NFGraphSpec;
import com.netflix.nfgraph.spec.NFNodeSpec;
import com.netflix.nfgraph.spec.NFPropertySpec;
import com.netflix.nfgraph.util.OrdinalMap;

public class NetflixData {

    private NFBuildGraph graph;
    private OrdinalMap tracks;
    private OrdinalMap clusters;
    private OrdinalMap paths;
    private OrdinalMap similarities;
    private OrdinalMap types;

    public NetflixData() {
        this.graph = new NFBuildGraph(getSchema());
        this.tracks = new OrdinalMap<>();
        this.clusters = new OrdinalMap<>();
        this.similarities = new OrdinalMap<>();
        this.types = new OrdinalMap<>();
        this.paths = new OrdinalMap<>();
    }

    private NFGraphSpec getSchema(){
        //todo: move to another place
        return new NFGraphSpec(
                new NFNodeSpec(
                        NetflixNodeType.TRACK.name(),
                        new NFPropertySpec(NetflixRelationType.HAS.name(), NetflixNodeType.SIMILARITY.name(), NFPropertySpec.MULTIPLE | NFPropertySpec.COMPACT),
                        new NFPropertySpec(NetflixRelationType.IS.name(), NetflixNodeType.TRACK_CLUSTER.name(), NFPropertySpec.SINGLE | NFPropertySpec.COMPACT),
                        new NFPropertySpec(NetflixRelationType.SITUATED.name(), NetflixNodeType.TRACK_PATH.name(), NFPropertySpec.SINGLE | NFPropertySpec.COMPACT)
                ),
                new NFNodeSpec(NetflixNodeType.TRACK_CLUSTER.name()),
                new NFNodeSpec(NetflixNodeType.TRACK_PATH.name()),
                new NFNodeSpec(
                        NetflixNodeType.SIMILARITY.name(),
                        new NFPropertySpec(NetflixRelationType.TYPE_OF.name(), NetflixNodeType.SIMILARITY_TYPE.name(), NFPropertySpec.SINGLE | NFPropertySpec.COMPACT)
                ),
                new NFNodeSpec(NetflixNodeType.SIMILARITY_TYPE.name())
        );
    }

    public OrdinalMap getPaths() {
        return paths;
    }

    public OrdinalMap getTracks() {
        return tracks;
    }

    public OrdinalMap getClusters() {
        return clusters;
    }

    public OrdinalMap getSimilarities() {
        return similarities;
    }

    public OrdinalMap getTypes() {
        return types;
    }

    public NFBuildGraph getGraph() {
        return graph;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy