text:
package it.unibz.inf.ontop.spec.mapping.parser;

import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import it.unibz.inf.ontop.exception.TargetQueryParserException;
import it.unibz.inf.ontop.model.template.Template;
import it.unibz.inf.ontop.model.term.IRIConstant;
import it.unibz.inf.ontop.model.term.ImmutableFunctionalTerm;
import it.unibz.inf.ontop.model.term.ImmutableTerm;
import it.unibz.inf.ontop.model.term.Variable;
import it.unibz.inf.ontop.model.vocabulary.RDF;
import it.unibz.inf.ontop.model.vocabulary.RDFS;
import it.unibz.inf.ontop.model.vocabulary.XSD;
import it.unibz.inf.ontop.spec.mapping.TargetAtom;
import it.unibz.inf.ontop.spec.mapping.PrefixManager;
import org.apache.commons.rdf.api.IRI;
import org.junit.Ignore;
import org.junit.Test;

import static it.unibz.inf.ontop.utils.MappingTestingTools.*;
import static it.unibz.inf.ontop.utils.MappingTestingTools.TARGET_ATOM_FACTORY;
import static org.junit.Assert.assertEquals;

/**
 * Test syntax of the parser.
 * Added new extension. Define if the mapping column contains a data property with rdfs:Literal ("{column}")
 * or an object property (<{column}>)
 * */

public class TurtleSyntaxParserTest {

	private final TargetQueryParser parser;

	private static final IRI DEFAULT_DATATYPE = RDFS.LITERAL;

	public TurtleSyntaxParserTest() {
		PrefixManager prefixManager = SPECIFICATION_FACTORY.createPrefixManager(ImmutableMap.of(
				PrefixManager.DEFAULT_PREFIX, "http://obda.inf.unibz.it/testcase#",
				"ex:", "http://www.example.org/"));
		parser = TARGET_QUERY_PARSER_FACTORY.createParser(prefixManager);
	}

	private static IRIConstant getConstantIRI(String iri) {
		return TERM_FACTORY.getConstantIRI(iri);
	}

	private static IRIConstant getConstantIRI(IRI iri) {
		return TERM_FACTORY.getConstantIRI(iri);
	}

	private static Variable getVariable(String variable) {
		return TERM_FACTORY.getVariable(variable);
	}

	private static TargetAtom getTripleTargetAtom(ImmutableTerm s, ImmutableTerm p, ImmutableTerm o) {
		return TARGET_ATOM_FACTORY.getTripleTargetAtom(s, p, o);
	}

	private static TargetAtom getQuadTargetAtom(ImmutableTerm s, ImmutableTerm p, ImmutableTerm o, ImmutableTerm g) {
		return TARGET_ATOM_FACTORY.getQuadTargetAtom(s, p, o, g);
	}

	private static ImmutableFunctionalTerm getIRIFunctionalTerm(ImmutableList<Template.Component> template, Variable v1) {
		return TERM_FACTORY.getIRIFunctionalTerm(template,
				ImmutableList.of(TERM_FACTORY.getPartiallyDefinedConversionToString(v1)));
	}

	private static ImmutableFunctionalTerm getIRIFunctionalTerm(ImmutableList<Template.Component> template, Variable v1, Variable v2) {
		return TERM_FACTORY.getIRIFunctionalTerm(template,
				ImmutableList.of(TERM_FACTORY.getPartiallyDefinedConversionToString(v1),
				TERM_FACTORY.getPartiallyDefinedConversionToString(v2)));
	}

	private static ImmutableFunctionalTerm getBnodeFunctionalTerm(ImmutableList<Template.Component> template, Variable v1) {
		return TERM_FACTORY.getBnodeFunctionalTerm(template,
				ImmutableList.of(TERM_FACTORY.getPartiallyDefinedConversionToString(v1)));
	}

	private static ImmutableFunctionalTerm getRDFLiteralFunctionalTerm(ImmutableTerm t, IRI type) {
		return TERM_FACTORY.getRDFLiteralFunctionalTerm(t, type);
	}

	private static ImmutableFunctionalTerm getRDFLiteralFunctionalTerm(ImmutableTerm t, String lang) {
		return TERM_FACTORY.getRDFLiteralFunctionalTerm(t, lang);
	}

	@Test(expected = TargetQueryParserException.class)
	public void test_1_1_empty_placeholder() throws TargetQueryParserException {
		parser.parse(":Person-{} a :Person .");
	}

	@Test
	public void test_1_1() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(
				":Person-{id} a :Person .");

