コード例 #1
0
 /**
  * Add resource
  *
  * @param resource resource to add
  * @return jastor object for resource
  * @throws org.openanzo.rdf.jastor.JastorException
  */
 public org.openanzo.ontologies.execution.SemanticOperation addOperation(
     org.openanzo.rdf.Resource resource) throws org.openanzo.rdf.jastor.JastorException {
   org.openanzo.ontologies.execution.SemanticOperation operation =
       org.openanzo.ontologies.execution.SemanticServiceFactory.getSemanticOperation(
           resource, _graph.getNamedGraphUri(), _dataset);
   _dataset.add(_resource, operationProperty, operation.resource(), _graph.getNamedGraphUri());
   return operation;
 }
コード例 #2
0
 public org.openanzo.ontologies.execution.SemanticOperation getPropertyValue(
     org.openanzo.rdf.Value resource) {
   try {
     return org.openanzo.ontologies.execution.SemanticServiceFactory
         .getSemanticOperation(
             (org.openanzo.rdf.Resource) resource, _graph.getNamedGraphUri(), dataset());
   } catch (org.openanzo.rdf.jastor.JastorException e) {
     throw new java.util.NoSuchElementException(e.getMessage());
   }
 }
コード例 #3
0
 public void statementsRemoved(
     org.openanzo.rdf.IDataset dataset, org.openanzo.rdf.Statement... statements) {
   for (org.openanzo.rdf.Statement statement : statements) {
     if (statement.getSubject().equals(resource())) {
       if (statement.getPredicate().equals(serviceUserProperty)) {
         if (!(statement.getObject() instanceof org.openanzo.rdf.Literal)) return;
         for (JavascriptSemanticServiceListener listener : listeners) {
           listener.serviceUserChanged(
               org.openanzo.ontologies.execution.JavascriptSemanticServiceImpl.this);
         }
         return;
       }
       if (statement.getPredicate().equals(operationProperty)) {
         if (!(statement.getObject() instanceof org.openanzo.rdf.Resource)) return;
         org.openanzo.rdf.Resource resource = (org.openanzo.rdf.Resource) statement.getObject();
         org.openanzo.ontologies.execution.SemanticOperation _operation =
             org.openanzo.ontologies.execution.SemanticServiceFactory.getSemanticOperation(
                 resource, _graph.getNamedGraphUri(), dataset());
         if (_operation != null) {
           for (JavascriptSemanticServiceListener listener : listeners) {
             listener.operationRemoved(
                 org.openanzo.ontologies.execution.JavascriptSemanticServiceImpl.this,
                 _operation);
           }
         }
         return;
       }
       if (statement.getPredicate().equals(stateStyleProperty)) {
         if (!(statement.getObject() instanceof org.openanzo.rdf.Resource)) return;
         for (JavascriptSemanticServiceListener listener : listeners) {
           listener.stateStyleChanged(
               org.openanzo.ontologies.execution.JavascriptSemanticServiceImpl.this);
         }
         return;
       }
       if (statement.getPredicate().equals(scriptResourceProperty)) {
         if (!(statement.getObject() instanceof org.openanzo.rdf.Literal)) return;
         for (JavascriptSemanticServiceListener listener : listeners) {
           listener.scriptResourceChanged(
               org.openanzo.ontologies.execution.JavascriptSemanticServiceImpl.this);
         }
         return;
       }
       if (statement.getPredicate().equals(scriptLocationProperty)) {
         if (!(statement.getObject() instanceof org.openanzo.rdf.Resource)) return;
         for (JavascriptSemanticServiceListener listener : listeners) {
           listener.scriptLocationChanged(
               org.openanzo.ontologies.execution.JavascriptSemanticServiceImpl.this);
         }
         return;
       }
     }
   }
 }
コード例 #4
0
 public org.openanzo.ontologies.execution.StateStyleEnum setStateStyle(
     org.openanzo.rdf.Resource resource) throws org.openanzo.rdf.jastor.JastorException {
   if (_dataset.contains(_resource, stateStyleProperty, null, _graph.getNamedGraphUri())) {
     _dataset.remove(_resource, stateStyleProperty, null, _graph.getNamedGraphUri());
   }
   org.openanzo.ontologies.execution.StateStyleEnum stateStyle =
       org.openanzo.ontologies.execution.SemanticServiceFactory.getStateStyleEnum(
           resource, _graph.getNamedGraphUri(), _dataset);
   _dataset.add(_resource, stateStyleProperty, stateStyle.resource(), _graph.getNamedGraphUri());
   return stateStyle;
 }
コード例 #5
0
 public org.openanzo.ontologies.execution.StateStyleEnum setStateStyle()
     throws org.openanzo.rdf.jastor.JastorException {
   _dataset.remove(_resource, stateStyleProperty, null, _graph.getNamedGraphUri());
   org.openanzo.ontologies.execution.StateStyleEnum stateStyle =
       org.openanzo.ontologies.execution.SemanticServiceFactory.createStateStyleEnum(
           org.openanzo.rdf.jastor.ThingFactory.valueFactory.createBNode(),
           _graph.getNamedGraphUri(),
           _dataset);
   _dataset.add(_resource, stateStyleProperty, stateStyle.resource(), _graph.getNamedGraphUri());
   return stateStyle;
 }
コード例 #6
0
 public org.openanzo.ontologies.execution.StateStyleEnum getStateStyle(
     boolean includeEntireDataset) throws org.openanzo.rdf.jastor.JastorException {
   java.util.Collection<org.openanzo.rdf.Statement> result = null;
   result =
       _dataset.find(
           includeEntireDataset, _resource, stateStyleProperty, null, _graph.getNamedGraphUri());
   if (result.isEmpty()) return null;
   org.openanzo.rdf.Statement statement = result.iterator().next();
   if (statement == null) return null;
   if (!((statement.getObject() instanceof org.openanzo.rdf.URI)
       || (statement.getObject() instanceof org.openanzo.rdf.BlankNode)))
     throw new org.openanzo.rdf.jastor.InvalidNodeException(
         uri()
             + ": stateStyle getProperty() in org.openanzo.ontologies.execution.JavascriptSemanticService model not Resource",
         statement.getObject());
   org.openanzo.rdf.Resource resource = (org.openanzo.rdf.Resource) statement.getObject();
   return org.openanzo.ontologies.execution.SemanticServiceFactory.getStateStyleEnum(
       resource, (includeEntireDataset) ? null : _graph.getNamedGraphUri(), _dataset);
 }