<commit_before>/*
 * This file is part of the ScaleGraph?PropelGraph project (http://scalegraph.org).
 *
 * This file is licensed to You under the Eclipse Public License (EPL);
 * You may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * http://www.opensource.org/licenses/eclipse-1.0.php
 *
 * (C) Copyright ScaleGraph Team 2014.
 */
package org.propelgraph.memgraph;

//TP3.0.0 import com.tinkerpop.gremlin.structure.Graph; //TP3.0.0

import com.tinkerpop.blueprints.Graph;  // TP2.4
import com.tinkerpop.blueprints.Vertex;  // TP2.4
import com.tinkerpop.blueprints.Element;  // TP2.4
import com.tinkerpop.blueprints.Edge;  // TP2.4
import com.tinkerpop.blueprints.Parameter;  // TP2.4
import com.tinkerpop.blueprints.GraphQuery;  // TP2.4
import com.tinkerpop.blueprints.Features;  // TP2.4
import com.tinkerpop.blueprints.KeyIndexableGraph; // TP2.4
import com.tinkerpop.blueprints.util.DefaultGraphQuery; // TP2.4

import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;

import org.propelgraph.LocatableGraph;

public class MemGraph implements Graph, KeyIndexableGraph, LocatableGraph {
	MemEdge edgeFirst;
	MemVertex vertFirst;
	HashMap<String,MemVertex> hmVerts = new HashMap<String,MemVertex>();
	HashMap<String,MemEdge> hmEdges = new HashMap<String,MemEdge>();

	String graphname;
	String dirpath;

	public enum MemGGraphType { INMEMORY, PERSISTENT };

	private static final Features FEATURES = new Features();

	static {
		FEATURES.supportsDuplicateEdges = true;
		FEATURES.supportsSelfLoops = true;
		FEATURES.supportsSerializableObjectProperty = true;
		FEATURES.supportsBooleanProperty = true;
		FEATURES.supportsDoubleProperty = true;
		FEATURES.supportsFloatProperty = true;
		FEATURES.supportsIntegerProperty = true;
		FEATURES.supportsPrimitiveArrayProperty = true;
		FEATURES.supportsUniformListProperty = true;
		FEATURES.supportsMixedListProperty = true;
		FEATURES.supportsLongProperty = true;
		FEATURES.supportsMapProperty = true;
		FEATURES.supportsStringProperty = true;
		
		FEATURES.ignoresSuppliedIds = false;
		FEATURES.isPersistent = false;
		FEATURES.isWrapper = false;
		
		FEATURES.supportsIndices = true;    // not yet supporting, but will
		FEATURES.supportsKeyIndices = true;
		FEATURES.supportsVertexKeyIndex = true;
		FEATURES.supportsEdgeKeyIndex = true;
		FEATURES.supportsVertexIndex = true;
		FEATURES.supportsEdgeIndex = true;
		FEATURES.supportsTransactions = false;
		FEATURES.supportsVertexIteration = true;
		FEATURES.supportsEdgeIteration = true;
		FEATURES.supportsEdgeRetrieval = true;
		FEATURES.supportsVertexProperties = true;
		FEATURES.supportsEdgeProperties = true;
		FEATURES.supportsThreadedTransactions = false;		
// prebop preprocessor used here:
/* $if TINKERPOPVERSION >= 2.5.0$ 
		FEATURES.supportsThreadIsolatedTransactions = false;  //TP2.5
   $endif$ */
	}

	public MemGraph( String dirpath, String graphname, MemGraph.MemGGraphType memggtype ) {
		this.dirpath = dirpath;
		this.graphname = graphname;
		if (memggtype==MemGGraphType.PERSISTENT) throw new RuntimeException("don't yet support persistent graphs");
	}

	@Override
	public Features getFeatures() {
		return FEATURES;
	}

	@Override
	public Iterable<Edge> getEdges() {
		return new MemGlobalEdgeIterator(this, null, null, null);
	}

