Class RiotLib


  • public class RiotLib
    extends java.lang.Object
    Misc RIOT code
    • Field Detail

      • fixupPrefixes

        public static final java.util.function.Function<java.lang.String,​java.lang.String> fixupPrefixes
        Function applied to undefined prefixes to convert to a URI string
      • testFixupedPrefixURI

        public static final java.util.function.Predicate<java.lang.String> testFixupedPrefixURI
        Function to test for undefined prefix URIs
    • Constructor Detail

      • RiotLib

        public RiotLib()
    • Method Detail

      • blankNodeToIri

        public static Node blankNodeToIri​(Node node)
        "Skolemize" to a node. Returns a Node_URI.
      • blankNodeToIriString

        public static java.lang.String blankNodeToIriString​(Node node)
        "Skolemize" to a string.
      • createIRIorBNode

        public static Node createIRIorBNode​(java.lang.String str)
        Implement <_:....> as a "Node IRI" that is, use the given label as the BNode internal label. Use with care. Returns a Node_URI.
      • isBNodeIRI

        public static boolean isBNodeIRI​(java.lang.String iri)
        Test whether a IRI is a ARQ-encoded blank node.
      • isPrefixIRI

        public static boolean isPrefixIRI​(java.lang.String iri)
        Test whether a IRI is a ARQ-encoded blank node.
      • fixupPrefixIRI

        public static java.lang.String fixupPrefixIRI​(java.lang.String prefix,
                                                      java.lang.String localPart)
        Convert an prefix name (qname) to an IRI, for when the prefix is not defined.
        See Also:
        ARQ.fixupUndefinedPrefixes
      • fixupPrefixIRI

        public static java.lang.String fixupPrefixIRI​(java.lang.String prefixedName)
        Convert an prefix name (qname) to an IRI, for when the prefix is not defined.
        See Also:
        ARQ.fixupUndefinedPrefixes
      • parse

        public static Node parse​(java.lang.String string)
        Parse a string to get one Node (the first token in the string)
      • factoryRDF

        public static FactoryRDF factoryRDF​(LabelToNode labelMapping)
        Create a new (not influenced by anything else) FactoryRDF using the label to blank node scheme provided.
      • factoryRDF

        public static FactoryRDF factoryRDF()
        Create a new (not influenced by anything else) FactoryRDF using the default label to blank node scheme.
      • triplesOfSubject

        public static java.util.Collection<Triple> triplesOfSubject​(Graph graph,
                                                                    Node subj)
        Get triples with the same subject
      • triples

        public static java.util.List<Triple> triples​(Graph graph,
                                                     Node s,
                                                     Node p,
                                                     Node o)
        Get all the triples for the graph.find
      • countTriples

        public static long countTriples​(Graph graph,
                                        Node s,
                                        Node p,
                                        Node o)
      • accTriples

        public static void accTriples​(java.util.Collection<Triple> acc,
                                      Graph graph,
                                      Node s,
                                      Node p,
                                      Node o)
        Collect all the matching triples
      • writeBase

        public static void writeBase​(org.apache.jena.atlas.io.IndentedWriter out,
                                     java.lang.String base,
                                     boolean newStyle)
      • writePrefixes

        public static void writePrefixes​(org.apache.jena.atlas.io.IndentedWriter out,
                                         PrefixMap prefixMap,
                                         boolean newStyle)
        Write prefixes
      • writePrefix

        public static void writePrefix​(org.apache.jena.atlas.io.IndentedWriter out,
                                       java.lang.String prefix,
                                       java.lang.String uri,
                                       boolean newStyle)
        Write a prefix. Write using @prefix or PREFIX.
      • writePrefixOldStyle

        public static void writePrefixOldStyle​(org.apache.jena.atlas.io.IndentedWriter out,
                                               java.lang.String prefix,
                                               java.lang.String uri,
                                               int intent)
        Write prefixes, using @prefix
      • create

        public static org.apache.jena.atlas.io.IndentedWriter create​(java.io.Writer writer)
        IndentedWriter over a java.io.Writer (better to use an IndentedWriter over an OutputStream)