Class ModelUtils

java.lang.Object
org.apache.jena.sparql.util.ModelUtils

public class ModelUtils extends Object
  • Constructor Details

    • ModelUtils

      public ModelUtils()
  • Method Details

    • convertGraphNodeToRDFNode

      public static RDFNode convertGraphNodeToRDFNode(Node node, Model model)
      Convert a Node (graph SPI) to an RDFNode (model API), anchored to the model if possible.
      Parameters:
      node -
      model - (may be null)
      Returns:
      RDFNode
    • convertGraphNodeToRDFNode

      public static RDFNode convertGraphNodeToRDFNode(Node node)
      Convert a Node (graph SPI) to an RDFNode (model API)
      Parameters:
      node -
      Returns:
      RDFNode
    • tripleToStatement

      public static Statement tripleToStatement(Model model, Triple t)
    • isValidAsStatement

      public static boolean isValidAsStatement(Node s, Node p, Node o)
      Determines whether a valid Statement can be formed from the given Subject, Predicate and Object

      This function reflects the fact that the Triple API is flexible in allowing any Node type in any position (including non-RDF node types like Variable) and as such not all Triples can be safely converted into Statements

      Parameters:
      s - Subject
      p - Predicate
      o - Object
      Returns:
      True if a valid Statement can be formed
    • triplesToStatements

      public static StmtIterator triplesToStatements(Iterator<Triple> it, Model refModel)
    • intersectCollector

      public static ModelCollector intersectCollector()
    • unionCollector

      public static ModelCollector unionCollector()
    • statementsToTriples

      public static Iterator<Triple> statementsToTriples(Iterator<Statement> it)