		assertEquals(ImmutableList.of(getTripleTargetAtom(
				getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
						getVariable("id")),
				getConstantIRI(RDF.TYPE),
				getConstantIRI("http://obda.inf.unibz.it/testcase#Person"))), result);
	}

	@Test
	public void test_1_1_equality() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(
				":x={x}&y={y} a :Person .");

		assertEquals(ImmutableList.of(getTripleTargetAtom(
				getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#x=", 0, "&y=", 1),
						getVariable("x"), getVariable("y")),
				getConstantIRI(RDF.TYPE),
				getConstantIRI("http://obda.inf.unibz.it/testcase#Person"))), result);
	}

	@Test
	public void test_1_1_quotation() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(
				":Person-{\"id\"} a :Person .");

		assertEquals(ImmutableList.of(getTripleTargetAtom(
				getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
						getVariable("\"id\"")),
				getConstantIRI(RDF.TYPE),
				getConstantIRI("http://obda.inf.unibz.it/testcase#Person"))), result);
	}

	@Test
	public void test_1_1_mysql_quotation() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(
				":Person-{`id`} a :Person .");

		assertEquals(ImmutableList.of(getTripleTargetAtom(
				getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
						getVariable("`id`")),
				getConstantIRI(RDF.TYPE),
				getConstantIRI("http://obda.inf.unibz.it/testcase#Person"))), result);
	}

	@Test
	public void test_1_1_quotation_nested() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(
				":Person-{\"id\"\"\"} a :Person .");

		assertEquals(ImmutableList.of(getTripleTargetAtom(
				getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
						getVariable("\"id\"\"\"")),
				getConstantIRI(RDF.TYPE),
				getConstantIRI("http://obda.inf.unibz.it/testcase#Person"))), result);
	}

	@Test(expected = TargetQueryParserException.class)
	public void test_1_2_empty_placeholder() throws TargetQueryParserException {
		parser.parse("<http://example.org/testcase#Person-{}> a :Person .");
	}

	@Test
	public void test_1_2() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(
				"<http://example.org/testcase#Person-{id}> a :Person .");

		assertEquals(ImmutableList.of(getTripleTargetAtom(
				getIRIFunctionalTerm(Template.of("http://example.org/testcase#Person-", 0),
						getVariable("id")),
				getConstantIRI(RDF.TYPE),
				getConstantIRI("http://obda.inf.unibz.it/testcase#Person"))), result);
	}

	@Test
	public void test_1_2_quotation() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(
				"<http://example.org/testcase#Person-{\"id\"}> a :Person .");

		assertEquals(ImmutableList.of(getTripleTargetAtom(
				getIRIFunctionalTerm(Template.of("http://example.org/testcase#Person-", 0),
						getVariable("\"id\"")),
				getConstantIRI(RDF.TYPE),
				getConstantIRI("http://obda.inf.unibz.it/testcase#Person"))), result);
	}

	@Test
	public void test_1_2_quotation_nested() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(
				"<http://example.org/testcase#Person-{\"\"\"id\"\"\"}> a :Person .");

		assertEquals(ImmutableList.of(getTripleTargetAtom(
				getIRIFunctionalTerm(Template.of("http://example.org/testcase#Person-", 0),
						getVariable("\"\"\"id\"\"\"")),
				getConstantIRI(RDF.TYPE),
				getConstantIRI("http://obda.inf.unibz.it/testcase#Person"))), result);
	}

	@Test
	public void test_1_3() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(
				"<http://example.org/testcase#Person-{id}> a <http://example.org/testcase#Person> .");

		assertEquals(ImmutableList.of(getTripleTargetAtom(
				getIRIFunctionalTerm(Template.of("http://example.org/testcase#Person-", 0),
						getVariable("id")),
				getConstantIRI(RDF.TYPE),
				getConstantIRI("http://example.org/testcase#Person"))), result);
	}

	@Test
	public void test_1_4() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(
				"<http://example.org/testcase#Person-{id}> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://example.org/testcase#Person> .");

		assertEquals(ImmutableList.of(getTripleTargetAtom(
				getIRIFunctionalTerm(Template.of("http://example.org/testcase#Person-", 0),
						getVariable("id")),
				getConstantIRI(RDF.TYPE),
				getConstantIRI("http://example.org/testcase#Person"))), result);
	}

	@Test
	public void test_2_1() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(
				":Person-{id} :hasFather :Person-{id} .");

		assertEquals(ImmutableList.of(getTripleTargetAtom(
				getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
						getVariable("id")),
				getConstantIRI("http://obda.inf.unibz.it/testcase#hasFather"),
				getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
						getVariable("id")))), result);
	}

	@Test
	public void test_2_2() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(
				":Person-{id} :hasFather <http://example.org/testcase#Person-12> .");

		assertEquals(ImmutableList.of(getTripleTargetAtom(
				getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
						getVariable("id")),
				getConstantIRI("http://obda.inf.unibz.it/testcase#hasFather"),
				getConstantIRI("http://example.org/testcase#Person-12"))), result);
	}

	@Test
	public void test_2_3() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(
				":Person-{id} <http://example.org/testcase#hasFather> <http://example.org/testcase#Person-12> .");

		assertEquals(ImmutableList.of(getTripleTargetAtom(
				getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
						getVariable("id")),
				getConstantIRI("http://example.org/testcase#hasFather"),
				getConstantIRI("http://example.org/testcase#Person-12"))), result);
	}

	@Test
	public void test_3_1_database() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(
				":Person-{id} :firstName {fname} .");

		assertEquals(ImmutableList.of(getTripleTargetAtom(
				getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
						getVariable("id")),
				getConstantIRI("http://obda.inf.unibz.it/testcase#firstName"),
				getRDFLiteralFunctionalTerm(TERM_FACTORY.getPartiallyDefinedConversionToString(
						getVariable("fname")), DEFAULT_DATATYPE))), result);
	}

	@Test
	public void test_3_1_database_quotation() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(
				":Person-{id} :firstName {\"fname\"} .");

		assertEquals(ImmutableList.of(getTripleTargetAtom(
				getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
						getVariable("id")),
				getConstantIRI("http://obda.inf.unibz.it/testcase#firstName"),
				getRDFLiteralFunctionalTerm(TERM_FACTORY.getPartiallyDefinedConversionToString(
						getVariable("\"fname\"")), DEFAULT_DATATYPE))), result);
	}

	@Test
	public void test_3_1_new_literal() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(
				":Person-{id} :firstName \"{fname}\" .");

		assertEquals(ImmutableList.of(getTripleTargetAtom(
				getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
						getVariable("id")),
				getConstantIRI("http://obda.inf.unibz.it/testcase#firstName"),
				getRDFLiteralFunctionalTerm(TERM_FACTORY.getPartiallyDefinedConversionToString(
						getVariable("fname")), XSD.STRING))), result);
	}

	@Test
	public void test_3_1_new_literal_quotation() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(
				":Person-{id} :firstName \"{\\\"fname\\\"}\" .");

		assertEquals(ImmutableList.of(getTripleTargetAtom(
				getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
						getVariable("id")),
				getConstantIRI("http://obda.inf.unibz.it/testcase#firstName"),
				getRDFLiteralFunctionalTerm(TERM_FACTORY.getPartiallyDefinedConversionToString(
						getVariable("\"fname\"")), XSD.STRING))), result);
	}

	@Test
	public void test_3_1_empty_literal() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(
				":Person-{id} :firstName \"\" .");

		assertEquals(ImmutableList.of(getTripleTargetAtom(
				getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
						getVariable("id")),
				getConstantIRI("http://obda.inf.unibz.it/testcase#firstName"),
				getRDFLiteralFunctionalTerm(TERM_FACTORY.getDBStringConstant(""), XSD.STRING))), result);
	}

	@Test
	public void test_3_1_new_string() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(
				":Person-{id} :firstName \"{fname}\"^^xsd:string .");

		assertEquals(ImmutableList.of(getTripleTargetAtom(
				getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
						getVariable("id")),
				getConstantIRI("http://obda.inf.unibz.it/testcase#firstName"),
				getRDFLiteralFunctionalTerm(TERM_FACTORY.getPartiallyDefinedConversionToString(
						getVariable("fname")), XSD.STRING))), result);
	}

	@Test
	public void test_3_1_new_iri() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(
				":Person-{id} :firstName <{fname}> .");

		assertEquals(ImmutableList.of(getTripleTargetAtom(
				getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
						getVariable("id")),
				getConstantIRI("http://obda.inf.unibz.it/testcase#firstName"),
				TERM_FACTORY.getIRIFunctionalTerm(
						TERM_FACTORY.getPartiallyDefinedConversionToString(getVariable("fname"))))), result);
	}

	@Test
	public void test_3_2() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(
				":Person-{id} :firstName {fname}^^xsd:string .");

		assertEquals(ImmutableList.of(getTripleTargetAtom(
				getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
						getVariable("id")),
				getConstantIRI("http://obda.inf.unibz.it/testcase#firstName"),
				getRDFLiteralFunctionalTerm(TERM_FACTORY.getPartiallyDefinedConversionToString(
						getVariable("fname")), XSD.STRING))), result);
	}

	@Test
	public void test_3_escape_concat() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(
				":Person-{id} rdfs:label \"adres : {Address} \\\\{city:\\\\} {City}{Country}something\"@en-us .");

		assertEquals(ImmutableList.of(getTripleTargetAtom(
				getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
						getVariable("id")),
				getConstantIRI("http://www.w3.org/2000/01/rdf-schema#label"),
				getRDFLiteralFunctionalTerm(
						TERM_FACTORY.getNullRejectingDBConcatFunctionalTerm(ImmutableList.of(
								TERM_FACTORY.getDBStringConstant("adres : "),
								TERM_FACTORY.getPartiallyDefinedConversionToString(getVariable("Address")),
								TERM_FACTORY.getDBStringConstant(" {city:} "),
								TERM_FACTORY.getPartiallyDefinedConversionToString(getVariable("City")),
								TERM_FACTORY.getPartiallyDefinedConversionToString(getVariable("Country")),
								TERM_FACTORY.getDBStringConstant("something"))), "en-us"))), result);
	}

	@Test
	public void test_3_concat() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(
				":Person-{id} :firstName \"hello {fname}\"^^xsd:string .");

		assertEquals(ImmutableList.of(getTripleTargetAtom(
				getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
						getVariable("id")),
				getConstantIRI("http://obda.inf.unibz.it/testcase#firstName"),
				getRDFLiteralFunctionalTerm(
						TERM_FACTORY.getNullRejectingDBConcatFunctionalTerm(ImmutableList.of(
								TERM_FACTORY.getDBStringConstant("hello "),
								TERM_FACTORY.getPartiallyDefinedConversionToString(getVariable("fname")))), XSD.STRING))), result);
	}

	@Test
	public void test_3_concat_number() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(
				":Person-{id} :firstName \"hello {fname}\"^^xsd:double .");

		assertEquals(ImmutableList.of(getTripleTargetAtom(
				getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
						getVariable("id")),
				getConstantIRI("http://obda.inf.unibz.it/testcase#firstName"),
				getRDFLiteralFunctionalTerm(
						TERM_FACTORY.getNullRejectingDBConcatFunctionalTerm(ImmutableList.of(
								TERM_FACTORY.getDBStringConstant("hello "),
								TERM_FACTORY.getPartiallyDefinedConversionToString(
								getVariable("fname")))), XSD.DOUBLE))), result);
	}

	@Test
	public void test_3_3() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(":Person-{id} :firstName {fname}@en-US .");

		assertEquals(ImmutableList.of(getTripleTargetAtom(
				getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
						getVariable("id")),
				getConstantIRI("http://obda.inf.unibz.it/testcase#firstName"),
				getRDFLiteralFunctionalTerm(TERM_FACTORY.getPartiallyDefinedConversionToString(
						getVariable("fname")), "en-us"))), result);
	}

	@Test
	public void test_4_1_1() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(":Person-{id} :firstName \"John\"^^xsd:string .");

		assertEquals(ImmutableList.of(getTripleTargetAtom(
				getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
						getVariable("id")),
				getConstantIRI("http://obda.inf.unibz.it/testcase#firstName"),
				getRDFLiteralFunctionalTerm(
						TERM_FACTORY.getDBStringConstant("John"), XSD.STRING))), result);
	}

	@Test
	public void test_4_1_2() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(
				":Person-{id} <http://example.org/testcase#firstName> \"John\"^^xsd:string .");

		assertEquals(ImmutableList.of(getTripleTargetAtom(
				getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
						getVariable("id")),
				getConstantIRI("http://example.org/testcase#firstName"),
				getRDFLiteralFunctionalTerm(
						TERM_FACTORY.getDBStringConstant("John"), XSD.STRING))), result);
	}

	@Test
	public void test_4_2_1() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(
				":Person-{id} :firstName \"John\"^^rdfs:Literal .");

		assertEquals(ImmutableList.of(getTripleTargetAtom(
				getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
						getVariable("id")),
				getConstantIRI("http://obda.inf.unibz.it/testcase#firstName"),
				getRDFLiteralFunctionalTerm(
						TERM_FACTORY.getDBStringConstant("John"), RDFS.LITERAL))), result);
	}

	@Test
	public void test_4_2_2() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(
				":Person-{id} :firstName \"John\"@en-US .");

		assertEquals(ImmutableList.of(getTripleTargetAtom(
				getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
						getVariable("id")),
				getConstantIRI("http://obda.inf.unibz.it/testcase#firstName"),
				getRDFLiteralFunctionalTerm(
						TERM_FACTORY.getDBStringConstant("John"), "en-us"))), result);
	}

	@Test
	public void test_5_1_1() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(
				":Person-{id} a :Person ; :firstName {fname} .");

		assertEquals(ImmutableList.of(
				getTripleTargetAtom(
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
								getVariable("id")),
						getConstantIRI(RDF.TYPE),
						getConstantIRI("http://obda.inf.unibz.it/testcase#Person")),

				getTripleTargetAtom(
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
								getVariable("id")),
						getConstantIRI("http://obda.inf.unibz.it/testcase#firstName"),
						getRDFLiteralFunctionalTerm(TERM_FACTORY.getPartiallyDefinedConversionToString(
								getVariable("fname")), DEFAULT_DATATYPE))), result);
	}

	@Test
	public void test_5_1_2() throws TargetQueryParserException {
		final ImmutableList<TargetAtom> result = parser.parse(
				":Person-{id} a :Person ; :firstName {fname} ; :age {age} .");

		assertEquals(ImmutableList.of(
				getTripleTargetAtom(
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
								getVariable("id")),
						getConstantIRI(RDF.TYPE),
						getConstantIRI("http://obda.inf.unibz.it/testcase#Person")),

				getTripleTargetAtom(
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
								getVariable("id")),
						getConstantIRI("http://obda.inf.unibz.it/testcase#firstName"),
						getRDFLiteralFunctionalTerm(TERM_FACTORY.getPartiallyDefinedConversionToString(
								getVariable("fname")), DEFAULT_DATATYPE)),

				getTripleTargetAtom(
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
								getVariable("id")),
						getConstantIRI("http://obda.inf.unibz.it/testcase#age"),
						getRDFLiteralFunctionalTerm(TERM_FACTORY.getPartiallyDefinedConversionToString(
								getVariable("age")), DEFAULT_DATATYPE))), result);
	}

	@Test
	public void test_5_1_3() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(
				":Person-{id} a :Person ; :hasFather :Person-{id} ; :firstName {fname} ; :age {age} .");

		assertEquals(ImmutableList.of(
				getTripleTargetAtom(
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
								getVariable("id")),
						getConstantIRI(RDF.TYPE),
						getConstantIRI("http://obda.inf.unibz.it/testcase#Person")),

				getTripleTargetAtom(
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
								getVariable("id")),
						getConstantIRI("http://obda.inf.unibz.it/testcase#hasFather"),
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
								getVariable("id"))),

				getTripleTargetAtom(
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
								getVariable("id")),
						getConstantIRI("http://obda.inf.unibz.it/testcase#firstName"),
						getRDFLiteralFunctionalTerm(TERM_FACTORY.getPartiallyDefinedConversionToString(
								getVariable("fname")), DEFAULT_DATATYPE)),

				getTripleTargetAtom(
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
								getVariable("id")),
						getConstantIRI("http://obda.inf.unibz.it/testcase#age"),
						getRDFLiteralFunctionalTerm(TERM_FACTORY.getPartiallyDefinedConversionToString(
								getVariable("age")), DEFAULT_DATATYPE))), result);
	}

	@Test
	public void test_5_2_1() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(
				":Person-{id} a :Person ; :firstName {fname}^^xsd:string .");

		assertEquals(ImmutableList.of(
				getTripleTargetAtom(
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
								getVariable("id")),
						getConstantIRI(RDF.TYPE),
						getConstantIRI("http://obda.inf.unibz.it/testcase#Person")),

				getTripleTargetAtom(
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
								getVariable("id")),
						getConstantIRI("http://obda.inf.unibz.it/testcase#firstName"),
						getRDFLiteralFunctionalTerm(TERM_FACTORY.getPartiallyDefinedConversionToString(
								getVariable("fname")), XSD.STRING))), result);
	}

	@Test
	public void test_5_2_2() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(
				":Person-{id} a :Person ; :firstName {fname}^^xsd:string ; :age {age}^^xsd:integer .");

		assertEquals(ImmutableList.of(
				getTripleTargetAtom(
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
								getVariable("id")),
						getConstantIRI(RDF.TYPE),
						getConstantIRI("http://obda.inf.unibz.it/testcase#Person")),

				getTripleTargetAtom(
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
								getVariable("id")),
						getConstantIRI("http://obda.inf.unibz.it/testcase#firstName"),
						getRDFLiteralFunctionalTerm(TERM_FACTORY.getPartiallyDefinedConversionToString(
								getVariable("fname")), XSD.STRING)),

				getTripleTargetAtom(
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
								getVariable("id")),
						getConstantIRI("http://obda.inf.unibz.it/testcase#age"),
						getRDFLiteralFunctionalTerm(TERM_FACTORY.getPartiallyDefinedConversionToString(
								getVariable("age")), XSD.INTEGER))), result);
	}

	@Test
	public void test_5_2_3() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(
				":Person-{id} a :Person ; :hasFather :Person-{id} ; :firstName {fname}^^xsd:string ; :age {age}^^xsd:integer .");

		assertEquals(ImmutableList.of(
				getTripleTargetAtom(
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
								getVariable("id")),
						getConstantIRI(RDF.TYPE),
						getConstantIRI("http://obda.inf.unibz.it/testcase#Person")),

				getTripleTargetAtom(
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
								getVariable("id")),
						getConstantIRI("http://obda.inf.unibz.it/testcase#hasFather"),
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
								getVariable("id"))),

				getTripleTargetAtom(
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
								getVariable("id")),
						getConstantIRI("http://obda.inf.unibz.it/testcase#firstName"),
						getRDFLiteralFunctionalTerm(TERM_FACTORY.getPartiallyDefinedConversionToString(
								getVariable("fname")), XSD.STRING)),

				getTripleTargetAtom(
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
								getVariable("id")),
						getConstantIRI("http://obda.inf.unibz.it/testcase#age"),
						getRDFLiteralFunctionalTerm(TERM_FACTORY.getPartiallyDefinedConversionToString(
								getVariable("age")), XSD.INTEGER))), result);
	}

	@Test
	public void test_5_2_4() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(
				":Person-{id} a :Person ; :hasFather :Person-{id} ; :firstName {fname}^^xsd:string ; :age {age}^^xsd:integer ; :description {text}@en-US .");

		assertEquals(ImmutableList.of(
				getTripleTargetAtom(
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
								getVariable("id")),
						getConstantIRI(RDF.TYPE),
						getConstantIRI("http://obda.inf.unibz.it/testcase#Person")),

				getTripleTargetAtom(
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
								getVariable("id")),
						getConstantIRI("http://obda.inf.unibz.it/testcase#hasFather"),
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
								getVariable("id"))),

				getTripleTargetAtom(
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
								getVariable("id")),
						getConstantIRI("http://obda.inf.unibz.it/testcase#firstName"),
						getRDFLiteralFunctionalTerm(TERM_FACTORY.getPartiallyDefinedConversionToString(
								getVariable("fname")), XSD.STRING)),

				getTripleTargetAtom(
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
								getVariable("id")),
						getConstantIRI("http://obda.inf.unibz.it/testcase#age"),
						getRDFLiteralFunctionalTerm(TERM_FACTORY.getPartiallyDefinedConversionToString(
								getVariable("age")), XSD.INTEGER)),

				getTripleTargetAtom(
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
								getVariable("id")),
						getConstantIRI("http://obda.inf.unibz.it/testcase#description"),
						getRDFLiteralFunctionalTerm(TERM_FACTORY.getPartiallyDefinedConversionToString(
								getVariable("text")), "en-us"))), result);
	}

	@Test
	public void test_5_2_5() throws TargetQueryParserException {
		final ImmutableList<TargetAtom> result = parser.parse(
				":Person-{id} a <http://example.org/testcase#Person> ; <http://example.org/testcase:hasFather> :Person-{id} ; <http://example.org/testcase#firstName> {fname}^^xsd:string ; <http://example.org/testcase#age> {age}^^xsd:integer ; <http://example.org/testcase#description> {text}@en-US .");

		assertEquals(ImmutableList.of(
				getTripleTargetAtom(
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
								getVariable("id")),
						getConstantIRI(RDF.TYPE),
						getConstantIRI("http://example.org/testcase#Person")),

				getTripleTargetAtom(
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
								getVariable("id")),
						getConstantIRI("http://example.org/testcase:hasFather"),
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
								getVariable("id"))),

				getTripleTargetAtom(
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
								getVariable("id")),
						getConstantIRI("http://example.org/testcase#firstName"),
						getRDFLiteralFunctionalTerm(TERM_FACTORY.getPartiallyDefinedConversionToString(
								getVariable("fname")), XSD.STRING)),

				getTripleTargetAtom(
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
								getVariable("id")),
						getConstantIRI("http://example.org/testcase#age"),
						getRDFLiteralFunctionalTerm(TERM_FACTORY.getPartiallyDefinedConversionToString(
								getVariable("age")), XSD.INTEGER)),

				getTripleTargetAtom(
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
								getVariable("id")),
						getConstantIRI("http://example.org/testcase#description"),
						getRDFLiteralFunctionalTerm(TERM_FACTORY.getPartiallyDefinedConversionToString(
								getVariable("text")), "en-us"))), result);
	}

	@Ignore("TODO: should we forbid non-recognized datatypes using the XSD prefix?")
	@Test
	public void test_6_1() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(":Person-{id} a :Person ; :firstName {fname}^^xsd:String .");
		assertEquals(1, result.size());
	}

	@Test
	public void test_6_1_literal() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(
				":Person-{id} a :Person ; :firstName \"Sarah\" .");

		assertEquals(ImmutableList.of(
				getTripleTargetAtom(
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
								getVariable("id")),
						getConstantIRI(RDF.TYPE),
						getConstantIRI("http://obda.inf.unibz.it/testcase#Person")),

				getTripleTargetAtom(
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-",  0),
								getVariable("id")),
						getConstantIRI("http://obda.inf.unibz.it/testcase#firstName"),
						getRDFLiteralFunctionalTerm(
								TERM_FACTORY.getDBStringConstant("Sarah"), XSD.STRING))), result);
	}

	@Test
	public void test_6_2() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(":Person-{id} a :Person ; :firstName {fname}^^ex:randomDatatype .");

		assertEquals(ImmutableList.of(
				getTripleTargetAtom(
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
								getVariable("id")),
						getConstantIRI(RDF.TYPE),
						getConstantIRI("http://obda.inf.unibz.it/testcase#Person")),

				getTripleTargetAtom(
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
								getVariable("id")),
						getConstantIRI("http://obda.inf.unibz.it/testcase#firstName"),
						getRDFLiteralFunctionalTerm(TERM_FACTORY.getPartiallyDefinedConversionToString(
								getVariable("fname")),
								RDF_FACTORY.createIRI("http://www.example.org/randomDatatype")))), result);
	}

	@Test
	public void test_8_1() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(
				":Person-{id} rdf:type :Person .");

		assertEquals(ImmutableList.of(getTripleTargetAtom(
				getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#Person-", 0),
						getVariable("id")),
				getConstantIRI(RDF.TYPE),
				getConstantIRI("http://obda.inf.unibz.it/testcase#Person"))), result);
	}

	@Test
	public void test_8_2() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(
				"ex:Person-{id} rdf:type ex:Person .");

		assertEquals(ImmutableList.of(getTripleTargetAtom(
				getIRIFunctionalTerm(Template.of("http://www.example.org/Person-", 0),
						getVariable("id")),
				getConstantIRI(RDF.TYPE),
				getConstantIRI("http://www.example.org/Person"))), result);
	}

	@Test
	public void test_8_3() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(
				"ex:Person-{id} ex:hasFather ex:Person-123 .");

		assertEquals(ImmutableList.of(getTripleTargetAtom(
				getIRIFunctionalTerm(Template.of("http://www.example.org/Person-", 0),
						getVariable("id")),
				getConstantIRI("http://www.example.org/hasFather"),
				getConstantIRI("http://www.example.org/Person-123"))), result);
	}

	@Test
	public void test_8_4() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(
				"ex:Person/{id}/ ex:hasFather ex:Person/123/ .");

		assertEquals(ImmutableList.of(getTripleTargetAtom(
				getIRIFunctionalTerm(Template.builder().addSeparator("http://www.example.org/Person/").addColumn().addSeparator("/").build(),
						getVariable("id")),
				getConstantIRI("http://www.example.org/hasFather"),
				getConstantIRI("http://www.example.org/Person/123/"))), result);
	}

	// ROMAN 26/11/20: added : to make {first_name} an IRI template
	@Test
	public void test_9_1() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(":S_{id} a :Student ; :fname :{first_name} ; :hasCourse :C_{course_id}  .\n" +
				":C_{course_id} a :Course ; :hasProfessor :P_{id} . \n" +
				":P_{id} a :Professor ; :teaches :C_{course_id} .\n" +
				":{first_name} a :Name . ");
		assertEquals(8, result.size());
	}

	// ROMAN 26/11/20: added a few : to make them IRI templates
	@Test
	public void test_9_2() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(":{idEmigrante} a  :E21_Person ; :P131_is_identified_by :{nome} ; :P11i_participated_in :{numCM} .\n" +
				":{nome} a :E82_Actor_Appellation ; :P3_has_note {nome}^^xsd:string .\n" +
				":{numCM} a :E9_Move .");
		assertEquals(6, result.size());
	}

	@Test
	public void test_for_value_constant() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(":Person-{id} a :Person ; :age 25 ; :hasDegree true ; :averageGrade 28.3 .");
		assertEquals(4, result.size());
	}

	@Test(expected = TargetQueryParserException.class)
	public void test_for_fully_qualified_column() throws TargetQueryParserException {
		parser.parse(":Person-{person.id} a  :Person ;  :age 25 .");
	}

	@Test(expected = TargetQueryParserException.class)
	public void test_for_language_tag_from_a_variable() throws TargetQueryParserException {
		parser.parse(":Person-{id} a :Person ; :firstName {name}@{lang} . ");
	}

	@Test
	public void test_BNODE_object() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse("<http://example.com/emp/{empno}> <http://example.com/emp#c_ref_deptno> _:{deptId} .");
		assertEquals(ImmutableList.of(getTripleTargetAtom(
				getIRIFunctionalTerm(Template.of("http://example.com/emp/", 0),
						getVariable("empno")),
				getConstantIRI("http://example.com/emp#c_ref_deptno"),
				TERM_FACTORY.getBnodeFunctionalTerm(
						TERM_FACTORY.getPartiallyDefinedConversionToString(getVariable("deptId"))))), result);
	}

	// Reproduces Issue #319
	@Test
	public void test_BNODE_function() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse("<http://esricanada.com/gfx_ontology_prototype/{feature_hash}> a <http://ontology.eil.utoronto.ca/icity/LandUse/Parcel> ; <http://ontology.eil.utoronto.ca/icity/LandUse/hasLandUse> _:landuse{feature_hash} .");
		assertEquals(ImmutableList.of(
				getTripleTargetAtom(
						getIRIFunctionalTerm(Template.of("http://esricanada.com/gfx_ontology_prototype/", 0),
								getVariable("feature_hash")),
						getConstantIRI(RDF.TYPE),
						getConstantIRI("http://ontology.eil.utoronto.ca/icity/LandUse/Parcel")),
				getTripleTargetAtom(
						getIRIFunctionalTerm(Template.of("http://esricanada.com/gfx_ontology_prototype/", 0),
								getVariable("feature_hash")),
						getConstantIRI("http://ontology.eil.utoronto.ca/icity/LandUse/hasLandUse"),
						getBnodeFunctionalTerm(Template.of("landuse", 0),
								getVariable("feature_hash")))), result);
	}

	@Test
	public void test_GRAPH_1() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(
				"GRAPH <http://www.ciao.it/{id}> { :{id} a :C . }");

		assertEquals(ImmutableList.of(getQuadTargetAtom(
				getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#", 0),
						getVariable("id")),
				getConstantIRI(RDF.TYPE),
				getConstantIRI("http://obda.inf.unibz.it/testcase#C"),
				getIRIFunctionalTerm(Template.of("http://www.ciao.it/", 0),
						getVariable("id")))), result);
	}

	@Test
	public void test_GRAPH_2() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(
				"GRAPH <http://www.ciao.it/{id}> { :{id} a :C ; :P :{attr1} . }");

		assertEquals(ImmutableList.of(
				getQuadTargetAtom(
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#", 0),
								getVariable("id")),
						getConstantIRI(RDF.TYPE),
						getConstantIRI("http://obda.inf.unibz.it/testcase#C"),
						getIRIFunctionalTerm(Template.of("http://www.ciao.it/", 0),
								getVariable("id"))),

				getQuadTargetAtom(
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#", 0),
								getVariable("id")),
						getConstantIRI("http://obda.inf.unibz.it/testcase#P"),
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#", 0),
								getVariable("attr1")),
						getIRIFunctionalTerm(Template.of("http://www.ciao.it/", 0),
								getVariable("id")))), result);
	}

	@Test
	public void test_GRAPH_3() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(
				"GRAPH <http://www.ciao.it/{id}> { :{id} a :C . :{id} :P :{attr1} . }");

		assertEquals(ImmutableList.of(
				getQuadTargetAtom(
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#", 0),
								getVariable("id")),
						getConstantIRI(RDF.TYPE),
						getConstantIRI("http://obda.inf.unibz.it/testcase#C"),
						getIRIFunctionalTerm(Template.of("http://www.ciao.it/", 0),
								getVariable("id"))),

				getQuadTargetAtom(
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#", 0),
								getVariable("id")),
						getConstantIRI("http://obda.inf.unibz.it/testcase#P"),
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#", 0),
								getVariable("attr1")),
						getIRIFunctionalTerm(Template.of("http://www.ciao.it/", 0),
								getVariable("id")))), result);
	}

	@Test
	public void test_GRAPH_4() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(
				"GRAPH :uni1 { :uni1/student/{s_id} a :Student ; ex:firstName {first_name}^^xsd:string ; ex:lastName {last_name}^^xsd:string . }");

		assertEquals(ImmutableList.of(
				getQuadTargetAtom(
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#uni1/student/", 0),
								getVariable("s_id")),
						getConstantIRI(RDF.TYPE),
						getConstantIRI("http://obda.inf.unibz.it/testcase#Student"),
						getConstantIRI("http://obda.inf.unibz.it/testcase#uni1")),

				getQuadTargetAtom(
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#uni1/student/", 0),
								getVariable("s_id")),
						getConstantIRI("http://www.example.org/firstName"),
						getRDFLiteralFunctionalTerm(TERM_FACTORY.getPartiallyDefinedConversionToString(
								getVariable("first_name")), XSD.STRING),
						getConstantIRI("http://obda.inf.unibz.it/testcase#uni1")),

				getQuadTargetAtom(
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#uni1/student/", 0),
								getVariable("s_id")),
						getConstantIRI("http://www.example.org/lastName"),
						getRDFLiteralFunctionalTerm(TERM_FACTORY.getPartiallyDefinedConversionToString(
								getVariable("last_name")), XSD.STRING),
						getConstantIRI("http://obda.inf.unibz.it/testcase#uni1"))), result);
	}

	@Test
	public void test_GRAPH_5() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(
				"GRAPH :uni1 { :uni1/student/{s_id} a :Student ; ex:firstName {first_name}^^xsd:string ; ex:lastName {last_name}^^xsd:string . } " +
				"GRAPH :uni2 { :uni2/student/{s_id} a :Student . }");

		assertEquals(ImmutableList.of(
				getQuadTargetAtom(
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#uni1/student/", 0),
								getVariable("s_id")),
						getConstantIRI(RDF.TYPE),
						getConstantIRI("http://obda.inf.unibz.it/testcase#Student"),
						getConstantIRI("http://obda.inf.unibz.it/testcase#uni1")),

				getQuadTargetAtom(
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#uni1/student/", 0),
								getVariable("s_id")),
						getConstantIRI("http://www.example.org/firstName"),
						getRDFLiteralFunctionalTerm(TERM_FACTORY.getPartiallyDefinedConversionToString(
								getVariable("first_name")), XSD.STRING),
						getConstantIRI("http://obda.inf.unibz.it/testcase#uni1")),

				getQuadTargetAtom(
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#uni1/student/", 0),
								getVariable("s_id")),
						getConstantIRI("http://www.example.org/lastName"),
						getRDFLiteralFunctionalTerm(TERM_FACTORY.getPartiallyDefinedConversionToString(
								getVariable("last_name")), XSD.STRING),
						getConstantIRI("http://obda.inf.unibz.it/testcase#uni1")),

				getQuadTargetAtom(
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#uni2/student/", 0),
								getVariable("s_id")),
						getConstantIRI(RDF.TYPE),
						getConstantIRI("http://obda.inf.unibz.it/testcase#Student"),
						getConstantIRI("http://obda.inf.unibz.it/testcase#uni2"))), result);
	}

	@Test
	public void test_GRAPH_6() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(
				"GRAPH :uni1 { :uni1/student/{s_id} a :Student . } " +
						" :uni3/student/{s_id} a :Student . " +
						"GRAPH :uni2 { :uni2/student/{s_id} a :Student . }");

		assertEquals(ImmutableList.of(
				getQuadTargetAtom(
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#uni1/student/", 0),
								getVariable("s_id")),
						getConstantIRI(RDF.TYPE),
						getConstantIRI("http://obda.inf.unibz.it/testcase#Student"),
						getConstantIRI("http://obda.inf.unibz.it/testcase#uni1")),

				getTripleTargetAtom(
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#uni3/student/", 0),
								getVariable("s_id")),
						getConstantIRI(RDF.TYPE),
						getConstantIRI("http://obda.inf.unibz.it/testcase#Student")),

				getQuadTargetAtom(
						getIRIFunctionalTerm(Template.of("http://obda.inf.unibz.it/testcase#uni2/student/", 0),
								getVariable("s_id")),
						getConstantIRI(RDF.TYPE),
						getConstantIRI("http://obda.inf.unibz.it/testcase#Student"),
						getConstantIRI("http://obda.inf.unibz.it/testcase#uni2"))), result);
	}

	@Ignore("Anonymous blank nodes are not supported in general")
	@Test
	public void test_qootec() throws TargetQueryParserException {
		ImmutableList<TargetAtom> result = parser.parse(
				":observation/{observationID} a ex:Observation ;\n" +
				"\tex:hasFeatureOfInterest :apartment/{apartmentID} ;\n" +
				"\tex:hasResult [\n" +
				"\ta ex:QuantityValue ;\n" +
				"\tex:unit ex:DegreeCelsius ;\n" +
				"\tex:numericValue {observedTemperature}^^xsd:double ] .");
		assertEquals(6, result.size());
	}
}


