org.w3c.rdf.util
Class RDFUtil

java.lang.Object
  |
  +--org.w3c.rdf.util.RDFUtil

public class RDFUtil
extends java.lang.Object

Useful utility methods.


Constructor Summary
RDFUtil()
           
 
Method Summary
static void dumpModel(Model m, java.io.PrintStream ps, RDFSerializer s)
          Dumps the model in a serialized form.
static java.lang.String dumpModel(Model m, RDFSerializer s)
          Dumps the model in a serialized form in a string
static Statement get1(Model m)
          Returns the first triple of the model
static int getOrd(Resource r)
          Converts an ordinal property to an integer.
static Model getReachable(Resource r, Model m)
          returns a subgraph of "m" containing "r" and all nodes reachable from "r" via directed edges.
static java.util.Vector getStatementVector(Model m)
          Collects the triples of a model in a vector.
static java.lang.String guessName(java.lang.String uri)
          Delivers the name out of the URI (without the namespace prefix).
static java.lang.String guessNamespace(java.lang.String uri)
          Extracts the namespace prefix out of a URI.
static boolean isQualified(java.lang.String s)
          Tests if the URI is qualified, i.e.
static boolean isRDF(Resource r)
          Tests if the resource belongs to the RDF syntax/model namespace.
static boolean isRDF(java.lang.String uri)
          Tests if the URI belongs to the RDF syntax/model namespace.
static Resource noname()
          Creates a new unique unnamed resource.
static java.lang.String normalizeURI(java.lang.String uri)
           
static Resource ord(int i)
          Creates an ordinal property (rdf:li, rdf:_N)
static void parse(java.lang.String fileNameOrURL, RDFParser parser, Model model)
           
static void printStatements(Model m, java.io.PrintStream ps)
          Prints the triples of a model to the given PrintStream.
static Model removeNamespace(java.lang.String ns, Model m)
          Removes all triples which have something to do with the given namespace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RDFUtil

public RDFUtil()
Method Detail

noname

public static Resource noname()
Creates a new unique unnamed resource.

ord

public static Resource ord(int i)
Creates an ordinal property (rdf:li, rdf:_N)

getOrd

public static int getOrd(Resource r)
Converts an ordinal property to an integer.

isQualified

public static boolean isQualified(java.lang.String s)
Tests if the URI is qualified, i.e. has a namespace prefix.

guessNamespace

public static java.lang.String guessNamespace(java.lang.String uri)
Extracts the namespace prefix out of a URI.

guessName

public static java.lang.String guessName(java.lang.String uri)
Delivers the name out of the URI (without the namespace prefix).

isRDF

public static boolean isRDF(java.lang.String uri)
Tests if the URI belongs to the RDF syntax/model namespace.

isRDF

public static boolean isRDF(Resource r)
Tests if the resource belongs to the RDF syntax/model namespace.

get1

public static Statement get1(Model m)
Returns the first triple of the model

printStatements

public static void printStatements(Model m,
                                   java.io.PrintStream ps)
Prints the triples of a model to the given PrintStream.

dumpModel

public static void dumpModel(Model m,
                             java.io.PrintStream ps,
                             RDFSerializer s)
                      throws java.lang.Exception
Dumps the model in a serialized form.

dumpModel

public static java.lang.String dumpModel(Model m,
                                         RDFSerializer s)
                                  throws java.lang.Exception
Dumps the model in a serialized form in a string

getStatementVector

public static java.util.Vector getStatementVector(Model m)
Collects the triples of a model in a vector.

removeNamespace

public static Model removeNamespace(java.lang.String ns,
                                    Model m)
Removes all triples which have something to do with the given namespace

getReachable

public static Model getReachable(Resource r,
                                 Model m)
returns a subgraph of "m" containing "r" and all nodes reachable from "r" via directed edges. These edges are also included in the resulting model.

parse

public static void parse(java.lang.String fileNameOrURL,
                         RDFParser parser,
                         Model model)
                  throws java.io.IOException,
                         SAXException,
                         java.net.MalformedURLException

normalizeURI

public static java.lang.String normalizeURI(java.lang.String uri)