<commit_before>package org.sbolstandard.core2;

import static org.sbolstandard.core.datatree.Datatree.NamedProperty;
import static org.sbolstandard.core.datatree.Datatree.NamespaceBinding;
import static org.sbolstandard.core.datatree.Datatree.QName;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

//import javax.sound.midi.Sequence;
import javax.xml.namespace.QName;

import org.junit.Test;

/**
 * Abstract tests used by SBOLReaderTest, SBOLWriterTest, and SBOLGenerateFile.
 * @author <NAME>
 * @author <NAME>
 * @author <NAME>
 * @author <NAME>
 *
 */
public abstract class SBOLAbstractTests {

	String VERSION_1_0 = "1.0";
	String URIprefix = "http://www.async.ece.utah.edu";

	/**
	 * Test model remove method.
	 * @throws SBOLValidationException 
	 * @throws IOException 
	 * @throws SBOLConversionException 
	 */
	@Test
	public void test_Model_remove() throws SBOLValidationException, SBOLConversionException, IOException 
	{
		String prURI="http://partsregistry.org/";
		String prPrefix="pr";
		SBOLDocument document = new SBOLDocument();
		document.setDefaultURIprefix(prURI);
		document.setTypesInURIs(true);
		document.addNamespace(URI.create(prURI), prPrefix);

		String M1_ID = "ID";
		String M1_Version = "1.0";
		String M1_Source = "www.example.com";
		URI M1_URISource = URI.create(M1_Source);

		Model M1 = document.createModel(M1_ID, M1_Version, M1_URISource, EDAMOntology.SBML,
				SystemsBiologyOntology.CONTINUOUS_FRAMEWORK);
		document.removeModel(M1);
		runTest("/SBOLTestSuite/SBOL2/test_Model_remove.xml", document, true);
	}

	/**
	 * Test sequence remove method.
	 * @throws SBOLValidationException
	 * @throws SBOLConversionException
	 * @throws IOException
	 */
	@Test
	public void test_Sequence_remove() throws SBOLValidationException, SBOLConversionException, IOException 
	{
		String prURI="http://partsregistry.org/";
		String prPrefix="pr";
		SBOLDocument document = new SBOLDocument();
		document.setDefaultURIprefix(prURI);
		document.setTypesInURIs(true);
		document.addNamespace(URI.create(prURI), prPrefix);

		String SeqID = "ID";
		String SeqVersion = "1.0";
		String SeqElements = "Element";
		URI SeqEncoding = URI.create("www.example.com");
		Sequence Seq = document.createSequence(SeqID, SeqVersion, SeqElements, SeqEncoding);
		document.removeSequence(Seq);
		runTest("/SBOLTestSuite/SBOL2/test_Sequence_remove.xml", document, true);
	}


