<commit_before>/*
  (c) Copyright 2003, 2004, 2005 Hewlett-Packard Development Company, LP
  [See end of file]
  $Id: DBPrefixMappingImpl.java,v 1.11 2006-02-03 12:01:19 chris-dollin Exp $
*/

package com.hp.hpl.jena.db.impl;

import com.hp.hpl.jena.shared.PrefixMapping;
import com.hp.hpl.jena.shared.impl.PrefixMappingImpl;

import java.util.*;

/**
 *  Implementation of prefix mapping specific to databases.
 *  This extends the base implementation, effectively turning it into
 *  a write-through cache - each new namespace is written to
 *  the database as it is added to the prefix map.
 * 
 *
 	@author csayers
 	@version $Revision: 1.11 $
*/
public class DBPrefixMappingImpl extends PrefixMappingImpl {

	protected DBPropGraph m_graphProperties = null;
	
	/**
	 * Constructor for a persistent prefix mapping.
	 * 
	 * Each GraphRDB has a set of associated properties
	 * which are, themselves, represented as triples in
	 * a system graph.
	 * 
	 * The prefix mapping is persisted by converting it
	 * to triples and storing it along with the other
	 * properties of the GraphRDB in that system graph.
	 * 
	 * @param graphProperties the system properties of a persistent graph.
	 */
	public DBPrefixMappingImpl( DBPropGraph graphProperties) {
		super();
		m_graphProperties = graphProperties;
		
		// Populate the prefix map using data from the 
		// persistent graph properties
		Iterator it = m_graphProperties.getAllPrefixes();
		while( it.hasNext()) {
			DBPropPrefix prefix = (DBPropPrefix)it.next();
			super.setNsPrefix( prefix.getValue(), prefix.getURI() );
		}<commit_msg>Wrapped constructors load-prefix code in a conditional transaction wrapper.<commit_after>/*
  (c) Copyright 2003, 2004, 2005 Hewlett-Packard Development Company, LP
  [See end of file]
  $Id: DBPrefixMappingImpl.java,v 1.12 2006-02-10 13:20:13 chris-dollin Exp $
*/

package com.hp.hpl.jena.db.impl;

import com.hp.hpl.jena.shared.PrefixMapping;
import com.hp.hpl.jena.shared.impl.PrefixMappingImpl;

import java.util.*;

import javax.sql.XAConnection;

/**
 *  Implementation of prefix mapping specific to databases.
 *  This extends the base implementation, effectively turning it into
 *  a write-through cache - each new namespace is written to
 *  the database as it is added to the prefix map.
 * 
 *
 	@author csayers
 	@version $Revision: 1.12 $
*/
public class DBPrefixMappingImpl extends PrefixMappingImpl {

	protected DBPropGraph m_graphProperties = null;
	
	/**
	 * Constructor for a persistent prefix mapping.
	 * 
	 * Each GraphRDB has a set of associated properties
	 * which are, themselves, represented as triples in
	 * a system graph.
	 * 
	 * The prefix mapping is persisted by converting it
	 * to triples and storing it along with the other
	 * properties of the GraphRDB in that system graph.
	 * 
	 * @param graphProperties the system properties of a persistent graph.
	 */
	public DBPrefixMappingImpl( DBPropGraph graphProperties) {
		super();
		m_graphProperties = graphProperties;
		
		// Populate the prefix map using data from the 
		// persistent graph properties
        boolean commit = m_graphProperties.begin();
		Iterator it = m_graphProperties.getAllPrefixes();
		while( it.hasNext()) {
			DBPropPrefix prefix = (DBPropPrefix)it.next();
			super.setNsPrefix( prefix.getValue(), prefix.getURI() );
		}
        m_graphProperties.conditionalCommit( commit );
{'fraction_non_alphanumeric': 0.0863139225539462, 'fraction_numerical': 0.018918120011823827, 'mean_word_length': 3.813655761024182, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7553388', 'n_tokens_mistral': 1094, 'n_tokens_neox': 964, 'n_words': 345}