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.layer0.utils.binaryPredicates;
14 import java.util.Collection;
16 import org.simantics.db.Resource;
17 import org.simantics.db.ReadGraph;
18 import org.simantics.db.WriteGraph;
19 import org.simantics.db.exception.DatabaseException;
20 import org.simantics.utils.datastructures.Pair;
22 public interface IBinaryPredicate {
24 boolean supportsGetObjects();
25 boolean supportsGetSubjects();
26 boolean supportsGetStatements();
28 Collection<Resource> getObjects(ReadGraph g, Resource subject) throws DatabaseException;
29 Collection<Resource> getSubjects(ReadGraph g, Resource object) throws DatabaseException;
30 Collection<Pair<Resource,Resource>> getStatements(ReadGraph g) throws DatabaseException;
31 boolean has(ReadGraph g, Resource subject, Resource object) throws DatabaseException;
33 boolean supportsAdditions();
34 boolean supportsRemovals();
36 void add(WriteGraph g, Resource subject, Resource object) throws DatabaseException;
37 void remove(WriteGraph g, Resource subject, Resource object) throws DatabaseException;
39 IBinaryPredicate inverse(ReadGraph g) throws DatabaseException;
41 String toString(ReadGraph g) throws DatabaseException;