Class GraphUtils

java.lang.Object
org.apache.jena.sparql.util.graph.GraphUtils

public class GraphUtils extends Object
Graph utilities. See also GraphFactory.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static Iterator<org.apache.jena.graph.Node>
    allNodes(org.apache.jena.graph.Graph graph)
    All subjects and objects, no duplicates.
    static boolean
    atmostOneProperty(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
     
    static boolean
    exactlyOneProperty(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
     
    static org.apache.jena.rdf.model.Resource
    findRootByType(org.apache.jena.rdf.model.Model model, org.apache.jena.rdf.model.Resource atype)
     
    static List<org.apache.jena.rdf.model.Resource>
    findRootsByType(org.apache.jena.rdf.model.Model model, org.apache.jena.rdf.model.Resource atype)
     
    static String
    fmtURI(org.apache.jena.rdf.model.Resource r)
     
    static String
    getAsFilename(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
    Get a string for a filename, either a string (filename as-=is) or a "file:" URI, translated to a filename.
    static org.apache.jena.rdf.model.RDFNode
    getAsRDFNode(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
     
    static String
    getAsStringValue(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
    Get a string literal or a URI as a string.
    static boolean
    getBooleanValue(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
     
    static org.apache.jena.rdf.model.Resource
    getResourceByType(org.apache.jena.rdf.model.Model model, org.apache.jena.rdf.model.Resource type)
     
    static org.apache.jena.rdf.model.Resource
    getResourceValue(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
     
    static String
    getStringValue(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
    Get a string literal.
    static String
    getStringValue(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p, org.apache.jena.datatypes.RDFDatatype datatype)
    Get the string (lexical form) of a literal with a check that the datatype is as expected.
    static List<org.apache.jena.rdf.model.Resource>
    listResourcesByType(org.apache.jena.rdf.model.Model model, org.apache.jena.rdf.model.Resource type)
     
    static List<org.apache.jena.rdf.model.RDFNode>
    multiValue(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
     
    static List<String>
    multiValueAsFilename(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
    Get a list of the string and URIs treating each as a filenames, that is strings and file: URIs converted to filenames.
    static List<String>
    multiValueAsString(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
    Get a list of the URIs (as strings) and strings
    static List<org.apache.jena.rdf.model.Resource>
    multiValueResource(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
     
    static List<String>
    multiValueString(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
    Get all the literals for a resource-property.
    static List<String>
    multiValueURI(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
     

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GraphUtils

      public GraphUtils()
  • Method Details

    • multiValueString

      public static List<String> multiValueString(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
      Get all the literals for a resource-property.
    • multiValueAsString

      public static List<String> multiValueAsString(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
      Get a list of the URIs (as strings) and strings
      See Also:
    • multiValueAsFilename

      public static List<String> multiValueAsFilename(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
      Get a list of the string and URIs treating each as a filenames, that is strings and file: URIs converted to filenames.
      See Also:
    • multiValue

      public static List<org.apache.jena.rdf.model.RDFNode> multiValue(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
    • multiValueResource

      public static List<org.apache.jena.rdf.model.Resource> multiValueResource(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
    • multiValueURI

      public static List<String> multiValueURI(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
    • exactlyOneProperty

      public static boolean exactlyOneProperty(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
    • atmostOneProperty

      public static boolean atmostOneProperty(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
    • getBooleanValue

      public static boolean getBooleanValue(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
    • getStringValue

      public static String getStringValue(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
      Get a string literal.
    • getStringValue

      public static String getStringValue(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p, org.apache.jena.datatypes.RDFDatatype datatype)
      Get the string (lexical form) of a literal with a check that the datatype is as expected.
    • getAsStringValue

      public static String getAsStringValue(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
      Get a string literal or a URI as a string.
    • getAsFilename

      public static String getAsFilename(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
      Get a string for a filename, either a string (filename as-=is) or a "file:" URI, translated to a filename. Otherwise throw an exception.
    • getAsRDFNode

      public static org.apache.jena.rdf.model.RDFNode getAsRDFNode(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
    • getResourceValue

      public static org.apache.jena.rdf.model.Resource getResourceValue(org.apache.jena.rdf.model.Resource r, org.apache.jena.rdf.model.Property p)
    • listResourcesByType

      public static List<org.apache.jena.rdf.model.Resource> listResourcesByType(org.apache.jena.rdf.model.Model model, org.apache.jena.rdf.model.Resource type)
    • getResourceByType

      public static org.apache.jena.rdf.model.Resource getResourceByType(org.apache.jena.rdf.model.Model model, org.apache.jena.rdf.model.Resource type)
    • findRootByType

      public static org.apache.jena.rdf.model.Resource findRootByType(org.apache.jena.rdf.model.Model model, org.apache.jena.rdf.model.Resource atype)
    • findRootsByType

      public static List<org.apache.jena.rdf.model.Resource> findRootsByType(org.apache.jena.rdf.model.Model model, org.apache.jena.rdf.model.Resource atype)
    • fmtURI

      public static String fmtURI(org.apache.jena.rdf.model.Resource r)
    • allNodes

      public static Iterator<org.apache.jena.graph.Node> allNodes(org.apache.jena.graph.Graph graph)
      All subjects and objects, no duplicates.