1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
use super::collector::MatcherHandler;
use crate::error::Error;
use crate::get_vars;
use crate::owl::ObjectPropertyAssertion;
use crate::owl::IRI;
use crate::parser::matcher::RdfMatcher;
use crate::parser::matcher::Value;
use crate::rdf_match;
use std::collections::HashMap;
pub(crate) fn push(
matchers: &mut Vec<(RdfMatcher, MatcherHandler)>,
_prefixes: &HashMap<String, String>,
) -> Result<(), Error> {
matchers.push((
rdf_match!("ObjectPropertyAssertion", _prefixes,
[+:subject] [*:predicate] [+:object] .
)?,
Box::new(|mstate, o, options| {
if let Some(vars) = get_vars!(mstate, subject, predicate, object) {
if let Ok(predicate) = vars.predicate.clone().try_into() {
let predicate: IRI = predicate;
if let Value::Iri(iri) = vars.subject {
if let Ok(subject) = IRI::new(iri) {
if let Value::Iri(iri) = vars.object {
if let Ok(object) = IRI::new(iri) {
if o.object_property_declaration(&predicate).is_some()
|| options.is_object_prop(&predicate)
{
o.push_axiom(
ObjectPropertyAssertion::new(
predicate.into(),
subject.into(),
object.into(),
vec![],
)
.into(),
)
}
}
}
}
}
}
}
Ok(false)
}),
));
Ok(())
}