<commit_before>/*
 *  @author <NAME>
 *  
 *  Copyright 2014 University of Zurich
 *      
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *  
 *         http://www.apache.org/licenses/LICENSE-2.0
 *  
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *  
 */

package com.signalcollect.triplerush

import com.signalcollect.GraphEditor
import QueryParticle.arrayToParticle
import com.signalcollect.Vertex
import com.signalcollect.Edge
import com.signalcollect.triplerush.vertices._

case object NonExistentVertexHandler {
  def createIndexVertex(edge: Edge[Any], vertexId: Any): Option[Vertex[Any, _]] = {
    vertexId match {
      case TriplePattern(0, 0, 0) => throw new Exception("Root vertex does not exist, should always be added first.")
      case tp @ TriplePattern(0, 0, o) => Some(new OIndex(tp))
      case tp @ TriplePattern(0, p, 0) => Some(new PIndex(tp))
      case tp @ TriplePattern(s, 0, 0) => Some(new SIndex(tp))
      case tp @ TriplePattern(s, p, 0) => Some(new SPIndex(tp))
      case tp @ TriplePattern(s, 0, o) => Some(new SOIndex(tp))
      case tp @ TriplePattern(0, p, o) => Some(new POIndex(tp))
      case other => throw new Exception(s"Could not add edge $edge to vertex $vertexId, because that vertex does not exist.")
    }
  }
}
<commit_msg>Just adding missing root index vertex.<commit_after>/*
 *  @author <NAME>
 *  
 *  Copyright 2014 University of Zurich
 *      
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *  
 *         http://www.apache.org/licenses/LICENSE-2.0
 *  
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *  
 */

package com.signalcollect.triplerush

import com.signalcollect.GraphEditor
import QueryParticle.arrayToParticle
import com.signalcollect.Vertex
import com.signalcollect.Edge
import com.signalcollect.triplerush.vertices._
import com.signalcollect.triplerush.vertices.RootIndex

case object NonExistentVertexHandler {
  def createIndexVertex(edge: Edge[Any], vertexId: Any): Option[Vertex[Any, _]] = {
    vertexId match {
      case TriplePattern(0, 0, 0) => Some(new RootIndex)
      case tp @ TriplePattern(0, 0, o) => Some(new OIndex(tp))
      case tp @ TriplePattern(0, p, 0) => Some(new PIndex(tp))
      case tp @ TriplePattern(s, 0, 0) => Some(new SIndex(tp))
      case tp @ TriplePattern(s, p, 0) => Some(new SPIndex(tp))
      case tp @ TriplePattern(s, 0, o) => Some(new SOIndex(tp))
      case tp @ TriplePattern(0, p, o) => Some(new POIndex(tp))
      case other => throw new Exception(s"Could not add edge $edge to vertex $vertexId, because that vertex does not exist.")
    }
  }
}

{'fraction_non_alphanumeric': 0.10109048040082523, 'fraction_numerical': 0.011788977306218685, 'mean_word_length': 3.6366120218579234, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 21, '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': '4629334', 'n_tokens_mistral': 1026, 'n_tokens_neox': 1003, 'n_words': 367}