text:
Keep cool and carry on: Joining forces on World Ozone Day
Realizing change
Near Nalma, Nepal. CIFOR/Mokhamad Edliadi
Landscape News Editor
By Monica Evans, a regular contributor to Landscape News.
It may be old news now, but it's still cause for celebration – and inspiration.
In the 1980s and 1990s, the growing hole in the ozone layer was an extremely scary prospect. Discovered in 1985, it was also revealed to be caused by human activity: namely, the emission of ozone-depleting substances (ODS) such as chlorofluorocarbons (CFCs), which were widely used in refrigeration, air conditioning and aerosols. As scientists scrabbled for solutions, products like hairspray – that harmless-seeming hallmark of 1980s fashion – took on a more sinister significance.
However, in an uplifting example of collective global action, policymakers and scientists from around the world came together to negotiate the Montreal Protocol, which was adopted in 1987. Under the Protocol, the use of ozone-depleting substances – which are also potent global-warming gases – was all but phased out around the world over the ensuing decades. Over 98 percent of identified ODSs have now been eliminated: and ahead of schedule, too.
As a result, the hole began to "heal," and it is predicted to return to 1980 levels by around 2050. It's estimated that this may prevent up to 2 million cases of skin cancer every year to 2030, and that it has already kept the planet considerably cooler than it would otherwise have been. As environmental treaties go, the protocol is often considered the most successful and effective ever forged.
But that doesn't mean it's time to sit back on our haunches, said Tina Birmpili, executive secretary of the Montreal Protocol's secretariat in a statement on this year's upcoming World Ozone Day, which will take place on Sept. 16. "We can be proud of how we have protected the ozone layer and the climate, but we must also focus on what more we can do," she said.
One issue is the ongoing use of hydrofluorocarbons (HFCs), which are widely-used substitutes for ODSs, but which have recently been discovered to be extremely powerful climate-warming gases that can be thousands of times more potent than carbon dioxide in contributing to climate change. The Kigali Amendment to the Protocol – which will enter into force on Jan. 1, 2019 – aims to confront this issue by obliging ratifying countries to cut their production and consumption of HFCs by more than 80 percent over the next 30 years.
As such, Birmpili is urging people to "keep cool and carry on" on Sept. 16, by celebrating what has been achieved, continuing to protect the ozone layer, and dialling up action to mitigate climate change.
So beyond lobbying our governments to ratify and honor the Kigali Amendment, what else can we do? There are a number of steps we can take to limit ozone-depleting gas emissions in our very own homes.
In the bigger picture, recent studies have shown that preserving peatlands is crucial, not only for keeping carbon dioxide in the ground, but also to prevent the emission of nitrous oxide, which is now one of the biggest contributors to ozone depletion worldwide.
10 tips for protecting the ozone layer
Did you know that if you've got a fridge, freezer and/or air conditioner at home (or in the car), you're harboring a hotbed of ozone-depleting substances (ODSs)? These appliances all use ODSs, in the form of refrigerant gases, to function. But by using them economically, and taking care of them carefully, we can minimize leakage of these gases into the atmosphere.
Here are ten ways to be more responsible with refrigerants:
Check for leaks in fridges, freezers and air conditioners, and get them repaired.
Ask for experts when repairing or servicing these appliances. Make sure repairs are done well and carrier gases are recycled properly.
Dispose of old fridges, freezers and air conditioners responsibly: take them to a qualified expert who can safely get rid of the gases, before recycling the other components.
Position fridges somewhere where air can circulate easily at the back, and avoid placing it next to an oven or dishwasher.
Clean fridges and de-ice freezers on a regular basis.
Don't over-fill freezers: just store what's really necessary.
Position your air-conditioner condenser in the shade outside, and clean this and the evaporator regularly.
Insulate your walls, doors and windows to improve energy efficiency and prolong the life of your appliances.
Switch all these appliances off when they're not in use.
Drive for a few minutes with the windows open before you turn your car's air conditioner on, and park in the shade.
Source: UNEP Ozone Secretariat
Antarctic ozone depletion influences rainfall in tropics
Draining peatlands leads to greenhouse laughing gas emissions, study shows
environmentgreenhouse gasesozoneWorld Ozone Day

