org.aksw.commons.jena
Class ModelUtils

java.lang.Object
  extended by org.aksw.commons.jena.ModelUtils

public class ModelUtils
extends Object

Author:
Claus Stadler

Constructor Summary
ModelUtils()
           
 
Method Summary
static com.hp.hpl.jena.rdf.model.Model combine(Collection<com.hp.hpl.jena.rdf.model.Model> models)
           
static String[] decompose(String uri, NavigableMap<String,String> prefixMap)
          An efficient method for separating a URI into namespace and prefix, given a set of arbitrary namespace prefixes.
static Map<com.hp.hpl.jena.rdf.model.Resource,Set<com.hp.hpl.jena.rdf.model.Resource>> extractDirectSuperClassMap(com.hp.hpl.jena.rdf.model.Model model)
          Extracts a mapping childClass -> parentClass from a given Model.
static com.hp.hpl.jena.rdf.model.Model filterBySubject(com.hp.hpl.jena.rdf.model.Model model, com.hp.hpl.jena.rdf.model.Resource resource)
           
static String prettyUri(String uri, NavigableMap<String,String> prefixMap)
           
static com.hp.hpl.jena.rdf.model.Model read(File file)
          FIXME Extend to Uris
static com.hp.hpl.jena.rdf.model.Model read(File file, String lang)
           
static com.hp.hpl.jena.rdf.model.Model read(InputStream in, String lang)
           
static com.hp.hpl.jena.rdf.model.Model read(com.hp.hpl.jena.rdf.model.Model model, File file, String lang)
           
static com.hp.hpl.jena.rdf.model.Model read(com.hp.hpl.jena.rdf.model.Model model, InputStream in, String lang)
           
static String toString(com.hp.hpl.jena.rdf.model.Model model)
           
static String toString(com.hp.hpl.jena.rdf.model.Model model, com.hp.hpl.jena.rdf.model.RDFWriter writer)
           
static String toString(com.hp.hpl.jena.rdf.model.Model model, String format)
           
static com.hp.hpl.jena.rdf.model.Model write(com.hp.hpl.jena.rdf.model.Model model, File file)
           
static com.hp.hpl.jena.rdf.model.Model write(com.hp.hpl.jena.rdf.model.Model model, File file, String lang)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModelUtils

public ModelUtils()
Method Detail

extractDirectSuperClassMap

public static Map<com.hp.hpl.jena.rdf.model.Resource,Set<com.hp.hpl.jena.rdf.model.Resource>> extractDirectSuperClassMap(com.hp.hpl.jena.rdf.model.Model model)
Extracts a mapping childClass -> parentClass from a given Model. You can use TransitiveClosure.transitiveClosure for "inferring" the whole hierarchy.

Parameters:
model -
Returns:

filterBySubject

public static com.hp.hpl.jena.rdf.model.Model filterBySubject(com.hp.hpl.jena.rdf.model.Model model,
                                                              com.hp.hpl.jena.rdf.model.Resource resource)
Parameters:
model -
resource -
Returns:

combine

public static com.hp.hpl.jena.rdf.model.Model combine(Collection<com.hp.hpl.jena.rdf.model.Model> models)

read

public static com.hp.hpl.jena.rdf.model.Model read(InputStream in,
                                                   String lang)
                                            throws IOException
Throws:
IOException

read

public static com.hp.hpl.jena.rdf.model.Model read(File file)
                                            throws Exception
FIXME Extend to Uris

Parameters:
file -
Returns:
Throws:
Exception

read

public static com.hp.hpl.jena.rdf.model.Model read(File file,
                                                   String lang)
                                            throws IOException
Throws:
IOException

read

public static com.hp.hpl.jena.rdf.model.Model read(com.hp.hpl.jena.rdf.model.Model model,
                                                   InputStream in,
                                                   String lang)
                                            throws IOException
Throws:
IOException

read

public static com.hp.hpl.jena.rdf.model.Model read(com.hp.hpl.jena.rdf.model.Model model,
                                                   File file,
                                                   String lang)
                                            throws IOException
Throws:
IOException

write

public static com.hp.hpl.jena.rdf.model.Model write(com.hp.hpl.jena.rdf.model.Model model,
                                                    File file)
                                             throws IOException
Throws:
IOException

write

public static com.hp.hpl.jena.rdf.model.Model write(com.hp.hpl.jena.rdf.model.Model model,
                                                    File file,
                                                    String lang)
                                             throws IOException
Throws:
IOException

toString

public static String toString(com.hp.hpl.jena.rdf.model.Model model)

toString

public static String toString(com.hp.hpl.jena.rdf.model.Model model,
                              com.hp.hpl.jena.rdf.model.RDFWriter writer)

toString

public static String toString(com.hp.hpl.jena.rdf.model.Model model,
                              String format)

decompose

public static String[] decompose(String uri,
                                 NavigableMap<String,String> prefixMap)
An efficient method for separating a URI into namespace and prefix, given a set of arbitrary namespace prefixes. Note: This method is mainly intended for a nice representation, as a decomposition with arbitrary prefixes may not work with cerain RDF serializations. (e.g. with prefix p: becomes p:is/a/test)

Parameters:
uri -
prefixMap -
Returns:

prettyUri

public static String prettyUri(String uri,
                               NavigableMap<String,String> prefixMap)


Copyright © 2012. All Rights Reserved.