diff options
author | Federico Igne <federico.igne@cs.ox.ac.uk> | 2020-08-19 11:11:53 +0100 |
---|---|---|
committer | Federico Igne <federico.igne@cs.ox.ac.uk> | 2020-08-19 11:11:53 +0100 |
commit | 3a166085e656be5f957423e6e371b6647b313997 (patch) | |
tree | cc3486d5bde7dc692ee71948fd03e907b7badc7f /src/main/scala/rsacomb/RDFoxClassExprConverter.scala | |
parent | 56a3cc7f1a2d1dc85a262f2648cf246197684caf (diff) | |
download | RSAComb-3a166085e656be5f957423e6e371b6647b313997.tar.gz RSAComb-3a166085e656be5f957423e6e371b6647b313997.zip |
Use `rdf(..)` instead of `create(..)` to create `Atom`s
Diffstat (limited to 'src/main/scala/rsacomb/RDFoxClassExprConverter.scala')
-rw-r--r-- | src/main/scala/rsacomb/RDFoxClassExprConverter.scala | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/src/main/scala/rsacomb/RDFoxClassExprConverter.scala b/src/main/scala/rsacomb/RDFoxClassExprConverter.scala index 9116be0..c1fd85a 100644 --- a/src/main/scala/rsacomb/RDFoxClassExprConverter.scala +++ b/src/main/scala/rsacomb/RDFoxClassExprConverter.scala | |||
@@ -22,7 +22,8 @@ import tech.oxfordsemantic.jrdfox.logic.{ | |||
22 | Term, | 22 | Term, |
23 | Variable, | 23 | Variable, |
24 | Literal, | 24 | Literal, |
25 | Datatype | 25 | Datatype, |
26 | IRI | ||
26 | } | 27 | } |
27 | 28 | ||
28 | import rsacomb.SkolemStrategy | 29 | import rsacomb.SkolemStrategy |
@@ -56,10 +57,11 @@ class RDFoxClassExprConverter( | |||
56 | unsafe: List[OWLObjectPropertyExpression] | 57 | unsafe: List[OWLObjectPropertyExpression] |
57 | ) extends OWLClassExpressionVisitorEx[RDFoxRuleShards] { | 58 | ) extends OWLClassExpressionVisitorEx[RDFoxRuleShards] { |
58 | 59 | ||
60 | import RDFoxUtil.owlapi2rdfox; | ||
61 | |||
59 | // OWLClass | 62 | // OWLClass |
60 | override def visit(expr: OWLClass): RDFoxRuleShards = { | 63 | override def visit(expr: OWLClass): RDFoxRuleShards = { |
61 | val name = expr.getIRI.getIRIString | 64 | val atom = List(Atom.rdf(term, IRI.RDF_TYPE, expr.getIRI())) |
62 | val atom = List(Atom.create(TupleTableName.create(name), term)) | ||
63 | RDFoxRuleShards(atom, List()) | 65 | RDFoxRuleShards(atom, List()) |
64 | } | 66 | } |
65 | 67 | ||
@@ -84,9 +86,8 @@ class RDFoxClassExprConverter( | |||
84 | .head // restricts to proper "nominals" | 86 | .head // restricts to proper "nominals" |
85 | .asOWLNamedIndividual | 87 | .asOWLNamedIndividual |
86 | .getIRI | 88 | .getIRI |
87 | .getIRIString | ||
88 | val atom = List( | 89 | val atom = List( |
89 | Atom.sameAs(term, Literal.create(ind, Datatype.IRI_REFERENCE)) | 90 | Atom.sameAs(term, ind) |
90 | ) | 91 | ) |
91 | RDFoxRuleShards(atom, List()) | 92 | RDFoxRuleShards(atom, List()) |
92 | } | 93 | } |
@@ -101,25 +102,22 @@ class RDFoxClassExprConverter( | |||
101 | // technique it might involve the introduction of additional atoms, | 102 | // technique it might involve the introduction of additional atoms, |
102 | // and/or fresh constants and variables. | 103 | // and/or fresh constants and variables. |
103 | val (head, body, term1) = skolem match { | 104 | val (head, body, term1) = skolem match { |
104 | case SkolemStrategy.None => (List(), List(), y) | 105 | case SkolemStrategy.None => (List(), List(), y) |
105 | case SkolemStrategy.Constant(c) => | 106 | case SkolemStrategy.Constant(c) => (List(), List(), c) |
106 | (List(), List(), Literal.create(c, Datatype.IRI_REFERENCE)) | ||
107 | case SkolemStrategy.ConstantRSA(c) => { | 107 | case SkolemStrategy.ConstantRSA(c) => { |
108 | val lit = Literal.create(c, Datatype.IRI_REFERENCE) | ||
109 | if (unsafe.contains(prop)) | 108 | if (unsafe.contains(prop)) |
110 | ( | 109 | ( |
111 | List( | 110 | List( |
112 | Atom.create(TupleTableName.create("internal:PE"), term, lit), | 111 | Atom.rdf(term, IRI.create(RSA.PredicatePE), c), |
113 | Atom.create(TupleTableName.create("internal:U"), lit) | 112 | Atom.rdf(c, IRI.RDF_TYPE, IRI.create(RSA.PredicateU)) |
114 | ), | 113 | ), |
115 | List(), | 114 | List(), |
116 | lit | 115 | c |
117 | ) | 116 | ) |
118 | else | 117 | else |
119 | (List(), List(), lit) | 118 | (List(), List(), c) |
120 | } | 119 | } |
121 | case SkolemStrategy.Standard(f) => | 120 | case SkolemStrategy.Standard(f) => |
122 | // At the time of writing the RDFox library does not have a | ||
123 | // particular class for the "SKOLEM" operator and it is instead | 121 | // particular class for the "SKOLEM" operator and it is instead |
124 | // a simple builtin function with a "special" name. | 122 | // a simple builtin function with a "special" name. |
125 | ( | 123 | ( |
@@ -153,7 +151,7 @@ class RDFoxClassExprConverter( | |||
153 | .map(expr.getProperty.accept(_)) | 151 | .map(expr.getProperty.accept(_)) |
154 | .flatten | 152 | .flatten |
155 | RDFoxRuleShards( | 153 | RDFoxRuleShards( |
156 | List(Atom.create(TupleTableName.create("owl:sameAs"), vars(0), vars(1))), | 154 | List(Atom.sameAs(vars(0), vars(1))), |
157 | classResult.res ++ propertyResult | 155 | classResult.res ++ propertyResult |
158 | ) | 156 | ) |
159 | } | 157 | } |