redpajama_set_name: RedPajamaCommonCrawl


text:
Northumberland weather forecast: This is when heavy rain will hit
Heavy rain is set for a return on Saturday, November 23 as a yellow weather warning has been released.
By Faye Dixon
Friday, 22nd November 2019, 3:20 pm
Updated Friday, 22nd November 2019, 3:23 pm
Heavy rain is expected to continue all day.
What will the weather be like across Northumberland this morning?
This morning will see heavy rain begin early in the day with dark clouds forming from as early as 7am. The temperature will reach its peak of 9C by 7am when there will be an 60% chance of rain.
What about this afternoon?
This afternoon will see more heavy showers reaching a 90% chance of rain as more cloud is also set to pass over. Met Office forecasters say the temperature will remain at its peak of 9C throughout.
What will the weather be like this evening and tonight across Northumberland?
Early evening will see a mix of light and heavy showers continue throughout the evening until around 10pm, turning cloudier later but remaining dry throughout the remainder of the night. The rain will be at its heaviest in hilly areas. Expect an overnight continuous temperature of 9C.
What will the weather be like tomorrow?
Sunday, November 24 is predicted to be cloudy but we should see a lot less rain. Flooding in some areas could be likely. A maximum temperature of 9C is expected.
What is the long-term forecast for the North East?
The Met Office UK outlook for Sunday, November 24 to Tuesday, November 26 said: "Early rain on Sunday, then brightening up with a few showers. Breezy on Monday, with rain clearing to scattered showers later. Tuesday probably brighter again with some showers."


