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(RDFModel m, java.io.PrintStream ps, RDFSerializer s)
          Dumps the model in a serialized form.
static java.lang.String dumpModel(RDFModel m, RDFSerializer s)
          Dumps the model in a serialized form in a string
static Triple get1(RDFModel m)
          Returns the first triple of the model
static int getOrd(Resource r)
          Converts an ordinal property to an integer.
static RDFModel getReachable(Resource r, RDFModel m)
          returns a subgraph of "m" containing "r" and all nodes reachable from "r" via directed edges.
static java.util.Vector getTripleVector(RDFModel 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, RDFModel model)
           
static void printTriples(RDFModel m, java.io.PrintStream ps)
          Prints the triples of a model to the given PrintStream.
static RDFModel removeNamespace(java.lang.String ns, RDFModel 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 Triple get1(RDFModel m)
Returns the first triple of the model

printTriples

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

dumpModel

public static void dumpModel(RDFModel 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(RDFModel m,
                                         RDFSerializer s)
                                  throws java.lang.Exception
Dumps the model in a serialized form in a string

getTripleVector

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

removeNamespace

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

getReachable

public static RDFModel getReachable(Resource r,
                                    RDFModel 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,
                         RDFModel model)
                  throws java.io.IOException,
                         SAXException,
                         java.net.MalformedURLException

normalizeURI

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