Home
Categories
Dictionary
Glossary
Download
Project Details
Changes Log
What Links Here
FAQ
License

Jena applyOperations service



The http://dassault-aviation.com/jena:applyOperations service allows to chain a list of update or creation operations in the underlying database in only one transaction.

The service has two datas:
  • reqSchema: the schema of the Owl database
  • operations: the operations, which is an instance of the org.da.protoframework.jena.common.operations.Operations class

Types of operations

There are several types of operations:
  • AddInstanceOperation: to create an instance
  • RemoveInstanceOperation: to remove an instance
  • AddDataPropertyOperation: to create or update a data property
  • AddPropertyOperation: to create or update an object property
  • SetGeoSPARQLGeometryOperation: to set or update a GeoSPARQL geometric position
  • SetOwlTimeOperation: to set or update a owl-time value
Note that you can use these operations directly, or use them trhough a Jena model mapping.

AddInstanceOperation

The org.da.protoframework.jena.common.operations.AddInstanceOperation class allows to add an instance. The arguments for the creation are:
  • The instance name
  • The class name
        AddInstanceOperation op = new AddInstanceOperation("PabloPicasso", "NamedIndividual");       
        operations.addOperation(op);      

RemoveInstanceOperation

The org.da.protoframework.jena.common.operations.RemoveInstanceOperation class allows to remove an instance. The arguments for the creation are:
  • The instance name
  • The class name
        RemoveInstanceOperation op = new RemoveInstanceOperation("PabloPicasso", "NamedIndividual");       
        operations.addOperation(op);      

AddDataPropertyOperation

The org.da.protoframework.jena.common.operations.AddDataPropertyOperation class allows to add a data property on an existing instance. The arguments for the creation are:
  • The instance name
  • The data property class name
  • The data property value
Or if a bookmark on an instance is used:
  • The data property class name
  • The data property value
        AddDataPropertyOperation op = new AddDataPropertyOperation("pablo", "firstName", "Pablo");
        operations.addOperation(op);

AddPropertyOperation

The org.da.protoframework.jena.common.operations.AddPropertyOperation class allows to add an object property on an existing instance. The arguments for the creation are:
  • The instance name
  • The property class name
  • The property reference name (which is the name of the object referenced by the property)
Or if a bookmark on an instance is used:
  • The data property class name
  • The property reference name
        AddPropertyOperation op = new AddPropertyOperation("pablo", "Wife", "jacqueline");
        operations.addOperation(op);

SetGeoSPARQLGeometryOperation

The org.da.protoframework.jena.common.operations.SetGeoSPARQLGeometryOperation class allows to set the Geosparql geometry on an existing instance. The arguments for the creation are:
  • The instance name
  • The geometry
  • true of false depending if the geometry is exact or not

Bookmarks

It is possible to set bookmarks for AddInstance operations and use them rather than specify explictly the instance for subsequent properties of gemoetry operations. For example:
        AddInstanceOperation op = new AddInstanceOperation("PabloPicasso", "NamedIndividual");       
        operations.addOperation(op); 
        String bookmark = op.setBookMark("pablo"); 
      
        AddDataPropertyOperation op = new AddDataPropertyOperation("firstName", "Pablo");
        op.useBookmark("pablo");
        operations.addOperation(op);   
      
        AddPropertyOperation op2 = new AddPropertyOperation("Wife", "jacqueline");
        op2.useBookmark("pablo");
        operations.addOperation(op);            

SetOwlTimeOperation

The org.da.protoframework.jena.common.operations.SetOwlTimeOperation class allows to set the owl-time value on an existing instance. The arguments for the creation are:
  • The instance name
  • The owl-time value

Bookmarks

It is possible to set bookmarks for AddInstance operations and use them rather than specify explictly the instance for subsequent properties of gemoetry operations. For example:
        AddInstanceOperation op = new AddInstanceOperation("PabloPicasso", "NamedIndividual");       
        operations.addOperation(op); 
        String bookmark = op.setBookMark("pablo"); 
      
        AddDataPropertyOperation op = new AddDataPropertyOperation("firstName", "Pablo");
        op.useBookmark("pablo");
        operations.addOperation(op);   
      
        AddPropertyOperation op2 = new AddPropertyOperation("Wife", "jacqueline");
        op2.useBookmark("pablo");
        operations.addOperation(op);            

Apply operations using a model mapping

Main Article: Jena model mapping

A batch of operations can be specified using an existing ObjectMappings with the following code:
         ElementsOperations operationsBatch = new ElementsOperations(module, mappings);    

Applied operations

See also


Categories: builtin-applis

Copyright 2017-2020 Dassault Aviation. All Rights Reserved. Documentation and source under the LGPL v3 licence