private Optional<IQ> getRDFClassDefinition(RDFAtomPredicate predicate, ImmutableList<? extends VariableOrGroundTerm> arguments) { return predicate.getClassIRI(arguments) .map(i -> mapping.getRDFClassDefinition(predicate, i)) .orElseGet(() -> getStarClassDefinition(predicate)); }
private Optional<IRI> extractIRI(Function atom) { return Optional.of(atom.getFunctionSymbol()) .filter(p -> p instanceof RDFAtomPredicate) .map(p -> (RDFAtomPredicate) p) .flatMap(p -> { ImmutableList<ImmutableTerm> arguments = atom.getTerms().stream() .map(immutabilityTools::convertIntoImmutableTerm) .collect(ImmutableCollectors.toList()); return p.getClassIRI(arguments) .map(Optional::of) .orElseGet(() -> p.getPropertyIRI(arguments)); }); }
private Optional<IRI> extractClassIRI(Function rdfDataAtom) { if (rdfDataAtom.getFunctionSymbol() instanceof RDFAtomPredicate) { RDFAtomPredicate rdfAtomPredicate = (RDFAtomPredicate) rdfDataAtom.getFunctionSymbol(); ImmutableList<ImmutableTerm> arguments = rdfDataAtom.getTerms().stream() .map(immutabilityTools::convertIntoImmutableTerm) .collect(ImmutableCollectors.toList()); return rdfAtomPredicate.getClassIRI(arguments); } return Optional.empty(); } }
private RDFPredicate extractRDFPredicate(CQIE mappingAssertion) { Function headAtom = mappingAssertion.getHead(); if (!(headAtom.getFunctionSymbol() instanceof RDFAtomPredicate)) throw new MinorOntopInternalBugException("Mapping assertion without an RDFAtomPredicate found"); RDFAtomPredicate predicate = (RDFAtomPredicate) headAtom.getFunctionSymbol(); ImmutableList<ImmutableTerm> arguments = headAtom.getTerms().stream() .map(immutabilityTools::convertIntoImmutableTerm) .collect(ImmutableCollectors.toList()); return predicate.getClassIRI(arguments) .map(iri -> new RDFPredicate(true, iri)) .orElseGet(() -> predicate.getPropertyIRI(arguments) .map(i -> new RDFPredicate(false, i)) .orElseThrow(() -> new MinorOntopInternalBugException("Could not extract a predicate IRI from " + headAtom))); }
RDFAtomPredicate predicate = (RDFAtomPredicate)projectionAtom.getPredicate(); boolean isClass = predicate.getClassIRI(a.getSubstitutedTerms()) .isPresent();
RDFAtomPredicate predicate = (RDFAtomPredicate) targetAtom.getProjectionAtom().getPredicate(); Optional<org.apache.commons.rdf.api.IRI> classIRI = predicate.getClassIRI(terms); Optional<org.apache.commons.rdf.api.IRI> propertyIRI = predicate.getPropertyIRI(terms);