Project

General

Profile

1
package eu.dnetlib.parthenos.registry;
2

    
3
import org.apache.jena.rdf.model.*;
4
import org.apache.jena.vocabulary.RDFS;
5
import org.junit.Test;
6

    
7
/**
8
 * Created by Alessia Bardi on 29/09/2017.
9
 *
10
 * See https://jena.apache.org/documentation/inference/index.html#OWLcoverage
11
 *
12
 * @author Alessia Bardi
13
 */
14
public class JenaInferenceTest {
15

    
16
	private static final String PARTHENOS_MODEL_URL = "http://parthenos.d4science.org/CRMext/CRMpe.rdfs";
17
	private static final String CRM_MODEL_URL = "http://www.cidoc-crm.org/sites/default/files/cidoc_crm_v6.2-draft-2015August.rdfs.xml";
18
	private static final String CRM_DIG_MODEL_URL ="http://www.ics.forth.gr/isl/CRMext/CRMdig_v3.2.1.rdfs";
19

    
20

    
21
	@Test
22
	public void testSubProperty(){
23

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

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

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

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

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

    
45
	@Test
46
	public void testWithSchema(){
47

    
48
	}
49

    
50
}
(4-4/5)