From 8b00e8b4094618aab8783242b061a9367ae02bc4 Mon Sep 17 00:00:00 2001 From: lehtonen Date: Mon, 30 Jul 2012 09:33:01 +0000 Subject: [PATCH] Fixed SplittingWriteGraph/WriteGraphProxy to work with WriteGraph/ReadGraph API additions. refs #3552 git-svn-id: https://www.simantics.org/svn/simantics/interoperability/trunk@25354 ac1ea38d-2e2b-0410-8846-a27921b304fc --- .../interop/mapping/SplittingWriteGraph.java | 33 +++++++++++++++---- .../interop/mapping/WriteGraphProxy.java | 25 ++++++++++---- 2 files changed, 45 insertions(+), 13 deletions(-) diff --git a/org.simantics.interop.mapping/src/org/simantics/interop/mapping/SplittingWriteGraph.java b/org.simantics.interop.mapping/src/org/simantics/interop/mapping/SplittingWriteGraph.java index f8e5fae..a91c8c0 100644 --- a/org.simantics.interop.mapping/src/org/simantics/interop/mapping/SplittingWriteGraph.java +++ b/org.simantics.interop.mapping/src/org/simantics/interop/mapping/SplittingWriteGraph.java @@ -371,14 +371,20 @@ public class SplittingWriteGraph implements WriteGraph { }); } - @Override - public RandomAccessBinary newLiteral4RandomAccessBinary - (final Resource resource, final Resource predicate, final Datatype datatype, final Object initialvalue) - throws DatabaseException { + public RandomAccessBinary createRandomAccessBinary(final Resource resource, final Resource predicate, final Datatype datatype, final Object initialValue) throws DatabaseException { + return session.syncRequest(new WriteResultRequest() { + @Override + public RandomAccessBinary perform(WriteGraph graph) throws DatabaseException { + return graph.createRandomAccessBinary(resource, predicate, datatype, initialValue); + } + }); + } + + public RandomAccessBinary createRandomAccessBinary(final Resource resource, final Datatype datatype, final Object initialValue) throws DatabaseException { return session.syncRequest(new WriteResultRequest() { @Override public RandomAccessBinary perform(WriteGraph graph) throws DatabaseException { - return graph.newLiteral4RandomAccessBinary(resource, predicate, datatype, initialvalue); + return graph.createRandomAccessBinary(resource, datatype, initialValue); } }); } @@ -2439,7 +2445,7 @@ public class SplittingWriteGraph implements WriteGraph { @Override public Set perform(ReadGraph graph) throws DatabaseException { - return graph.getSupertypes(subject); + return graph.getSupertypes(subject); } }); } catch (DatabaseException e) { @@ -2455,7 +2461,20 @@ public class SplittingWriteGraph implements WriteGraph { @Override public Set perform(ReadGraph graph) throws DatabaseException { - return graph.getSuperrelations(subject); + return graph.getSuperrelations(subject); + } + }); + } catch (DatabaseException e) { + throw new ServiceException(e); + } + } + + public Resource getPossibleSuperrelation(final Resource subject) throws ServiceException { + try { + return session.syncRequest(new Read() { + @Override + public Resource perform(ReadGraph graph) throws DatabaseException { + return graph.getPossibleSuperrelation(subject); } }); } catch (DatabaseException e) { diff --git a/org.simantics.interop.mapping/src/org/simantics/interop/mapping/WriteGraphProxy.java b/org.simantics.interop.mapping/src/org/simantics/interop/mapping/WriteGraphProxy.java index f51407f..cefc761 100644 --- a/org.simantics.interop.mapping/src/org/simantics/interop/mapping/WriteGraphProxy.java +++ b/org.simantics.interop.mapping/src/org/simantics/interop/mapping/WriteGraphProxy.java @@ -245,12 +245,19 @@ public class WriteGraphProxy implements WriteGraph { return graph.newLiteral(resource, predicate, datatype, initialValue); } - @Override - public RandomAccessBinary newLiteral4RandomAccessBinary - (Resource resource, Resource predicate, Datatype datatype, Object initialValue) - throws DatabaseException { - return graph.newLiteral4RandomAccessBinary(resource, predicate, datatype, initialValue); - } + @Override + public RandomAccessBinary createRandomAccessBinary(Resource resource, + Resource predicate, Datatype datatype, Object initialValue) + throws DatabaseException { + return graph.createRandomAccessBinary(resource, predicate, datatype, initialValue); + } + + @Override + public RandomAccessBinary createRandomAccessBinary(Resource resource, + Datatype datatype, Object initialValue) throws DatabaseException { + return graph.createRandomAccessBinary(resource, datatype, initialValue); + } + // @Override // public void claimFile(Resource resource, Object content, Binding binding) // throws DatabaseException { @@ -1199,6 +1206,12 @@ public class WriteGraphProxy implements WriteGraph { return graph.getSuperrelations(subject); } + @Override + public Resource getPossibleSuperrelation(Resource subject) + throws ServiceException { + return graph.getPossibleSuperrelation(subject); + } + // @Override // public Collection getObjects(Resource subject, // Resource relation) -- 2.47.1