	@Override
	public Iterable<Edge> getEdges(String propname, Object propval) {
		if ("label".equals(propname)) {
			return new MemGlobalEdgeIterator(this, propval.toString(), null, null );  // BP2.5 seems to treat label property differently
		} else {
			return new MemGlobalEdgeIterator(this, null, propname, propval.toString() );
		}
	}
<commit_msg>adjusting the postbop support in MemGraph<commit_after>/*
 * This file is part of the ScaleGraph?PropelGraph project (http://scalegraph.org).
 *
 * This file is licensed to You under the Eclipse Public License (EPL);
 * You may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * http://www.opensource.org/licenses/eclipse-1.0.php
 *
 * (C) Copyright ScaleGraph Team 2014.
 */
package org.propelgraph.memgraph;

//TP3.0.0 import com.tinkerpop.gremlin.structure.Graph; //TP3.0.0

import com.tinkerpop.blueprints.Graph;  // TP2.4
import com.tinkerpop.blueprints.Vertex;  // TP2.4
import com.tinkerpop.blueprints.Element;  // TP2.4
import com.tinkerpop.blueprints.Edge;  // TP2.4
import com.tinkerpop.blueprints.Parameter;  // TP2.4
import com.tinkerpop.blueprints.GraphQuery;  // TP2.4
import com.tinkerpop.blueprints.Features;  // TP2.4
import com.tinkerpop.blueprints.KeyIndexableGraph; // TP2.4
import com.tinkerpop.blueprints.util.DefaultGraphQuery; // TP2.4

import java.util.HashMap;
import java.util.HashSet;
import java.util.Set;

import org.propelgraph.LocatableGraph;

public class MemGraph implements Graph, KeyIndexableGraph, LocatableGraph {
	MemEdge edgeFirst;
	MemVertex vertFirst;
	HashMap<String,MemVertex> hmVerts = new HashMap<String,MemVertex>();
	HashMap<String,MemEdge> hmEdges = new HashMap<String,MemEdge>();

	String graphname;
	String dirpath;

	public enum MemGGraphType { INMEMORY, PERSISTENT };

	private static final Features FEATURES = new Features();

	static {
		FEATURES.supportsDuplicateEdges = true;
		FEATURES.supportsSelfLoops = true;
		FEATURES.supportsSerializableObjectProperty = true;
		FEATURES.supportsBooleanProperty = true;
		FEATURES.supportsDoubleProperty = true;
		FEATURES.supportsFloatProperty = true;
		FEATURES.supportsIntegerProperty = true;
		FEATURES.supportsPrimitiveArrayProperty = true;
		FEATURES.supportsUniformListProperty = true;
		FEATURES.supportsMixedListProperty = true;
		FEATURES.supportsLongProperty = true;
		FEATURES.supportsMapProperty = true;
		FEATURES.supportsStringProperty = true;
		
		FEATURES.ignoresSuppliedIds = false;
		FEATURES.isPersistent = false;
		FEATURES.isWrapper = false;
		
		FEATURES.supportsIndices = true;    // not yet supporting, but will
		FEATURES.supportsKeyIndices = true;
		FEATURES.supportsVertexKeyIndex = true;
		FEATURES.supportsEdgeKeyIndex = true;
		FEATURES.supportsVertexIndex = true;
		FEATURES.supportsEdgeIndex = true;
		FEATURES.supportsTransactions = false;
		FEATURES.supportsVertexIteration = true;
		FEATURES.supportsEdgeIteration = true;
		FEATURES.supportsEdgeRetrieval = true;
		FEATURES.supportsVertexProperties = true;
		FEATURES.supportsEdgeProperties = true;
		FEATURES.supportsThreadedTransactions = false;		
// prebop/postbop preprocessor used here:
/* $if TINKERPOPVERSION >= 2.6.0$ 
		FEATURES.supportsThreadIsolatedTransactions = false;  //TP2.6, we can formally add support for multithreading later
   $endif$ */
	}

	public MemGraph( String dirpath, String graphname, MemGraph.MemGGraphType memggtype ) {
		this.dirpath = dirpath;
		this.graphname = graphname;
		if (memggtype==MemGGraphType.PERSISTENT) throw new RuntimeException("don't yet support persistent graphs");
	}

	@Override
	public Features getFeatures() {
		return FEATURES;
	}

	@Override
	public Iterable<Edge> getEdges() {
		return new MemGlobalEdgeIterator(this, null, null, null);
	}

	@Override
	public Iterable<Edge> getEdges(String propname, Object propval) {
		if ("label".equals(propname)) {
			return new MemGlobalEdgeIterator(this, propval.toString(), null, null );  // BP2.5 seems to treat label property differently
		} else {
			return new MemGlobalEdgeIterator(this, null, propname, propval.toString() );
		}
	}

{'fraction_non_alphanumeric': 0.09763948497854077, 'fraction_numerical': 0.00992489270386266, 'mean_word_length': 4.767208043310132, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3752794', 'n_tokens_mistral': 2530, 'n_tokens_neox': 2422, 'n_words': 545}