📄 soapservices.java
字号:
LocalRepository rep = (LocalRepository)service.getRepository(sc.repository); Sail sail = rep.getSail(); if (sail instanceof RdfSchemaSource) { RdfSchemaSource rdfSchema = (RdfSchemaSource)sail; result = rdfSchema.isDirectSubPropertyOf(new URIImpl(subProperty), new URIImpl(superProperty)); } } catch (Exception ex) { throw new RuntimeException(ex.getMessage()); } return result; } // isDirectSubPropertyOf() public Vector getType(String anInstance, String aClass) { Vector result = null; SessionContext sc = getContext(); try { LocalService service = SesameServer.getLocalService(); service.login(sc.user, sc.pass); LocalRepository rep = (LocalRepository)service.getRepository(sc.repository); Sail sail = rep.getSail(); if (sail instanceof RdfSchemaSource) { RdfSchemaSource rdfSchema = (RdfSchemaSource)sail; URI rInst = null, rClass = null; if (anInstance != null) { rInst = new URIImpl(anInstance); } if (aClass != null) { rClass = new URIImpl(aClass); } StatementIterator iter = rdfSchema.getType(rInst, rClass); result = _statementIteratorToVector(iter); iter.close(); } } catch (Exception ex) { throw new RuntimeException(ex.getMessage()); } return result; } //getType public Vector getDirectType(String anInstance, String aClass) { Vector result = null; SessionContext sc = getContext(); try { LocalService service = SesameServer.getLocalService(); service.login(sc.user, sc.pass); LocalRepository rep = (LocalRepository)service.getRepository(sc.repository); Sail sail = rep.getSail(); if (sail instanceof RdfSchemaSource) { RdfSchemaSource rdfSchema = (RdfSchemaSource)sail; URI rInst = null, rClass = null; if (anInstance != null) { rInst = new URIImpl(anInstance); } if (aClass != null) { rClass = new URIImpl(aClass); } StatementIterator iter = rdfSchema.getDirectType(rInst, rClass); result = _statementIteratorToVector(iter); iter.close(); } } catch (Exception ex) { throw new RuntimeException(ex.getMessage()); } return result; } //getDirectType public boolean isType(String anInstance, String aClass) { boolean result = false; SessionContext sc = getContext(); try { LocalService service = SesameServer.getLocalService(); service.login(sc.user, sc.pass); LocalRepository rep = (LocalRepository)service.getRepository(sc.repository); Sail sail = rep.getSail(); if (sail instanceof RdfSchemaSource) { RdfSchemaSource rdfSchema = (RdfSchemaSource)sail; result = rdfSchema.isType(new URIImpl(anInstance), new URIImpl(aClass)); } } catch (Exception ex) { throw new RuntimeException(ex.getMessage()); } return result; } // isType() public boolean isDirectType(String anInstance, String aClass) { boolean result = false; SessionContext sc = getContext(); try { LocalService service = SesameServer.getLocalService(); service.login(sc.user, sc.pass); LocalRepository rep = (LocalRepository)service.getRepository(sc.repository); Sail sail = rep.getSail(); if (sail instanceof RdfSchemaSource) { RdfSchemaSource rdfSchema = (RdfSchemaSource)sail; result = rdfSchema.isDirectType(new URIImpl(anInstance), new URIImpl(aClass)); } } catch (Exception ex) { throw new RuntimeException(ex.getMessage()); } return result; } // isDirectType() /* ->->-> Versioning And Tracking ->->-> */ /** * Create a labeled version for a statte of the repository assigning the * necessary mata-information about thet operation. * @param stateUID the update counter of a particular repository state * @param label the label to be set for this state * NOTE: This method can throw a security exception if the request is made on * behalf of the user with insufficent rights to create versions */ public void labelState(String stateUID, String label) { try { verSail = getVersionManagement(); if (verSail != null) { verSail.labelState(Long.parseLong(stateUID),label); } } catch (Exception ex) { throw new RuntimeException(ex.getMessage()); } } /** * Create a labeled version of the curent repository state. * NOTE: This method can throw an exception if the request is made on * behalf of an user with insufficent rights to create versions */ public void labelCurrentState(String label) { try { verSail = getVersionManagement(); if (verSail != null) { verSail.labelCurrentState(label); } } catch (Exception ex) { throw new RuntimeException(ex.getMessage()); } } /** * Restore the repository to previous state removing all statements added * after the value of the update counter and revive all remover ones. * @param stateUID the update counter of a particular repository state * NOTE: This method can throw an exception if the request is made on * behalf of an user with insufficent rights to revert the repository */ public void revertToState(String stateUID) { SessionContext sc = getContext(); verSail = getVersionManagement(); try { if (verSail != null) { verSail.revertToState(Long.parseLong(stateUID)); } } catch (Exception ex) { throw new RuntimeException(ex.getMessage()); } } /** * Sets the repository to given state for further read operations. * @param stateUID the update counter of a particular repository state */ public void workWithState(String stateUID){ verSail = getVersionManagement(); try { if (verSail != null) { verSail.workWithState(Long.parseLong(stateUID)); } } catch (Exception ex) { throw new RuntimeException(ex.getMessage()); } } /** * branch the repository at given state for further operations. * @param stateUID the update counter of a particular repository state * @return the id of the repository */ public String branchState(String stateUID){ String result = ""; verSail = getVersionManagement(); try { if (verSail != null) { result = verSail.branchState(Long.parseLong(stateUID)); } } catch (Exception ex) { throw new RuntimeException(ex.getMessage()); } return result; } /** * Retrive list of all labeled states of the repository. * @return a list of Versin interfaces for each labeled state of the repository */ public Vector getVersions(){ Vector result=null; verSail = getVersionManagement(); try { if (verSail != null) { Iterator iResult = verSail.getVersions(); result = new Vector(); while (iResult.hasNext()) { result.add(iResult.next().toString()); } } } catch (Exception ex) { throw new RuntimeException(ex.getMessage()); } return result; } /** * Retrive list of all Updates of the repository. * @return a list of Updates of the repository */ public Vector getUpdateIds() {// System.out.println("SoapServices.getUpdateIds()"); verSail = getVersionManagement(); Vector result = new Vector(); try { if (verSail != null) {// System.out.println("sail instanceof VersionManagement ="+verSail); Iterator iResult = verSail.getUpdateIds();// System.out.println("Iterator iResult = verSail.getUpdateIds();="+iResult); while (iResult.hasNext()) { Object o = iResult.next(); result.add(o);// System.out.println(o); } } } catch (Exception ex) { throw new RuntimeException(ex.getMessage()); }// System.out.println("SoapServices.getUpdateIds() end"); return result; } /** * Stop the increment of the update counter. Usefull for a kind of batch updates * or adding a distinct daml coinstructs at once. */ public void pauseCounterIncrement() { verSail = getVersionManagement(); try { if (verSail != null) { verSail.pauseCounterIncrement(); } } catch (Exception ex) { throw new RuntimeException(ex.getMessage()); } } /** * Coninue with the normal increment of the update counter on each modification * made in the repository. */ public void continueCounterIncrement() { verSail = getVersionManagement(); try { if (verSail != null) { verSail.continueCounterIncrement(); } } catch (Exception ex) { throw new RuntimeException(ex.getMessage()); } } /** * Check if the update couter ss paused * @return true if the updateCouter is paused, flase otherwise */ public boolean isPausedCounterIncrement() { verSail = getVersionManagement(); boolean result = false; try { if (verSail != null) { result = verSail.isPausedCounterIncrement(); } } catch (Exception ex) { throw new RuntimeException(ex.getMessage()); } return result; } public Vector getVersionIds() { verSail = getVersionManagement(); Vector result = new Vector(); try { if (verSail != null) { Iterator iResult = verSail.getVersionIds(); while (iResult.hasNext()) { Object o = iResult.next(); result.add(o); } } } catch (Exception ex) { throw new RuntimeException(ex.getMessage()); } return result; } public Map getMetaInfo(String subj, String pred, String obj){ verSail = getVersionManagement(); Map result = null; try { if (verSail != null) { result = verSail.getMetaInfo(subj,pred,obj); } } catch (Exception ex) { throw new RuntimeException(ex.getMessage()); } return result; } public Map getVersionMetaInfo(String versionId){ verSail = getVersionManagement(); Map result = null; try { if (verSail != null) { result = verSail.getVersionMetaInfo(versionId); } } catch (Exception ex) { throw new RuntimeException(ex.getMessage()); } return result; } public Map getUpdateMetaInfo(String updateId){ verSail = getVersionManagement(); Map result = null; try { if (verSail != null) { result = verSail.getUpdateMetaInfo(updateId); } } catch (Exception ex) { throw new RuntimeException(ex.getMessage()); } return result; } /* -<-<-< Versioning And Tracking -<-<-< */} // class SoapServicesclass SoapQueryResultListener implements TableQueryResultListener{ int cols; int current; Vector rows; String[] row; public void startTableQueryResult() throws IOException { rows = new Vector(); cols = 0; } public void startTableQueryResult(String[] columnHeaders) throws IOException { rows = new Vector(); cols = columnHeaders.length; } public void endTableQueryResult() throws IOException { } public void startTuple() throws IOException { current = 0; row = new String[cols]; } public void endTuple() throws IOException { rows.add(row); } public void tupleValue(Value value) throws IOException { row[current++] = value.toString(); } public void error(QueryErrorType errType, String msg) throws IOException { System.out.println("Error: "+msg); } Vector result() {/* String[][] ret = new String[rows.size()][]; for (int i=0; i < rows.size(); i++) { ret[i] = (String[])rows.get(i); } */ return rows; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -