int
, short
, or string
<constants> <constant name="TaskZone" value="3" type="short" /> <constant name="RefuelZone" value="1" type="short" /> <constant name="JTACZone" value="6" type="short" /> </constants>
object
elements allows to specify classes in the Owl ontology and their properties. It simplifies adding or updating individuals of these classes in the ontology.name
: The name which will be used to represent an individual of this classclassName
: The name of the associated class in the OntologynameSuffix
: If this attribute is present, it will automatically add the associated suffix to the name of the element in the ontology<object name="flightplan" className="FlightPlan" nameSuffix="_flightplan"> <dataProperty name="label" property="Label" isName="true"/> <property name="waypoint" eltRef="waypoint" property="hasWaypoint" inverseProperty="isWaypointFrom" cardinality="unbound" inverseCardinality="one" /> </object> <object name="waypoint" className="Waypoint" nameSuffix="_waypoint"> <geometry /> <dataProperty name="label" property="Label" isName="true"/> </object>In this example, individuals of the
FlightPlan
class can be created with the following code:MappedElement fp = envOp.addElement("flightplan", eltName);The
nameSuffix
attribute ensures that the name of the individual will use the suffix. For example, if you have:MappedElement fp = envOp.addElement("flightplan", "FP1");The individual will have the name
FP1_flightplan
.waypoint
property models the list of waypoints of the FlightPlan:waypoint
property corresponds to the hasWaypoint
object property in the Owl ontology. It is the inverse of the isWaypointFrom
object property on the associated Waypoint
elementcardinality
attribute specifies that there can be any number of the waypoint
object properties. The inverse cardinality specifies that there can be only one FlightPlan
for one waypointclass
elements allows to associated a Java object in the model to an associated object.
property
, dataProperty
, and enumProperty
elements define respectively for an object:cardinality
attribute which specifies if there can be more than one of these properties or data properties on the element. The ossible values for this property are:<object name="person" className="Person" nameSuffix="_person"> <dataProperty name="name" property="Name" isName="true"/> <dataProperty name="age" property="Age" cardinality="one"/> </object>Then with the following code:
MappedElement personElt = envOp.addElement("person", "John"); personElt.addDataProperty("age", 23); personElt.addDataProperty("age", 30);There will be only one "Age" data property for the element in the Ontology.
<object name="mission" className="TaskMission" nameSuffix="_mission"> <dataProperty name="id" property="MissionCode" isName="true" cardinality="one"/> <dataProperty name="alias" property="alias" cardinality="unbound"/> </object>In this example, the "mission" element correspond to the "TaskMission" class. It has two datatype properties:
<object name="JTACZone" className="JTACZone"> <dataProperty name="label" property="Label" isName="true" cardinality="one"/> <property name="jtac" eltRef="jtac" property="underResponsabilityOf" inverseProperty="inResponsabilityOfZone"/> </object>In this example, the "JTACZone" element correspond to the "TaskMission" class. It has one property:
ObjectMappings mappings = new ObjectMappings(); URL url = <the Mappings XML file URL> mappings.parse(module, url);
ObjectMappings
with the following code:ElementsOperations operationsBatch = new ElementsOperations(module, mappings);This batch has the following API:
public class org.da.protoframework.jena.common.mappings.ElementsOperations |
---|
Modifier and Type | Method and Description |
---|---|
MappedElement | addElement(Object element)
Add an element on the ontology using an object. The name of the individual and its class in the ontology will be generated automatically using the element name (and optionally its suffix)
|
MappedElement | addElement(String type, String name)
Add an element on the ontology of a specified type and name
|
MappedElement
has the following API:public class org.da.protoframework.jena.common.mappings.ElementsOperations |
---|
Modifier and Type | Method and Description |
---|---|
void | addDataProperty(String name, Object value)
Add a data property to the element
|
void | addProperty(String name, String elementRef)
Add an object property to the element. The elementRef is the name of the reference element
|
void | addProperty(String name, Object elementRef)
Add an object property to the element. The elementRef is the Java object which will be automatically mapped to the reference name
|
MappedElement.setBookmarked(true)
will only use the element as a bookmark for subsequent operationsMappedElement.setUpdated(true)
will not create the element if it does not already existMappedElement.setRemoved(true)
will remove the element if it already exists<object name="jtac" className="JTAC" nameSuffix="_jtac"> <dataProperty name="label" property="Label" isName="true"/> <dataProperty name="nationality" property="Nationality" /> <property name="frequencyPlan" eltRef="frequencyPlan" property="hasFrequencyPlan"/> </object>If we want to create a JTAC, we can have the following code:
MappedElement jtacElt = envOp.addElement("jtac", jtacname); jtacElt.addDataProperty("label", zoneName); jtacElt.addDataProperty("nationality", "French"); jtacElt.addProperty("frequencyPlan", freqPlanName);If we want to remove an existing JTAC, we can have the following code:
MappedElement jtacElt = envOp.addElement("jtac", jtacname); jtacElt.setRemoved(true);
Copyright 2017-2020 Dassault Aviation. All Rights Reserved. Documentation and source under the LGPL v3 licence