@@ -36,6 +36,11 @@ object UsingAst {
36
36
def === (c : Int ): === [I ] = examples.=== (_i, BigInt (c))
37
37
38
38
def ≥ (c : Int ): ≥ [I ] = examples.≥ (_i, BigInt (c))
39
+
40
+ def ^^ [J ](j : J )(implicit iString : I => String , jDatatype : J => Datatype ): TypedLiteral = TypedLiteral (_i, j)
41
+
42
+ def | [J ](j : J )(implicit iDT : I => Datatype , jFR : J => FacetRestriction ): DatatypeRestriction =
43
+ DatatypeRestriction (datatype = _i, restrictions = j:: Nil )
39
44
}
40
45
}
41
46
@@ -64,11 +69,19 @@ object Triple {
64
69
AnnotationAssertion (Nil , t.sub, t.pred, t.obj)
65
70
66
71
implicit def toObjectPropertyAssertion [Sub , Pred , Obj ](t : Triple [Sub , Pred , Obj ]
67
- )(implicit
68
- subIndividual : Sub => Individual ,
69
- predPE : Pred => ObjectPropertyExpression ,
70
- objIndividual : Obj => Individual ): ObjectPropertyAssertion =
71
- ObjectPropertyAssertion (Nil , t.sub, t.pred, t.obj)
72
+ )(implicit
73
+ subIndividual : Sub => Individual ,
74
+ predPE : Pred => ObjectPropertyExpression ,
75
+ objIndividual : Obj => Individual ): ObjectPropertyAssertion =
76
+ ObjectPropertyAssertion (Nil , t.sub, t.pred, t.obj)
77
+
78
+ implicit def toDataPropertyAssertion [Sub , Pred , Obj ](t : Triple [Sub , Pred , Obj ]
79
+ )(implicit
80
+ subIndividual : Sub => Individual ,
81
+ predPE : Pred => DataPropertyExpression ,
82
+ objLit : Obj => Literal ): DataPropertyAssertion =
83
+ DataPropertyAssertion (Nil , t.sub, t.pred, t.obj)
84
+
72
85
}
73
86
74
87
case class Inverse [P ](p : P ) {
@@ -145,7 +158,12 @@ case object ∃ {
145
158
implicit def someObjectSomeValuesFrom [P , V ](some : ∃ [P , V ])(implicit
146
159
pPE : P => ObjectPropertyExpression ,
147
160
vCE : V => ClassExpression ): ObjectSomeValuesFrom =
148
- ObjectSomeValuesFrom (some.p, some.v)
161
+ ObjectSomeValuesFrom (some.p, some.v)
162
+
163
+ implicit def someDataSomeValuesFrom [P , V ](some : ∃ [P , V ])(implicit
164
+ pPE : P => DataPropertyExpression ,
165
+ vDR : V => DataRange ): DataSomeValuesFrom =
166
+ DataSomeValuesFrom (some.p:: Nil , some.v)
149
167
}
150
168
151
169
case class ∀ [P , V ](p : P , v : V )
@@ -155,6 +173,11 @@ case object ∀ {
155
173
pPE : P => ObjectPropertyExpression ,
156
174
vCE : V => ClassExpression ): ObjectAllValuesFrom =
157
175
ObjectAllValuesFrom (all.p, all.v)
176
+
177
+ implicit def allDataValuesFrom [P , V ](all : ∀ [P , V ])(implicit
178
+ pPE : P => DataPropertyExpression ,
179
+ vDR : V => DataRange ): DataAllValuesFrom =
180
+ DataAllValuesFrom (all.p:: Nil , all.v)
158
181
}
159
182
160
183
case class ∈ [P , V ](p : P , v : V )
@@ -164,6 +187,11 @@ object ∈ {
164
187
pPE : P => ObjectPropertyExpression ,
165
188
vI : V => Individual ): ObjectHasValue =
166
189
ObjectHasValue (pv.p, pv.v)
190
+
191
+ implicit def toDataHasValue [P , V ](pv : ∈ [P , V ])(implicit
192
+ pPE : P => DataPropertyExpression ,
193
+ vI : V => Literal ): DataHasValue =
194
+ DataHasValue (pv.p, pv.v)
167
195
}
168
196
169
197
case class ≤ [P ](p : P , c : BigInt )
@@ -348,6 +376,21 @@ class UsingAst {
348
376
ObjectMinCardinality (objectPropertyExpression = " a" -> " hasPet" , cardinality = BigInt (1 ))
349
377
" a" -> " hasPet" ≥ 1 : ObjectMinCardinality
350
378
379
+ DataPropertyAssertion (Nil , " a" -> " Meg" , " a" -> " hasAge" , " 17" ^^ (" xsd" -> " integer" ))
380
+ (" a" -> " Meg" ) --- (" a" -> " hasAge" ) --> (" 17" ^^ (" xsd" -> " integer" )) : DataPropertyAssertion
381
+
382
+ DataSomeValuesFrom (
383
+ (" a" -> " hasAge" ):: Nil ,
384
+ DatatypeRestriction (
385
+ BigInt (1 ),
386
+ " xsd" -> " integer" ,
387
+ FacetRestriction (" xsd" -> " maxExclusive" , " 20" ^^ (" xsd" -> " integer" )):: Nil ),
388
+ BigInt (1 ))
389
+
390
+ ∃ (" a" -> " hasAge" , " xsd" -> " integer" | " xsd" -> " maxExclusive" -> (" 20" ^^ (" xsd" -> " integer" ))) : DataSomeValuesFrom
391
+ ∀ (" a" -> " hasZIP" , " xsd" -> " integer" ) : DataAllValuesFrom
392
+ ∈ (" a" -> " hasAge" , " 17" ^^ (" xsd" -> " integer" )) : DataHasValue
393
+
351
394
SubObjectPropertyOf (Nil , " a" -> " hasDog" , (" a" -> " hasPet" : ObjectPropertyExpression ) :: Nil )
352
395
ObjectPropertyAssertion (Nil , " a" -> " Peter" , " a" -> " hasDog" , " a" -> " Brian" )
353
396
ObjectPropertyAssertion (Nil , " a" -> " Peter" , " a" -> " hasPet" , " a" -> " Brian" )
0 commit comments