<commit_before># = node_factory.rb
#
# NodeFactory manages the creation and instanciation of each type of node
# (Resource, Literal, AnonymousResource, etc...). It keeps only one instance of each
# Resource.
# It manages also the connection with one adpater.
#
# == Project
#
# * ActiveRDF
# <http://m3pe.org/activerdf/>
#
# == Authors
# 
# * <NAME> <first dot last at deri dot org>
# * <NAME> <first dot last at deri dot org>
#
# == Copyright
#
# (c) 2005-2006 by <NAME> and <NAME> - All Rights Reserved
#
# == To-do
#
# * To-do 1
#

require 'activerdf_exceptions'

require 'literal'
require 'resource'
require 'basic_identified_resource'

class NodeFactory

	# Instanciation of adapter
	@@_connection = nil
	
	# Hash of instanciated resources
	@@_resources = Hash.new
	
#----------------------------------------------#
#               PUBLIC METHODS                 #
#----------------------------------------------#

  public

  # Return the current instance of the connection. If no connection exists and 
  # params given, instantiate a new connection.
  #
  # Arguments:
  # * +params+ [<tt>Hash</tt>]: Connection parameter. Required only the first time, to initialize the connection.
  #
  # Return:
  # * [<tt>AbstractAdapter</tt>] The current connection with the RDF DataBase.
	def self.connection(params = nil)
	
		if @@_connection.nil? and params.nil?
			raise(ConnectionError, "In #{__FILE__}:#{__LINE__}, no parameters to instantiate connection.")
		elsif !@@_connection.nil?
			return @@_connection
		end
	
		case params[:adapter]<commit_msg>Changed tests in initialize to return instance of connection<commit_after># = node_factory.rb
#
# NodeFactory manages the creation and instanciation of each type of node
# (Resource, Literal, AnonymousResource, etc...). It keeps only one instance of each
# Resource.
# It manages also the connection with one adpater.
#
# == Project
#
# * ActiveRDF
# <http://m3pe.org/activerdf/>
#
# == Authors
# 
# * <NAME> <first dot last at deri dot org>
# * <NAME> <first dot last at deri dot org>
#
# == Copyright
#
# (c) 2005-2006 by <NAME> and <NAME> - All Rights Reserved
#
# == To-do
#
# * To-do 1
#

require 'activerdf_exceptions'

require 'literal'
require 'resource'
require 'basic_identified_resource'

class NodeFactory

	# Instanciation of adapter
	@@_connection = nil
	
	# Hash of instanciated resources
	@@_resources = Hash.new
	
#----------------------------------------------#
#               PUBLIC METHODS                 #
#----------------------------------------------#

  public

  # Return the current instance of the connection. If no connection exists and 
  # params given, instantiate a new connection.
  #
  # Arguments:
  # * +params+ [<tt>Hash</tt>]: Connection parameter. Required only the first time, to initialize the connection.
  #
  # Return:
  # * [<tt>AbstractAdapter</tt>] The current connection with the RDF DataBase.
	def self.connection(params = nil)
	
		if @@_connection.nil? and params.nil?
			raise(ConnectionError, "In #{__FILE__}:#{__LINE__}, no parameters to instantiate connection.")
		elsif !@@_connection.nil? and params.nil?
			return @@_connection
		end
	
		case params[:adapter]
{'fraction_non_alphanumeric': 0.16692913385826771, 'fraction_numerical': 0.006299212598425197, 'mean_word_length': 2.8265060240963855, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '1027901', 'n_tokens_mistral': 999, 'n_tokens_neox': 920, 'n_words': 315}