Tabnine Logo
DataAtom.getPredicate
Code IndexAdd Tabnine to your IDE (free)

How to use
getPredicate
method
in
it.unibz.inf.ontop.model.atom.DataAtom

Best Java code snippets using it.unibz.inf.ontop.model.atom.DataAtom.getPredicate (Showing top 20 results out of 315)

origin: ontop/ontop

@Override
protected Optional<IQ> getDefinition(IntensionalDataNode dataNode) {
  return Optional.ofNullable(map.get(dataNode.getProjectionAtom().getPredicate()));
}
origin: ontop/ontop

protected static ImmutableMultimap<RelationPredicate, ExtensionalDataNode> extractDataNodes(ImmutableList<QueryNode> siblings) {
  ImmutableMultimap.Builder<RelationPredicate, ExtensionalDataNode> mapBuilder = ImmutableMultimap.builder();
  for (QueryNode node : siblings) {
    if (node instanceof ExtensionalDataNode) {
      ExtensionalDataNode dataNode = (ExtensionalDataNode) node;
      mapBuilder.put(dataNode.getProjectionAtom().getPredicate(), dataNode);
    }
  }
  return mapBuilder.build();
}
origin: ontop/ontop

private RDFAtomPredicate getRDFAtomPredicate(DataAtom atom){
  return Optional.of(atom.getPredicate())
      .filter(p -> p instanceof RDFAtomPredicate)
      .map(p -> (RDFAtomPredicate) p)
      .orElseThrow(() -> new CanonicalTransformerException(RDFAtomPredicate.class.getName() + " expected"));
}
origin: it.unibz.inf.ontop/ontop-optimization

protected static ImmutableMultimap<AtomPredicate, DataNode> extractDataNodes(ImmutableList<QueryNode> siblings) {
  ImmutableMultimap.Builder<AtomPredicate, DataNode> mapBuilder = ImmutableMultimap.builder();
  for (QueryNode node : siblings) {
    if (node instanceof DataNode) {
      DataNode dataNode = (DataNode) node;
      mapBuilder.put(dataNode.getProjectionAtom().getPredicate(), dataNode);
    }
  }
  return mapBuilder.build();
}
origin: ontop/ontop

private Optional<IRI> getPropertyIRI(DataAtom atom) {
  AtomPredicate atomPredicate = atom.getPredicate();
  return Optional.of(atomPredicate)
      .filter(p -> p instanceof RDFAtomPredicate)
      .map(p -> (RDFAtomPredicate) p)
      .flatMap(p -> p.getPropertyIRI(atom.getArguments()));
}
origin: ontop/ontop

private static boolean extendHomomorphism(Map<Variable, VariableOrGroundTerm> map, DataAtom from, DataAtom to) {
  return from.getPredicate().equals(to.getPredicate())
      && extendHomomorphism(map, from.getArguments(), to.getArguments());
}
origin: it.unibz.inf.ontop/ontop-model

@Override
public boolean hasSamePredicateAndArity(DataAtom otherAtom) {
  if (!predicate.equals(otherAtom.getPredicate()))
    return false;
  if (getEffectiveArity() != otherAtom.getEffectiveArity())
    return false;
  return true;
}
origin: ontop/ontop

/**
 * Predicates not having a DatabaseRelationDefinition are ignored
 */
private ImmutableMultimap<RelationDefinition, ExtensionalDataNode> extractDataNodeMap(IntermediateQuery query,
                                           InnerJoinNode joinNode) {
  return query.getChildren(joinNode).stream()
      .filter(c -> c instanceof ExtensionalDataNode)
      .map(c -> (ExtensionalDataNode) c)
      .map(c -> Maps.immutableEntry(c.getProjectionAtom().getPredicate().getRelationDefinition(), c))
      .collect(ImmutableCollectors.toMultimap());
}
origin: ontop/ontop

private <P extends AtomPredicate> DataAtom<P> replaceVars(DataAtom<P> projectionAtom, ImmutableList<Optional<Variable>> replacements) {
  Iterator<Optional<Variable>> it = replacements.iterator();
  return atomFactory.getDataAtom(
      projectionAtom.getPredicate(),
      projectionAtom.getArguments().stream()
          .map(a -> {
            Optional<Variable> r = it.next();
            return r.isPresent() ?
                r.get() :
                a;
          })
          .collect(ImmutableCollectors.toList())
  );
}
origin: it.unibz.inf.ontop/ontop-model

private DataAtom renameDataAtom(DataAtom atom) {
  ImmutableList.Builder<VariableOrGroundTerm> argListBuilder = ImmutableList.builder();
  for (VariableOrGroundTerm term : atom.getArguments()) {
    argListBuilder.add(renamingSubstitution.applyToTerm(term));
  }
  return ATOM_FACTORY.getDataAtom(atom.getPredicate(), argListBuilder.build());
}
origin: ontop/ontop

@Override
public boolean isVariableNullable(IntermediateQuery query, Variable variable) {
  if (!getVariables().contains(variable))
    throw new IllegalArgumentException("The variable " + variable + " is not projected by " + this);
  DataAtom<RelationPredicate> atom = getProjectionAtom();
  RelationDefinition relation = atom.getPredicate().getRelationDefinition();
  ImmutableList<? extends VariableOrGroundTerm> arguments = atom.getArguments();
  // NB: DB column indexes start at 1.
  return IntStream.range(1, arguments.size() + 1)
      .filter(i -> arguments.get(i - 1).equals(variable))
      .mapToObj(relation::getAttribute)
      .allMatch(Attribute::canNull);
}
origin: ontop/ontop

/**
 * TODO: explain
 */
