package eu.dnetlib.ariadneplus.registry;

import org.apache.jena.rdf.model.*;
import org.apache.jena.vocabulary.RDFS;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;

/**
 * Created by Alessia Bardi on 29/09/2017.
 *
 * See https://jena.apache.org/documentation/inference/index.html#OWLcoverage
 *
 * @author Alessia Bardi
 */
@RunWith(JUnit4.class)
public class JenaInferenceTest {

	private static final String ARIADNEPLUS_MODEL_URL = "http://ariadneplus.d4science.org/CRMext/CRMpe.rdfs";
	private static final String CRM_MODEL_URL = "http://www.cidoc-crm.org/sites/default/files/cidoc_crm_v6.2-draft-2015August.rdfs.xml";
	private static final String CRM_DIG_MODEL_URL ="http://www.ics.forth.gr/isl/CRMext/CRMdig_v3.2.2.rdfs";


	@Test
	public void testSubProperty(){

		String NS = "urn:x-hp-jena:eg/";

		// Build a trivial example data set
		Model rdfsExample = ModelFactory.createDefaultModel();
		Property p = rdfsExample.createProperty(NS, "p");
		Property q = rdfsExample.createProperty(NS, "q");
		rdfsExample.add(p, RDFS.subPropertyOf, q);
		rdfsExample.createResource(NS+"a").addProperty(p, "foo");

		InfModel inf = ModelFactory.createRDFSModel(rdfsExample);  // [1]

		Resource a = inf.getResource(NS+"a");
//		System.out.println("Statement: " + a.getProperty(q));
//		System.out.println("Statement: " + a.getProperty(p));

		StmtIterator it = inf.listStatements(new SimpleSelector(a, null, (Object) null));
		while(it.hasNext()){
			System.out.println(it.nextStatement().toString());
		}
	}

	@Test
	public void testWithSchema(){

	}

}