	/**
	 * Test source_location method.
	 * @throws SBOLValidationException
	 * @throws IOException
	 * @throws SBOLConversionException
	 */
	@Test
	public void test_source_location() throws SBOLValidationException, SBOLConversionException, IOException
	{
		String prURI="http://partsregistry.org/";
		String prPrefix="pr";
		SBOLDocument document = new SBOLDocument();
		document.setDefaultURIprefix(prURI);
		document.setTypesInURIs(true);
		document.addNamespace(URI.create(prURI), prPrefix);

		ComponentDefinition cd_comp = document.createComponentDefinition(
				"cd_comp",
				"",
				new HashSet<URI>(Arrays.asList(URI.create("http://www.biopax.org/release/biopax-level3.owl#DnaRegion"))));

		cd_comp.addRole(SequenceOntology.PROMOTER);
		cd_comp.setName("cd_comp");
		cd_comp.setDescription("Constitutive promoter");

		ComponentDefinition cd_base1 = document.createComponentDefinition(
				"cd_base_1",
				         "",
				new HashSet<URI>(Arrays.asList(URI.create("http://www.biopax.org/release/biopax-level3.owl#DnaRegion"))));

		ComponentDefinition cd_base2 = document.createComponentDefinition(
				"cd_base_2",
				"",
				new HashSet<URI>(Arrays.asList(URI.create("http://www.biopax.org/release/biopax-level3.owl#DnaRegion"))));


		// SBOLTestUtils.addPRSequence(document, promoter,"aaagacaggacc");
		Sequence seq_base1 = document.createSequence(
				"seq_base1",
				"",
				"ttgacagctagctcagtcctaggtataatgctagc",
				URI.create("http://www.chem.qmul.ac.uk/iubmb/misc/naseq1.html")
		);

		Sequence seq_base2 = document.createSequence(
				"seq_base2",
				"",
				"ttgacagctagctcagtcctaggtataatgctagttagcgc",
				URI.create("http://www.chem.qmul.ac.uk/iubmb/misc/naseq2.html")
		);

		Sequence seq_comp = document.createSequence(
				"seq_comp",
				"",
				"acagctagctacagctagct",
				URI.create("http://www.chem.qmul.ac.uk/iubmb/misc/naseq3.html")
		);

		cd_base1.addSequence(seq_base1.getIdentity());
		cd_base2.addSequence(seq_base2.getIdentity());

		Component base1_insert = cd_comp.createComponent("base1", AccessType.PUBLIC, cd_base1.getIdentity());
		Component base2_insert = cd_comp.createComponent("base2", AccessType.PUBLIC, cd_base2.getIdentity());

		base1_insert.addSourceRange("seq_base1", 4, 14, OrientationType.INLINE);
		base2_insert.addSourceRange("seq_base2", 4, 14, OrientationType.INLINE);

		cd_comp.addSequence(seq_comp);

		runTest("/SBOLTestSuite/SBOL2/test_source_location.xml", document, true);
	}


	/**
	 * Test Collection remove method
	 * @throws SBOLValidationException
	 * @throws SBOLConversionException
	 * @throws IOException<commit_msg>Updated for source loc testing<commit_after>package org.sbolstandard.core2;

import static org.sbolstandard.core.datatree.Datatree.NamedProperty;
import static org.sbolstandard.core.datatree.Datatree.NamespaceBinding;
import static org.sbolstandard.core.datatree.Datatree.QName;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

//import javax.sound.midi.Sequence;
import javax.xml.namespace.QName;

import org.junit.Test;

/**
 * Abstract tests used by SBOLReaderTest, SBOLWriterTest, and SBOLGenerateFile.
 * @author <NAME>
 * @author <NAME>
 * @author <NAME>
 * @author <NAME>
 *
 */
public abstract class SBOLAbstractTests {

	String VERSION_1_0 = "1.0";
	String URIprefix = "http://www.async.ece.utah.edu";

	/**
	 * Test model remove method.
	 * @throws SBOLValidationException 
	 * @throws IOException 
	 * @throws SBOLConversionException 
	 */
	@Test
	public void test_Model_remove() throws SBOLValidationException, SBOLConversionException, IOException 
	{
		String prURI="http://partsregistry.org/";
		String prPrefix="pr";
		SBOLDocument document = new SBOLDocument();
		document.setDefaultURIprefix(prURI);
		document.setTypesInURIs(true);
		document.addNamespace(URI.create(prURI), prPrefix);

		String M1_ID = "ID";
		String M1_Version = "1.0";
		String M1_Source = "www.example.com";
		URI M1_URISource = URI.create(M1_Source);

		Model M1 = document.createModel(M1_ID, M1_Version, M1_URISource, EDAMOntology.SBML,
				SystemsBiologyOntology.CONTINUOUS_FRAMEWORK);
		document.removeModel(M1);
		runTest("/SBOLTestSuite/SBOL2/test_Model_remove.xml", document, true);
	}

	/**
	 * Test sequence remove method.
	 * @throws SBOLValidationException
	 * @throws SBOLConversionException
	 * @throws IOException
	 */
	@Test
	public void test_Sequence_remove() throws SBOLValidationException, SBOLConversionException, IOException 
	{
		String prURI="http://partsregistry.org/";
		String prPrefix="pr";
		SBOLDocument document = new SBOLDocument();
		document.setDefaultURIprefix(prURI);
		document.setTypesInURIs(true);
		document.addNamespace(URI.create(prURI), prPrefix);

		String SeqID = "ID";
		String SeqVersion = "1.0";
		String SeqElements = "Element";
		URI SeqEncoding = URI.create("www.example.com");
		Sequence Seq = document.createSequence(SeqID, SeqVersion, SeqElements, SeqEncoding);
		document.removeSequence(Seq);
		runTest("/SBOLTestSuite/SBOL2/test_Sequence_remove.xml", document, true);
	}