text:
Writers from New Jersey (X) 1885 (X)
Writers from New Jersey
Words to Wright By
Robin Bayne
Mountain View Publishing
Subjects: Fiction, Drama and Literature, Inspirational
...tionals they?ve contributed reflect all aspects of the writing life: basic motivation, rejection, publishing and succeeding. Spend some time with the writers you love and discover what words they write by. www.robinbayne.com...
...mational storage and retrieval system, without express permission in writing from the publishers. ISBN: 978-1-932695-79-3 "Scripture taken from the N... ...ting from the publishers. ISBN: 978-1-932695-79-3 "Scripture taken from the New Century V ersion. Copyright © 2005 by Thomas Nelson, Inc. Used by ... ...s Nelson, Inc. Used by permission. All rights reserved." "Scripture taken from the NEW AMERICAN STANDARD BIBLE®, Copyright © 1960,1962,1963,1968,19... ... Inc. Used by permission. All rights reserved." "Scripture taken from the NEW AMERICAN STANDARD BIBLE®, Copyright © 1960,1962,1963,1968,1971,1972,1... ...5,1977,1995 by The Lockman Foundation. Used by permission." "Scripture taken from the New King James V ersion. Copyright © 1982 by Thomas Nelson, I... ...95 by The Lockman Foundation. Used by permission." "Scripture taken from the New King James V ersion. Copyright © 1982 by Thomas Nelson, Inc. Used ... ...s "lesson" to my writing, and how to share my own favorite verses with other writers. Many writers keep a favorite quote or Bible verse taped to their... ...liefs, as do every writer's choice selections. I have asked some of the best writers in the business to share their inspiration with us, their favorit... ...n life. Instead of fame, God has blessed me through my publishing houses and writers groups with some of the dearest friends I've ever known. Instead ...
Links and Factoids
Narcissus Publications Imprint
Subjects: Non Fiction, Education, Schools
Collections: Authors Community
...art thereof, may not be used or reproduced in any manner without written permission from: Lidija Rangelovska – write to: palma@unet.com.mk Visit... ...e her his consort by changing the law to allow for a morganatic marriage (of people from different classes, with no rights of inheritance). Simpson ... ...Standard at the beginning of the Civil War on 22 August 1642." Edward abdicated from the throne on 11 December 1936, making a different speech. ... ...u (The Boat), hung upside down for 2 months in 1961 in the Museum of Modern Art in New York. Not one of the art critics, journalists, 116,000 visit... ...ryplace.com/speeches/berliner.htm Bible The Jews do not include the 27 books of New Testament in their Bible. The factoids below relate to the v... ...late to the version of the Bible used by Christians everywhere: Old (39 books) and New Testament. Altogether 1189 chapters (929 of which are in the... ... on to a bedsheet, securely fastened to tree trunks in his back yard in Camden, New Jersey. The sound was broadcast from a radio placed behind the ... ...nvalidated by the courts) and the first drive-opened on June 6, 1933 in Camden, New Jersey. The price of admission was 25 cents per car and another ... ...18 million copies. James Bond novels are now being authored by a new generation of writers. In 1961, John F, Kennedy, the newly elected president,...
...000 copies distributed in Williamstown, in addition to more than 600 subscribers across the country. The newspaper does not receive financial support from the college or from the student government and relies on revenue generated by local and national ad sales, subscriptions, and voluntary contributions for use of its website. Both Sawyer Library and the College Archives m...
...on itself wns entirely suo- oessful, and despite its humorous side, tied a new itnot in tlie bond of ail Williams men. The parade, the fireworks, the ... ...tunate that we have scarcely any light this even ing; the old moon and the new must be hiding behind Jesup But, fortunately, Diogenes Hughes has promi... ...except Dompsoy's 'pep- per mill.' The senior committee has provided, as in New York theaters, safe escorts tor visitors of the fair sex and also two i... ...fe escorts tor visitors of the fair sex and also two illustri- ous orators from the lower classes. Ijet me introduce to you the sophomore orator, Mr. ... ...here to thank the various alumni who, unsolicit- ed, have contributed news from time to time. The same prinoiplo obtains in the collection of under- g... ... who have not yet had the ad- vantage of being able to consider tpiestions from an alumni stand point. For the stutleiit, it is a channel thrc.ugh whi... ... a brilli- ant stylist, and belongs to the decorative, prose-poet order of writers. While it is true that in many of his personal traits he re- minds ... ...nilwr which show increasing ease and creative faculty on the part of thair writers. ""The Gate of Tears'" by Mr. Westerraann, is espuoially sweet, ten... ...herbe. Balzac, Descartes. Pascal, the scholar and poet, and the dra- matic writers of the French stage before Oorneille, RUNAWAY GAME WITH RUTGERS Wil...
A Unifying Field in Logics : Neutrosophic Logic. Neutrosophy, Neutrosophic Set, Neutrosophic Probability
Florentin Smarandache
American Research Press
Subjects: Non Fiction, Philosophy, Art
Collections: Philosophy
...It was known to me his setting up in 1980's of a new literary and artistic avant-garde movement that he called "paradoxism", because I received some books and papers dealing with it in order to review them for the German journal "Zentralblatt fár Mathematik". It was an insp...
...ents: Preface by Charles T. Le: 3 0. Introduction: 9 1. Neutrosophy - a new branch of philosophy: 13 2. Neutrosophic Logic - a unifying field in ... ...lities - and Neutrosophic Statistics: 116 5. Addenda: Definitions derived from Neutrosophics: 120 2 Preface to Neutrosophy and Neutrosophic Logic... ...troduction. It was a surprise for me when in 1995 I received a manuscript from the mathematician, experimental writer and innovative painter Florent... ...es - and logics. He had generalized the fuzzy logic, and introduced two new concepts: a) "neutrosophy" – study of neutralities as an extension of... ..."neutrosophic probability", and "neutrosophic statistics" and thus opening new ways of research in four fields: philosophy, logics, set theory, and p... ...paper, which, in fact, represent an "artificial poem": deformed, resulted from a translation by the observant of the observed, and by translation on... .... The book of the non-poems is a protest against art's marketing. Do you writers sell your feelings? Do you create only for money?? Only books abou... ...llerstein, N. S., DELTA, Α Paradox Logic, World Scientific, Singapore, New Jersey, London, Hong Kong, 1999. [72] Hoffmann, Banesh, The strange Story...
The Marketing of Ideas and Social Issues
Seymour Fine
Praeger Publishers
Subjects: Non Fiction, Psychology, Education
...An idea is taken for granted in the scheme of things. Someone exclaims, "I've got an idea!" What is it that he has? From where did he get it? How was it transmitted? How might it spread to others? What will be the effect of the acceptance of the idea? These are some of the questions dealt with in this book. In this first chapter the nature...
...SOCIAL ISSUES 12 ORIGINATION, MATURATION AND ADOPTION OF IDEAS: A MICROPROCESS 12 FROM PROBLEMS TO SOCIAL ISSUES TO SOCIAL CHANGE: A MACROPROCESS 14... ...auses 14 SOME CONCEPTS AND THEIR ATTRIBUTES 15 INCREASE IN CONCERN WITH IDEAS 17 From Inner to Other-Directedness 17 Voluntary Simplicity 18 SUMM... ...h As Problem Solving. 20 IDEAS AS PRODUCTS: SOCIAL MARKETING 21 Deriving benefits from product offerings 21 The "Scope Broadening" Debate 22 Socia... ...52 Product Form 52 The Product Life Cycle (PLC) 53 The Concept Of A Product Mix: New Product Development 56 PROBLEMS IN STRATEGIC PLANNING FOR SOC... ...ion) in this endeavor. While it is hard to evaluate the first book written on any new subject, I am sure that Fine's work will gain recognition as ... ... of those opposing the established order, in other words, brainwashing. Webster's New World Dictionary , in fact , states that the word is "now oft... ...products in this book. Under the rubric "characteristics of innovations," several writers have isolated and discussed attributes possessed by ideas... ... marketing seems to have earned for itself two different definitions (Luck 1974). Writers have applied the expression in one sense to mean the socia... ...sing on environmental conservation factors is that of Perry (1976). However, most writers agree with Takas (1974) who applies the expression societa...
Cyclopedia of Economics
Subjects: Non Fiction, Education, Economics
Collections: Mathematics
...art thereof, may not be used or reproduced in any manner without written permission from: Lidija Rangelovska – write to: palma@unet.com.mk or to ... ...- but there can be no doubt that it exists. Its rights - whatever they are - derive from the fact that it exists and that it has the potential to de... ...'s right not to be killed include the right against third parties that they refrain from enforcing the rights of other people against A? Does A's ri... ...scheme known as the stock exchange, this expectation is proportional to liquidity - new suckers - and volatility. Thus, the price of any given stock... ...Honderich, Ted, ed. - The Oxford Companion to Philosophy - Oxford University Press, New York, 1995 - p. 31) Anarchists are not opposed to organizat... ...urished at these times. The dotcom revolution was less about technology than about new ways of doing business - mixing umpteen irreconcilable ingre... ...ows for immediate feedback and for flowing, almost real-time, communication between writers and readers. The electronic version, therefore, acquires... ... it as a road to the same kind of broad and deep understanding of human nature that writers possess." Anna Freud Towards the end of the 19th c... ...", observes Lionel Tiger, a professor of anthropology at Rutgers University in New Jersey. That three quarters of all divorces are initiated by wom...
Cyclopedia of Philosophy
Subjects: Non Fiction, Religion, Philosophy


