RDF2Go/FAQ

From semanticweb.org

Jump to: navigation, search

Contents

[edit] What about....?

Look at Semweb4j#Lessons first, there is a small tutorial.

[edit] Porting from other store implementations

[edit] Jena: Resource.getNamespace()/getLocalname()/getProperty()/getURI() replacements?

  • getNamespace(): (TODO) - there is currently no namespace support at all in RDF2Go
  • getLocalname(): (TODO) - there is currently no namespace support at all in RDF2Go
  • getProperty(): Model.findStatement(resource, property, Variable.ANY)
  • getURI(): resource.toString()

[edit] General questions

[edit] How can one connect to an existing repository in Sesame 2.x using RDF2GO without using Sesame API?

Not at all. Neither via HTTP nor via the Java API. If this is an important requirement for you, consider filing a feature request at our tracker

[edit] What are the differences between the Model and the Graph from Sesame 1.x?

I cannot tell in detail. Model (JavaDoc) has been created as the intersection of the Jena Model and the Sesame Graph, more or less.

[edit] What are your plans for the future work? Quite a lot of links on the wiki page don't work. Some parts of the documentation are outdated. How long will RDF2GO be supported?

RDF2Go is used in several projects already, so there is quite some pressure for now to keep it going. Like most open-source tools, exact plans for the future are not known. Luckily, the full code base of RDF2Go is pretty small. So in the worst case, someone else can take it over quite easily. By the way: More developers are always welcome ;-)

[edit] Why do I need to use Variable.ANY in Model.findStatement() calls?

Other implementations simply allow null there but that is not type-safe. If you have code like

findStatement( a.getURI(), b.getURI(), c.getURI() )

and for some reason one of the getURI() calls fails and returns null, you perform a different query without knowing it.

[edit] How can I get an iterator over all statements in a model?

model.iterator();

[edit] a function that queries and removes triples from all contexts...

i.e. remove all (null, rdf:type, null) from ALL contexts...

ModelSet set = ModelFactory.getModelSet(null);
Iterator<? extends Model> it = set.getModels();
while (it.hasNext()) {
  Model model = it.next();
  model.removeAll(model.findStatements(Variable.ANY, RDF.type, Variable.ANY).iterator());
}

[edit] Can we also have an XMLSchema vocab file?

It's called "XSD" for "XML Schema Datatypes"

m.addStatement(person, age, m.createDatatypeLiteral("8", XSD._integer));

[edit] Does Diff not have an empty constructor?

Yes


[edit] How can I configure the underlying model in advanced ways, e.g. using a native OpenRDF/Sesame store and not an im-memory model?

You can configure your store by hand, something like

// I have no clue how this has to be done
SesameRepository rep = new SesameRepository( many options here );
// Then 'wrap' the sesame thing in an RDF2Go Model:
// Model model = new org.ontoware.rdf2go.impl.openrdf.RepositoryModel(rep);
Model model = new org.openrdf.rdf2go.RepositoryModel(rep); //in version 4.6.2 of RDF2Go-impl-sesame20

and not use the ModelFactory at all.

[edit] Difference between RDF2Go and SAIL?

What's the difference between RDF2Go API and the Sesame2 SAIL API -- what's the benefit of RDF2Go? Both are abstractions of RDF models.

There are two answers:

  • RDF2Go can handle Sesame stores and Jena stores. It's also easy to add more stores -- e.g. we already had adapters for YARS, NG4J.
  • RDF2Go is vendor-neutral. It even allows you to swap triple store implementations after compile time - if you program wisely.

[edit] How can I copy a model from one implementation (e.g. Sesame) to another one (e.g. Jena) ?

Instead of calling

       ClosableIterator<Statement> it = aModel.iterator();
       while ( it.hasNext() ) {
           bModel.addStatement(it.next());
       }

which will throw an exception if the model contains blank nodes, you should call

       Model aModel = ... e.g. a Jena model
       Model bModel = ... e.g. a Sesme model 
       ModelUtils.copy(aModel, bModel);
Personal tools