	/**
	 * Test source_location method.
	 * @throws SBOLValidationException
	 * @throws IOException
	 * @throws SBOLConversionException
	 */
	@Test
	public void test_source_location() throws SBOLValidationException, SBOLConversionException, IOException
	{
		String prURI="http://partsregistry.org/";
		String prPrefix="pr";
		SBOLDocument document = new SBOLDocument();
		document.setDefaultURIprefix(prURI);
		document.setTypesInURIs(true);
		document.addNamespace(URI.create(prURI), prPrefix);

		ComponentDefinition cd_comp = document.createComponentDefinition(
				"cd_comp",
				"",
				new HashSet<URI>(Arrays.asList(URI.create("http://www.biopax.org/release/biopax-level3.owl#DnaRegion"))));

		cd_comp.addRole(SequenceOntology.PROMOTER);
		cd_comp.setName("cd_comp");
		cd_comp.setDescription("Constitutive promoter");

		ComponentDefinition cd_base1 = document.createComponentDefinition(
				"cd_base_1",
				         "",
				new HashSet<URI>(Arrays.asList(URI.create("http://www.biopax.org/release/biopax-level3.owl#DnaRegion"))));

		ComponentDefinition cd_base2 = document.createComponentDefinition(
				"cd_base_2",
				"",
				new HashSet<URI>(Arrays.asList(URI.create("http://www.biopax.org/release/biopax-level3.owl#DnaRegion"))));


		// SBOLTestUtils.addPRSequence(document, promoter,"aaagacaggacc");
		Sequence seq_base1 = document.createSequence(
				"seq_base1",
				"",
				"ttgacagctagctcagtcctaggtataatgctagc",
				URI.create("http://www.chem.qmul.ac.uk/iubmb/misc/naseq1.html")
		);

		Sequence seq_base2 = document.createSequence(
				"seq_base2",
				"",
				"ttgacagctagctcagtcctaggtataatgctagttagcgc",
				URI.create("http://www.chem.qmul.ac.uk/iubmb/misc/naseq2.html")
		);

		Sequence seq_comp = document.createSequence(
				"seq_comp",
				"",
				"acagctagctacagctagct",
				URI.create("http://www.chem.qmul.ac.uk/iubmb/misc/naseq3.html")
		);

		cd_base1.addSequence(seq_base1.getIdentity());
		cd_base2.addSequence(seq_base2.getIdentity());

		Component base1_insert_c = cd_comp.createComponent("base1", AccessType.PUBLIC, cd_base1.getIdentity());
		Component base2_insert_c = cd_comp.createComponent("base2", AccessType.PUBLIC, cd_base2.getIdentity());

		base1_insert_c.addSourceRange("seq_base1", 4, 14, OrientationType.INLINE);
		base2_insert_c.addSourceRange("seq_base2", 4, 14, OrientationType.INLINE);

		cd_comp.addSequence(seq_comp);

		SequenceAnnotation sa_base1 = cd_comp.createSequenceAnnotation("base_s1", "base_c1", 1, 11);
		SequenceAnnotation sa_base2 = cd_comp.createSequenceAnnotation("base_s2", "base_c2", 12, 22);

		Location seq_loc1 = sa_base1.getLocation("base_c1");
		seq_loc1.setSequence(seq_comp.getIdentity());

		Location seq_loc2 = sa_base2.getLocation("base_c2");
		seq_loc2.setSequence(seq_comp.getIdentity());

		runTest("/SBOLTestSuite/SBOL2/test_source_location.xml", document, true);
	}


	/**
	 * Test Collection remove method
	 * @throws SBOLValidationException
	 * @throws SBOLConversionException
	 * @throws IOException
{'fraction_non_alphanumeric': 0.1267176980540441, 'fraction_numerical': 0.012265978050355068, 'mean_word_length': 5.189497716894977, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 18, 'xml': 8}, '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': '1889918', 'n_tokens_mistral': 4013, 'n_tokens_neox': 3630, 'n_words': 569}