text:
Yemen rebel leader meets UN envoy amid clashes in port city
By AHMED AL-HAJ Associated Press
November 22, 2018 — 10:35am
SANAA, Yemen — The leader of Yemen's Shiite rebels has met U.N. envoy Martin Griffiths in the capital Sanaa to discuss peace talks hoped for next month, as fighting continues in the key port city of Hodeida.
A rebel statement Thursday says Abdul-Malek al-Houthi stressed that the Saudi-led coalition battling his group should establish "credibility" that it truly seeks "a political solution" before any such meeting.
Meanwhile, Yemeni security officials on the ground in Hodeida say fighting rages on in the area, with both sides using heavy weapons, scrapping a plan for Griffiths to visit the city. Hopes remain he will be able to arrive on Friday, they added, speaking on condition of anonymity as they weren't authorized to brief reporters.
Griffiths has said both sides have agreed to attend peace talks.


We recognize your business is unique. That means our regularly-scheduled classes might not be exactly what you need.
Our Business and Industry staff recognizes one size does not always fit all. In fact, much of what we do comes in the area of what we call customized training.
Someone from our staff sits down with you to determine your exact needs.
Together, we determine a training plan. This includes the goals for the training, the information to be covered, the number of training hours required and a timeline for when it will take place. Occasionally, an employer will discover we have a class already in place that will meet their needs perfectly. When that doesn't happen, we are prepared to develop specific materials that do meet those needs.
The training takes place, either at the worksite or at one of our facilities. That decision is based on a variety of factors. The training might be required to happen at the worksite because the employees are working on specialized equipment only available there. However, with the many facilities and equipment the college has in place, employers often choose to conduct the training off-site so that their employees can concentrate on the training, away from workplace distractions.
It's really as simple as 1-2-3. Give us a call to learn how we can help your business.
In the Quad Cities call 563-441-4360.


text:
layout: post
title: "Oryol: System Design Philosophy"
---

I think I have written (and re-written, and re-re-written) enough different
Oryol modules now that a pattern has emerged to a point where I feel comfortable writing a blog post.

Please do *not* take this post as an attempt to sell you on design patterns though.
IMHO upfront software design is overrated, continuous refinement
is what counts :)

### Class Collections vs System Modules

