1 /*******************************************************************************
2 * Copyright (c) 2007, 2010 Association for Decentralized Information Management
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.db.tests.api.readGraph.getPredicates;
14 import org.simantics.db.ReadGraph;
15 import org.simantics.db.Resource;
16 import org.simantics.db.exception.DatabaseException;
17 import org.simantics.db.testing.base.WriteReadTest;
19 public class PredicatePropertiesTest extends WriteReadTest {
23 protected void read(ReadGraph graph) throws DatabaseException {
24 Resource[] predicates = {L0.Asserts, L0.ConsistsOf, L0.DependsOn, L0.HasDataType,
25 L0.HasLabel, L0.HasName, L0.HasPredicate, L0.HasValueType, L0.Inherits,
26 L0.InstanceOf, L0.IsRelatedTo, L0.IsWeaklyRelatedTo, L0.SubrelationOf};
28 System.out.println("Is Functional:");
29 for (int i=0; i<predicates.length; i++) {
30 Resource predicate = predicates[i];
31 boolean isFunctional = graph.isInstanceOf(predicate, L0.FunctionalRelation);
33 System.out.println(i + " " + isFunctional);
36 System.out.println("SubRelationOf:");
37 for (int i=0; i<predicates.length; i++) {
38 Resource predicate1 = predicates[i];
39 for (int j=0; j<predicates.length; j++) {
40 Resource predicate2 = predicates[j];
41 boolean isSubRelationOf = graph.isSubrelationOf(predicate1, predicate2);
43 System.out.println(i + "," + j + " : " + isSubRelationOf);