public DataNode createDataNode(IntermediateQueryFactory iqFactory, DataAtom dataAtom,
                   Collection<Predicate> tablePredicates) {
  if (tablePredicates.contains(dataAtom.getPredicate())) {
    return iqFactory.createExtensionalDataNode(dataAtom);
  }
  return iqFactory.createIntensionalDataNode(dataAtom);
}
origin: it.unibz.inf.ontop/ontop-optimization

/**
 * TODO: explain
 */
public static DataNode createDataNode(IntermediateQueryFactory iqFactory, DataAtom dataAtom,
                   Collection<Predicate> tablePredicates) {
  if (tablePredicates.contains(dataAtom.getPredicate())) {
    return iqFactory.createExtensionalDataNode(dataAtom);
  }
  return iqFactory.createIntensionalDataNode(dataAtom);
}
origin: ontop/ontop

private DataAtom renameDataAtom(DataAtom<? extends AtomPredicate> atom) {
  ImmutableList.Builder<VariableOrGroundTerm> argListBuilder = ImmutableList.builder();
  for (VariableOrGroundTerm term : atom.getArguments()) {
    argListBuilder.add(renamingSubstitution.applyToTerm(term));
  }
  return atomFactory.getDataAtom(atom.getPredicate(), argListBuilder.build());
}
origin: ontop/ontop

@Override
protected Optional<IQ> getDefinition(IntensionalDataNode dataNode) {
  if (getPropertyIRI(dataNode.getProjectionAtom())
      .filter(i -> i.equals(Ontop.CANONICAL_IRI))
      .isPresent()) {
    return Optional.of(definition);
  }
  throw new UnexpectedPredicateException(dataNode.getProjectionAtom().getPredicate());
}
origin: ontop/ontop

public Function convertToMutableFunction(DataAtom dataAtom) {
  return convertToMutableFunction(dataAtom.getPredicate(), dataAtom.getArguments());
}
origin: it.unibz.inf.ontop/ontop-optimization

protected DataNode generateDataNode(DataNode formerDataNode, ImmutableList<VariableOrGroundTerm> arguments) {
  DataAtom dataAtom = ATOM_FACTORY.getDataAtom(formerDataNode.getProjectionAtom().getPredicate(), arguments);
  if (formerDataNode instanceof ExtensionalDataNode) {
    return iqFactory.createExtensionalDataNode(dataAtom);
  }
  else if (formerDataNode instanceof IntensionalDataNode) {
    return iqFactory.createIntensionalDataNode(dataAtom);
  }
  else {
    throw new RuntimeException("Transformation of a data node of type "
        + formerDataNode.getClass() + " is not supported yet");
  }
}
origin: it.unibz.inf.ontop/ontop-optimization

private static ImmutableSubstitution<VariableOrGroundTerm> extractSubstitution(DistinctVariableOnlyDataAtom sourceAtom,
                                        DataAtom targetAtom) {
  if (!sourceAtom.getPredicate().equals(targetAtom.getPredicate())) {
    throw new IllegalStateException("Incompatible predicates");
  }
  else if (sourceAtom.getEffectiveArity() != targetAtom.getEffectiveArity()) {
    throw new IllegalStateException("Different arities");
  }
  ImmutableMap<Variable, VariableOrGroundTerm> newMap = FunctionalTools.zip(
      sourceAtom.getArguments(),
      (ImmutableList<VariableOrGroundTerm>) targetAtom.getArguments()).stream()
      .collect(ImmutableCollectors.toMap());
  return SUBSTITUTION_FACTORY.getSubstitution(newMap);
}
origin: ontop/ontop

  private ImmutableSubstitution<VariableOrGroundTerm> extractSubstitution(DistinctVariableOnlyDataAtom sourceAtom,
                                      DataAtom targetAtom) {
    if (!sourceAtom.getPredicate().equals(targetAtom.getPredicate())) {
      throw new IllegalStateException("Incompatible predicates");
    }
    else if (sourceAtom.getEffectiveArity() != targetAtom.getEffectiveArity()) {
      throw new IllegalStateException("Different arities");
    }
    ImmutableMap<Variable, VariableOrGroundTerm> newMap = FunctionalTools.zip(
        sourceAtom.getArguments(),
        (ImmutableList<VariableOrGroundTerm>) targetAtom.getArguments()).stream()
        .collect(ImmutableCollectors.toMap());
    return substitutionFactory.getSubstitution(newMap);
  }
}
origin: ontop/ontop

@Override
public DataAtom applyToDataAtom(DataAtom atom) throws ConversionException {
  ImmutableList<? extends ImmutableTerm> newArguments = apply(atom.getArguments());
  for (ImmutableTerm subTerm : newArguments) {
    if (!(subTerm instanceof VariableOrGroundTerm))
      throw new ConversionException("The sub-term: " + subTerm + " is not a VariableOrGroundTerm");
  }
  return atomFactory.getDataAtom(atom.getPredicate(),
      (ImmutableList<? extends VariableOrGroundTerm>) newArguments);
}
it.unibz.inf.ontop.model.atomDataAtomgetPredicate

Popular methods of DataAtom

  • getArguments
  • getEffectiveArity
    Effective arity (number of sub-terms).
  • containsGroundTerms
  • getArity
  • getTerm
  • getVariables
  • hasSamePredicateAndArity

Popular in Java

  • Parsing JSON documents to java classes using gson
  • getContentResolver (Context)
  • getApplicationContext (Context)
  • runOnUiThread (Activity)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • DecimalFormat (java.text)
    A concrete subclass of NumberFormat that formats decimal numbers. It has a variety of features desig
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now