Oryol seems to have arrived at two different module types, one is just
a collection of related helper classes. The [Resource module](https://github.com/floooh/oryol/tree/master/code/Modules/Resource)
or [Asset module](https://github.com/floooh/oryol/tree/master/code/Modules/Assets)
are typical examples.

And then there are the **system** modules, which have a central interface,
are initialized at application start, have internal state and provide some
service to the application code like rendering, input or loading data.
Typical system modules are
[IO](https://github.com/floooh/oryol/tree/master/code/Modules/IO),
[Gfx](https://github.com/floooh/oryol/tree/master/code/Modules/Gfx) or
[Input](https://github.com/floooh/oryol/tree/master/code/Modules/Input).

This post is mainly about the design of **system modules**.

### Typical Properties of Oryol Code

Code written against Oryol has a few interesting properties:

- you never need to call *new*, *make_shared* or similar heap-allocation functions
- you never need to care about ownership, there are no smart pointers, and
there is no concept of 'ownership transfer'
- there are (nearly) no derivable classes and virtual-method-interfaces

There is a minor exception though, Oryol currently *does* have 3 classes with
virtual methods which are user-deriveable, are created on the heap and
lifetime-managed by smart pointers:

- **FileSystemBase**: for user-provided filesystem implementations
- **MeshLoaderBase**: for user-provided mesh resource loaders
- **TextureLoaderBase**: the same for textures

In those few cases where Oryol provides such an 'extension interface' I decided
to go with the standard C++ way instead of inventing something
new. I'm not entirely happy with all 3 of those classes though (for various
minor reasons), so may be they will disappear completely one day. In the big
picture, these 3 classes also only play a minor role, they are not
used in 'typical' Oryol code.

### The Public System Interface

A system module usually has a single public interface in a single header,
similar to what a C library would provide. There is no public
'system object', the interface class consists of static methods only.

For instance: The **Gfx** module has the header **"Gfx/Gfx.h"** which
exposes static methods like **Gfx::ApplyDrawState()**, **Gfx::Draw()** etc.

All interaction with the system goes through this central
interface, which also means that you only need to look at this
one header to learn how a system works.

If a system needs any public types besides the central interface those
types are usually grouped in another single header, for instance
[Input/InputTypes.h](https://github.com/floooh/oryol/blob/master/code/Modules/Input/InputTypes.h). The main reason why those
types are in a separate header is that they must also be known to the
private areas of a module while the system-private code will never call
into the public interface API.

The public types are almost always plain-old-data structs
or at most simple struct-like classes with a few 'uninteresting'
helper methods.

All in all, a system module's public interface is much closer to
what a C library would provide, and unlike many 'traditional' C++
frameworks.

### Public vs Private Classes

In general the concept of 'privacy' in Oryol only exists as a hint to the
programmer and for 'code hygiene', it is not enforced by the compiler.

Usually the separation line between public and private area doesn't go
through the middle of a class (there are hardly any C++ *private:* keywords
in the code), instead entire classes of a system module either belong to the
public interface of the module, or are considered module-private.

The hint to the programmer is that public types and functions start with
uppercase letters, private types and functions with lowercase letters.
The compiler will not prevent the programmer from accessing private types,
but this is 'here be dragons' territory. The private interfaces can change at
any time without warning, while the public types hopefully don't need to
change that often.

All private code of a module usually lives in a subdirectory called
'private', this makes it easy to identify the public and private areas while
browsing the code, and it helps mentally to separate public from
private types when writing new code.

The 'code hygiene' part is mostly about header inclusion, private or
operating system headers like Windows.h should not leak into application
code, which helps with compile times, and annoyances like Windows.h adding
global defines for min() and max().

For instance if you look at the [Gfx.h header](https://github.com/floooh/oryol/blob/master/code/Modules/Gfx/Gfx.h)
you'll notice that it doesn't include any headers from the private area
(most notably, no Windows.h, D3D11.h, GL or Metal headers), instead
these are only included in the [Gfx.cc implementation file](https://github.com/floooh/oryol/blob/master/code/Modules/Gfx/Gfx.cc).

### Separation of platform-specific code

Platform specific code lives in the private area of a module,
usually in their own directories (for instance see here
in the [Gfx module](https://github.com/floooh/oryol/tree/master/code/Modules/Gfx/private)
for an example how the rendering backend code for different 3D APIs
is separated).

Oryol uses 'compile time polymorphism' to hide platform specific code under
generic class names, for instance the platform specific 3D API renderers are
resolved into a generic ['renderer'
class](https://github.com/floooh/oryol/blob/master/code/Modules/Gfx/private/renderer.h).
The renderer class is not directly exposed to the application code though,
instead the Gfx interface forwards calls into the renderer. But since there
is no dynamic dispatch (virtual method calls) happening anywhere, and Oryol
applications are fully statically linked, the compiler may actually decide to
inline platform-specific code into the call site, the separation between
platform-agnostic and platform-specific code only exists on the source code
level.

### Object Creation and Lifetime Management

Some system modules need to create and destroy objects under the control
of the application code (for instance graphics resources like textures
or meshes).

It is interesting that most Oryol modules
*don't* need such object management though. For instance among the Core Oryol
modules, only the Gfx module needs to manage objects, all other modules
don't. This is mostly a side-effect of trying to design interfaces that look
more like C libraries, and not "OOP frameworks".

If an Oryol module needs to create objects under control of the application
code, it will completely handle the actual creation and destruction
internally, and it will always be the sole owner of the object.
This means that application code will never call *new*, *make_shared*
or similar, instead it will call a creation function on the module
interface.

The result of the creation function is an opaque handle
(in Oryol this is usually called an **Id**), it will *never* be
a C++ object pointer (neither of the smart or raw kind), and
in some (most?) systems, the application code never needs to
access the underlying C++ object directly.

By handing out Ids instead of pointers a lot of typical C/C++ memory
management issues are avoided. The application code cannot accidently access
an object that no longer exists, and it doesn't need to care whether an
object is copyable, moveable, etc...

There are some systems where an application can gain direct access to the
underlying C++ object, this is usually a compromise to avoid a too complex
interface API, the only rule is that access is only 'borrowed', the
application code should never store a pointer to the underlying object,
and it must be aware that the memory location of an object might change
if the internal state of the system changes.

Here is an example of such a direct object access from the new
oryol-animation module to get the number of bones of a skeleton:

```cpp
// skeletonId is the opaque id of a character skeleton object
// get the number of bones in the skeleton:
int numBones = Anim::Skeleton(skeletonId).NumBones;
```

How is a dangling access prevented in this case?

The answer is in the Id object. Usually this is an integer divided
into 3 bit-groups:

- an index into an internal object array
- a few type bits (for instance mesh vs texture vs drawstate)
- a 'unique tag', this is a counter that's incremented which each
new Id that is handed out

To convert an Id into an object pointer, the index is used for an array
access into an internal object pool, if this slot is 'unoccupied', the object
no longer exists. But it can also happen that the slot has been re-occupied
by a new object. This is what the 'unique tag' is used for. The new object in
the slot will have a different tag, and thus a dangling access can be
detected.

What happens on such a dangling access is up to the system. It could
'crash' with an assert, it could return a 'dummy object' in its
default state, or an operation involving the dangling object
could be silently skipped or produce a warning message. What will
*not* happen is a segfault, or scribbling over random memory.

Of course converting an Id to a pointer is more expensive than a direct
pointer access even though it's only an array access and integer
comparision. The point here is that the system interface should be designed
in a way that such high-frequency accesses are not necessary in the
first place.

### Memory Management Simplifications

Since system modules completely control the entire lifecycle of objects, they
also have a lot of freedom to simplify memory management:

- the system can keep objects in pre-allocated arrays to minimize allocations
(for instance, a typical Oryol frame has no allocations at all)
- systems don't need to 'force' concepts into objects that don't naturally
fit into objects, it is easier for the system to arrange its internal
data in any way it wants
- there's usually no need for the standard C++ class boilerplate code for
construction, copy- and move-assignment, etc..)

With memory allocation being very infrequent, a few related
problems also simply disappear:

- there's no need for a fast general allocator (like jemalloc), instead
it may make sense to choose a slow-but-small allocator to reduce
binary size (for instance on asm.js/wasm where the allocator is linked
into the binary).
- there's also no need to invent C++ custom allocators to
workaround problems with the standard allocator
- debugging memory-related problems becomes a whole lot easier
since there's much less 'noise' to filter out

I also discovered that it is much easier to write bindings for other
languages for such 'C style modules' since there's no need to translate the
concept of complex C++ classes across language borders. Only the central
system interface and the object ids (which are simple integers) need to be
brought over. This eliminates the need for complex translation tools which
try to convert C++ class declarations to other languages.

Another interesting thought is that if Oryol would be built in a
garbage-collected language it would most likely arrive at a very
similar design to minimize the amount of 'garbage' that's produced
per frame.

### The End

And that's it for today.

Recently I tried out a few interesting things about
'array-based memory-management' in the new Oryol animation module,
so may be that's the topic for the next blog post.

The realization was basically that the main purpose of container
classes is not 'iterating over items' but
'simplifying memory management'. I haven't thought too deeply about the
implications for the Oryol container classes yet though, so the idea
needs a bit more time to roll around in the back of my head :)

Until next time!

redpajama_set_name: RedPajamaGithub


text:
John L. Dube, his Ilanga Lase Natali and the Natal African Administration, 1903-1910
Gasa, Enoch Doctor
J.L. Dube is one of the Zulu Natalians who, being an African nationalist, involved himself in the affairs of his kith and kin. He is the founder of the first African established school in Natal, viz. Ohlange. He also succeeded to establish and publish ILANGA LASE NATAL as a medium of contact among the Africans who were economically, politically and socially acute. Dube set himself the task of revealing the failures of Shepstonism. He pointed out how it could have been utilised to promote acceptable administration of Africans. He even pinpointed the type of reforms that the Africans yearned for. When this was not heeded, he involved himself unflinchingly in politics. He organised fellow-Christian Africans with success. Dube was, however, an exponent of non-violent political change. He wished that in its dealings with the Africans, the government would be fair, objective and humane. Dube remonstrated against the subjugation of the Africans by the colonial government. He preferred that the Africans should be consulted, and elevated in the scale of civilization. For this to happen, he pressed that the attitudes of the whites towards blacks would have to change. The unwieldy officialdom, obscenely abusive party politics, and unequal treatment of whites and blacks at law would also have to be remedied or replaced. He advocated that land should be equitably distributed and Africans introduced to a new mode of land ownership. The whites would have to reduce then-excessive demands for land and African labour. He also demanded a worth¬while education system for the blacks that would promote all their human aspects. The government was urged to adequately financially provide for and control African education. It should not leave this to the lot of missionary societies. Dube also pressed for the enfranchisement and representation of Africans in the Natal legislature. It was only then that the government would quickly apprehend, comprehend, and redress problems that related to Africans. Subsequent to the 1906 rebellion, Dube was hopeful that there would be an end to maladministration of African affairs. He was highly expectant that the recommendations of NNAC, the drive of the new governor, the new direction of policy, though late, would put the colony on a new course. However, then the movement towards Union was afoot. It remained to be seen what would transpire.
Submitted to the Faculty of Arts in partial fulfilment or fulfilment of the requirements for the Doctor of Philosophy in the History Department at the University of Zululand, 1999.
Name: John L. Dube, His ...


text:
Q: How to show Unhandled Exception message to View FLUTTER How to show this message to view?  so that the user knows that the connection cannot connect to the server

this my socket connection code :
Socket.connect(pIp, port, timeout: const Duration(seconds: 5))
            .then((socket) {
          _channel = socket;
          _isOn = true;
          if (pWithdata.isNotEmpty) {
            if (_channel != null) {
              send(pWithdata);
              //  submitMessage("LOGIN#xXYjY`#Uf]bXcMM#FFHE#V30#V901");
            }
          }

          socket.listen(
            (onData) {
              _isOn = true;
              _listeners.forEach((Function callback) {
                // callback(onData);
                callback(String.fromCharCodes(onData).trim());
              });

            },
            onDone: onDone,
            onError: onError,
          );
        });

redpajama_set_name: RedPajamaStackExchange


text:
Q: how to create an environment variable that outlasts the life of the process creating it using python? I need to create an environment variable in python that will out last the life of the process creating it preferably in a non os-dependent way i.e if I ran : create_env_var.py (example non active code )
#/my/path/create_env_var.py
import module_that_fixes_my_problem as easy_fix
easy_fix.create_environment_variable(name_of_var = "ENV_VAR",value_of_var="this was easy")

and then ran read_env_var.py
#/my/path/read_env_var.py
import module_that_fixes_my_problem as easy_fix
my_var = easy_fix.read_environment_variable(name_of_var = "ENV_VAR")
print(my_var) # "this was easy"

I have tried doing this using os.environ  like this :
os.environ['ENV_VAR'] = "this was easy"

but on a Windows machine I couldn't create a lasting environment var and on a Linux machine it would not last outside of the life of the process as described here :
os.environ not setting environment variables
https://bugs.python.org/issue16633


For many people, starting a new project means excitement and fun. Others dread having to tackle a new process regardless of the opportunistic outcome. Either way, the success of a new project depends heavily on several factors including motivation, planning and resources.
The energy industry is a place where new projects can mean huge profits if you execute properly. Izzet Bensusan, founder and CEO of Karbone, is an expert at identifying what it takes to make a new energy project successful. He has to be since Karbone is the leading finance and advisory company in the emerging renewable energy and emissions space.
Bensusan, a member of YPO, has worked on large-scale wind, solar and biomass power plant financings, receiving numerous accolades from leading industry publications and organizations. He has also served on various advisory boards, including the Environmental Markets Association and the Leadership of the American Council on Renewable Energy (ACORE).
Bensusan was willing to share his tips for making any high stakes project reach its maximum success.
Many people think that simply having a great idea is enough to get a plan off the ground. Often a good idea will start you on the right path, but as truth unveils and environments change, a great idea can become a bad one in a hurry. Bensusan puts great faith in people who constantly learn through the process. "If you put your mind to it, you can learn anything you want," Bensusan noted. "You just have to know what information to look for and find it."
2. Inspire a great team.
"Some people think that if they had a million dollars, they would hire the best people in the world, put them in a room together and call it a day. That's the same mistake a lot of sports teams make when they draft a team of superstars and expect to win the championship. It doesn't work that way unless everyone is on board and excited to succeed with you and will contribute accordingly," said Bensusan. "Surround yourself with the right mix of people that are excited about executing the idea with you."
"You should never think that your idea is going to happen in the timeline you imagined. You just never know," said Bensusan. "The things you can control, you control them. If you don't have enough patience, you will never succeed. If you're patient, it shall come to you. If you're impatient, you will change your idea all the time."
4. Make money the byproduct, not the goal.
The pure goal of money can be limiting to innovation according to Bensusan. It can drive you down a short term or misguided path. A long-term broader purpose will stimulate more creative and expansive thinking. Have a primary purpose beside money to ensure that you will drive the right kind of innovation.
5. Keep a mental mirror.
Many leaders only look forward once they throw their plan into action. Then they often accuse others of missteps or outright failures which becomes disastrous for the well-being of the team. Bensusan stressed the need to self-assess constantly as a reminder of how to improve. His method? "Keep a mental mirror in your office. You want to look in the mirror regularly and ask whether you are doing the job right. If you are blaming other people, you will fail.
6. Be ready to shift.
Not every plan will work every time. In fact, failure or unexpected obstacles may set in at any moment. This requires swift and careful movement. "You have to adapt," said Bensusan. "Things move fast, and if one idea doesn't work, you have to tweak it."


I am about ready to buy my rotating kit form my 400 stroker build and I need some input.
The car will be a F1x pump gas "street" car 6500 max sealing.
I want to keep the piston CH above 1.300 and have made a matrix of my rod options. I know rod ratios are not that big of an issue but because this is a forced induction build I have read that a lower RR will lend itself better for detonation, filling of the cylinders, and getting the exhaust out.
All of the numbers below will still allow me to run a 1.300 CH or larger piston.
Please let me know what looks best to you. Will there be a huge issue with side loading with any of them.
I use a 7.125" inch rod in my rb512" with the 4.250" crank. you won't be able to get that long a rod in your little "b" motor. use the longest rod you can and the shortest piston like you want with a 1.30"+ or- compression height.
are finished at the smaller "B" engine size. All good as far as I'm concerned.
I have been leaning toward the 470 just wanted some one to give me the warm and fuzzies.
My main question was which combo would react better to boost from a timing and exhaust standpoint. Or would the difference between 1.54 to 1.73 RR be to small compared to the side loading increase on the block from the bigger stroke and shorter rods.
The rod length thing is splittin hairs. Build whichever one is easiest and most economical for YOU.
rusty that's part of the problem. The cost is the same no matter which way I build it.
The cost of the stroker kit is the same but the supporting parts have differnt costs. Going through the same thing with my RB build. Same price for a 500 or a 523 kit. I'm leaning on a 512 kit as it sounds like A LOT more work to get 523 oiled and needs some major heads and carb to run oh and streetablity because a concern.
What's that old saying? Something about replacements for something. I forget.
470 will possibly save you some money if you use a stock forged crank and have it offset ground. It's also (supposedly) easier on the bearings over a 4340 crank.
If you're starting from scratch and buying a kit with a new crank, just go with the 512.
Splain please. I thought with a longer rod, the compression distance has to be shorter and that would give less space for a good ring pack because it starts to cram the pin into the oil ring area.
Most of the off the shelf pistons I have been looking at are diamond or icon. I may also get a custom set of Steve Morris/ diamond pistons. The CH of the piston will not be shorter than 1.300 because I don't want the ring pack getting into the pin area and also I want the stability.
I understand the adage of "no replacement for displacement" but this engine has a multiplier on it. I can create the defiance of 40cubes fairly easily. My goal is to find the more stable platform. I have read that the higher RR will give the piston more time at TDC and narrow the window for the tune but stabilize the piston and reduce the side loading of the cylinder wall. While the lower RR will widen the tune window and promote better cylinder fill on a boosted engine. This however comes at the cost of piston speed and side loading of the cylinder walls. This is my dilemma unless someone can tell me the RR is so close that it will not matter (my green light to go big) or the side load of the 512 combo mixed with boost will cause issues (my green light to go small).
let me add this: Stock block (I know it will be a grenade but it will be as bullet proof as I can make it) and I plan to make about 1200HP at the crank.
Exactly, hence why I said "as long as it leaves room"
Stroker BBC's survive with much less rod ratio and make damn good power...any of these combos listed has the same or better rod ratio than those. If you're buying a kit with a new crank, just go for the 512 IMO.
that chevy guy smoky yunick stated, select your stroke and piston compression height then use what ever rod length fits. so if that is true go for it. it also doesn't, matter one bit if the oil ring is in the piston pin area.
get the 512" kit like every one suggests. heads are going to have to flow big time because of the short rods so you might want to consider something like ported 440-1's etc, even with the supercharger pushing the air in.
I'm not sure why you'd try to make that kind of power on a factory block. And I think I'm in the minority here when I say that I believe they can handle more than people think. I also believe things like girdles are basically a waste of money. The right and good machine work with head/main studs will go a long way, but not 1200hp imo. And you already seem to know this, so why possibly waste the cash? I wouldn't go over 800-900hp... I built a Procharged 496 last year, and even with a little D1SC I know it's more than capable of producing factory block breaking power. I'd reassess your block situation or power goals, before continuing.
all lot of you people don``t believe in cryogenics, but I had my block and mains done (froze), using a girdle w/ studs-line honed the whole bit. if you don`t think a girdle will help a r/b, you better install one (right) and stand back and think about it a long while, and do some research. It`ll probably help this design block more than any other out there !!
I knew I was going to get the block comment and that's ok.
Love to have one but don't have the cash and if I could buy one it would be a waist of money to not go aluminum and 4.50 bore and maybe 55mm raised cam. At that point I don't have the heads for 4.5 bore, ect, ect.
I will keep the tune low. I really don't want to make more power that I can plant so I will tune up or down accordingly.
I am looking at cyroing the block and I have arguably the best aluminum cap system. My heads are on the small size but can do the job.
Thanks for all in input guys.
I think I am going to do the 470 because it gives me a bigger window for piston compression heights and rod lengths. On the 500 and 511 you can really only run one rod the 6.535 or shorter because the comp height of the piston gets too short.
Bore size is the ultimate factor on power, piston speed if taken out to the max rpm each combo will ruffly have the same power potential. But since you put a 6500 rpm limit the largest Cid will have the most potential. 400 block is the best choice for sub 500 inch engines but over 500 I'd go with 440 you ain't gonna miss to extra .020" bore size.
Yes longer rods with have less frictional hp loss but the cubic inch will make up for that and more bore life how many miles do you plan on putting on it.


New Kia Rio vs Skoda Fabia | What Car?
The new Kia Rio has ground to make up if it's to be the best small car. Is it up to the task?
We've eulogised about our current favourite small car; it's the definitive all-round package.
Imagine going back in time 30 years and getting behind the wheel of an average small car; what would it be like by today's standards? Well, noisy, unsafe, poorly equipped and a darned sight more toxic to our environment, for starters.
On a macro level, then, small cars have improved no end, but on a micro level, has the all-new Kia Rio taken a quantum leap forward over its predecessor? The old Rio was humdrum, but it's been reborn on a new platform and is powered by a frugal new 1.0-litre petrol engine.
Can it hack it against the best? By 'the best', we mean the Skoda Fabia, our Small Car of the Year. It's a cracking package that nothing else in the class has been able to match for more than two years. Can it hold on to its crown for a little longer?
We've always enjoyed the Fabia's 89bhp 1.2-litre petrol engine. We're not pretending it's an automotive Usain Bolt, but it picks up keenly from low revs and offers plenty of zip to get you up to motorway speeds, fulfilling its brief handsomely.
Yet after sampling the new Rio's 1.0-litre petrol engine, with its extra 10bhp, the Fabia's engine doesn't seem quite so special. That extra poke yields better in-gear flexibility, so there's less need to change down to keep up with fast-moving traffic, but when you do, it musters an urgency the Fabia can't match.
Both gearchanges are light and precise, making these cars effortless to drive in town, although the Fabia does have the more feelsome clutch pedal. On the motorway, the absence of a sixth gear in both cars means their engines are spinning away quickly, so there's a constant background drone; this is more noticeable in the Fabia. However, there's far more tyre noise in the Rio, making it the noisier cruiser.
The previous Rio's lacklustre handling was disappointing, but this new model's isn't too bad at all. You'll find the Rio perfectly capable, with nothing in its dynamic repertoire that'll really annoy you, apart from the fact that it's unlikely to put a smile on your face.
However, its steering is light and a bit numb, so you find yourself continually making small steering corrections through corners. The Fabia is a bit more assured in this regard, with stronger grip and greater stability in quick direction changes.
Both cars are relatively softly sprung, leading to some body roll in corners. And while neither car rides brilliantly, the Fabia uses this compliance to absorb the scars of scruffy town roads and bounce over speed bumps with greater aplomb than the Rio. Yet pick up your speed and that disparity diminishes; indeed, both cars make surprisingly good long-distance cohorts.


text:
𝔶𝔲𝔫𝔤.𝔯𝔞𝔧
Catalog certified
This artist's identity is verified and the record was created or authorized by the artist listed.
The content of this record has not been modified since it was created.
Add to space
made in february 2020, one of those moments where i felt inspired enough to make the entire track in a single session without distractions. also a track which ended up resonating with fans who hadn't heard this side of my music turn on, tune in, drop out
Date Pressed
Creator share
Artists set a creator share before they press a record. The creator share is a percentage that goes back to the artist every time their record is resold.


text:
News from the teams
Shoutout to Callum/Claire for completed a bumper harvest of 9 new videos on our YouTube channel.
Also a huge congrats to Gary, Zopaash, and the Italian sales team, for the hard work on the Italian Direct Mail campaign. We have seen great results in terms of campaign creation, engagement,and final results.
It has been a BUSY month, combined with lots of staff holidays, so everyone has stepped up to keep things running smoothly – thank you.
Thanks to Emily and Gemma for their efforts in their first month. They're already a big part of our team and we're delighted they've arrived.
Congrats to Tom, who did a half marathon run with his sisters and raised over £2000 for SAMH mental health charity.
It's been another really busy month, so big thanks to the whole team for pulling together and achieving a really good customer satisfaction score on the feedback received. It's really appreciated.
Particular thanks to the team from Laura for putting up with a grumpy pregnant during the 'no filter' trimester.
Iain Johnston and Scott hosted Glasgow Uni students in the head office this week for an annual project sponsored by ResDiary.
Abdul is fundraising to build sustainable safe water wells in Africa. He's going to do a bake sale on Tuesday coming, so if you bring cash, he'll exchange it for cake. There'll be a donation box in the F3 kitchen.
Nici and Elliot are now fully settled in and making great contributions to the Evolution team, and are being inducted in a traditional game of Laser Quest this week!
Reports work is moving along quickly and a plan to the full launch of the new reports, along with deletion of a lot of old reports, has been made
Both MegaForce and Stroma put in a lot of effort to get work done to enable Dish Cult to meet their launch deadlines and it's greatly appreciated
Curo are taking the first tentative steps towards making the maze of ResDiary settings sane after the product team has spent the last 6 months analysing them
We have welcomed a couple of new faces in the last month or so, everyone starting to settle in – so welcome to David, and welcome in advance to Claudia who will be joining our European sales team this month too. Congratulations to our top seller for last month – John Rooney.
We're really pleased we had a great response to our technology/device survey. We got a record 396 responses with an 18% completion rate. We're collating
Very limited places left for the SAMH Mental Health Awareness training sessions on Monday 25th and Friday 29th November – please contact Adele or Jen if you're interested in coming to this half day training session.
New handbook is now live on Confluence – please can all staff mark that you've read the document via the read and accept on your account on Cascade.
Mid to late Nov: a 'Your Say' survey will be sent to all staff. This will be anonymous, and we're looking for your constructive feedback on how we can improve as an employer – and how we can grow as a business, so thanks in advance for your time!
We've got a fair few venues over the line with our new integration with TalkBox – Start of a good partnership!
A big thanks to Robyn for all of her efforts in retaining a group of 8 accounts this month.