@prefix : <http://multimedialab.elis.ugent.be/ontologies/ifc/instances#>.
@prefix x3d: <http://smartlab.elis.ugent.be/aimontologies/geometry/ontologyx3d20091015#>.
@prefix math: <http://www.w3.org/2000/10/swap/math#>.
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix list: <http://www.co-ode.org/ontologies/lists/2008/09/11/list.owl#>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
@prefix inst: <http://multimedialab.elis.ugent.be/ontologies/ifc/instances#>.
@prefix ifc: <http://multimedialab.elis.ugent.be/ontologies/ifc/ontology#>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
@prefix log: <http://www.w3.org/2000/10/swap/log#>.
@prefix e: <http://eulersharp.sourceforge.net/2003/03swap/log-rules#>.
@prefix matrix: <http://smartlab.elis.ugent.be/ontologies/regulations/geometry/matrix#>.
@prefix stl: <http://smartlab.elis.ugent.be/aimontologies/geometry/ontologySTL20091101#>.

# IfcAxis2Placement3D
# Test if IfcAxis2Placement3D does not include an axis and refDirection. If found, set the default axis and the refDirection. Either both (Axis
# and RefDirection) are not given and therefore defaulted, or both shall be given. Therefore it's only necessary to search for one.
{
   ?x rdf:type ifc:IfcAxis2Placement3D.
   ?y e:findall (?ref {?x ifc:refDirection ?ref} ())
}
=>
{
   :ifcDirection_DefaultAxisDirection3D ifc:directionRatios ("0.0"^^xsd:double "0.0"^^xsd:double "1.0"^^xsd:double).
   :ifcDirection_DefaultAxisDirection3D a ifc:IfcDirection.
   :ifcDirection_DefaultRefDirection3D ifc:directionRatios ("1.0"^^xsd:double "0.0"^^xsd:double "0.0"^^xsd:double).
   :ifcDirection_DefaultRefDirection3D a ifc:IfcDirection.
   ?x ifc:axis :ifcDirection_DefaultAxisDirection3D.
   ?x ifc:refDirection :ifcDirection_DefaultRefDirection3D
}.

# IfcAxis2Placement2D
# Test if IfcAxis2Placement3D does not include an axis and refDirection. If found, set the default axis and the refDirection. Either both (Axis
# and RefDirection) are not given and therefore defaulted, or both shall be given. Therefore it's only necessary to search for one.
{
   ?x rdf:type ifc:IfcAxis2Placement2D.
   ?y e:findall (?ref {?x ifc:refDirection ?ref} ())
}
=>
{
   :ifcDirection_DefaultRefDirection2D ifc:directionRatios ("1.0"^^xsd:double "0.0"^^xsd:double).
   :ifcDirection_DefaultRefDirection2D a ifc:IfcDirection.
   ?x ifc:refDirection :ifcDirection_DefaultRefDirection2D
}.

