TRIG and TBC - any options?

17 views
Skip to first unread message

Adam Kimball

unread,
Apr 6, 2020, 12:16:11 PM4/6/20
to TopBraid Suite Users
Hi all,

Hope this email finds you safe and well during these crazy times.

I have a need to work with some TRIG files.  Since I've become so used to doing my development work in TBC, I'd very much like to find a way to work with them.  Searching this list and the web, I don't get the feeling that there are many options but I thought it would be worth asking.  

One idea I had is to try and import a TRIG file into a Jena TDB (using Import->Import RDF Files into new TDB) but this results in an exception from deep within Jena (see below).   This happens with any of the examples from the TRIG spec.  Running on 6.3.0.

I'm curious what other approaches I might want to investigate.  My ultimate goal is running SPARQL queries across the named graphs defined in the TRIG files.

---
Reason:
java.lang.NullPointerException
at org.apache.jena.ext.com.google.common.base.Preconditions.checkNotNull(Preconditions.java:882)
at org.apache.jena.ext.com.google.common.cache.LocalCache.getIfPresent(LocalCache.java:3948)
at org.apache.jena.ext.com.google.common.cache.LocalCache$LocalManualCache.getIfPresent(LocalCache.java:4859)
at org.apache.jena.atlas.lib.cache.CacheGuava.containsKey(CacheGuava.java:81)
at org.apache.jena.atlas.lib.cache.CacheSetImpl.contains(CacheSetImpl.java:72)
at org.apache.jena.tdb.store.nodetable.NodeTableCache.cacheLookup(NodeTableCache.java:176)
at org.apache.jena.tdb.store.nodetable.NodeTableCache._idForNode(NodeTableCache.java:141)
at org.apache.jena.tdb.store.nodetable.NodeTableCache.getAllocateNodeId(NodeTableCache.java:91)
at org.apache.jena.tdb.store.nodetable.NodeTableWrapper.getAllocateNodeId(NodeTableWrapper.java:40)
at org.apache.jena.tdb.store.nodetable.NodeTableInline.getAllocateNodeId(NodeTableInline.java:51)
at org.apache.jena.tdb.store.nodetupletable.NodeTupleTableConcrete.addRow(NodeTupleTableConcrete.java:85)
at org.apache.jena.tdb.store.bulkloader.LoaderNodeTupleTable.load(LoaderNodeTupleTable.java:106)
at org.topbraidcomposer.tdb.wizards.loader.Loader$StreamRDF_TDBLoad.quad(Loader.java:172)
at org.apache.jena.riot.lang.LangTriG.emit(LangTriG.java:266)
at org.apache.jena.riot.lang.LangTurtleBase.emitTriple(LangTurtleBase.java:486)
at org.apache.jena.riot.lang.LangTurtleBase.objectList(LangTurtleBase.java:352)
at org.apache.jena.riot.lang.LangTurtleBase.predicateObjectItem(LangTurtleBase.java:288)
at org.apache.jena.riot.lang.LangTurtleBase.predicateObjectList(LangTurtleBase.java:269)
at org.apache.jena.riot.lang.LangTurtleBase.triples(LangTurtleBase.java:250)
at org.apache.jena.riot.lang.LangTurtleBase.triplesSameSubject(LangTurtleBase.java:191)
at org.apache.jena.riot.lang.LangTriG.bracedGraph(LangTriG.java:213)
at org.apache.jena.riot.lang.LangTriG.oneNamedGraphBlock2(LangTriG.java:137)
at org.apache.jena.riot.lang.LangTriG.oneTopLevelElement(LangTriG.java:49)
at org.apache.jena.riot.lang.LangTurtleBase.runParser(LangTurtleBase.java:91)
at org.apache.jena.riot.lang.LangBase.parse(LangBase.java:41)
at org.apache.jena.riot.RDFParserRegistry$ReaderRIOTLang.read(RDFParserRegistry.java:191)
at org.apache.jena.riot.RDFParser.read(RDFParser.java:352)
at org.apache.jena.riot.RDFParser.parseNotUri(RDFParser.java:342)
at org.apache.jena.riot.RDFParser.parse(RDFParser.java:291)
at org.apache.jena.riot.RDFParserBuilder.parse(RDFParserBuilder.java:506)
at org.apache.jena.riot.RDFDataMgr.parseFromInputStream(RDFDataMgr.java:870)
at org.apache.jena.riot.RDFDataMgr.parse(RDFDataMgr.java:693)
at org.topbraidcomposer.tdb.wizards.loader.Loader.loadFromFiles(Loader.java:107)
at org.topbraidcomposer.tdb.wizards.loader.TDBLoaderWizard$1.run(TDBLoaderWizard.java:76)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:119)



Take care,
Adam

Holger Knublauch

unread,
Apr 6, 2020, 10:01:25 PM4/6/20
to topbrai...@googlegroups.com

Hi Adam,

I am not aware of decent support for Trig within TBC. The issue is that each named graph that can be referenced by TB requires a file in the workspace. So even if we were to load the quads into a TDB, we'd still need to add code that produces TDB connector files (.xdb). Or, split it into multiple TTL files. In the latter case, I guess a 3rd party tool could be used too.

For the time being, I have filed an internal development ticket (reference: TBS-2841) to improve on that in the future.

Do you have any work-around in the meantime?

Holger

--
You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to topbraid-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/2bd9ccac-0c8d-46d6-af30-58efd11e0a9a%40googlegroups.com.

dprice

unread,
Apr 7, 2020, 7:03:49 AM4/7/20
to topbrai...@googlegroups.com
I think you can use Jena command line tools riot and sparql to read TRIG and CONSTRUCT RDF that you can then read into Composer. 

If I recall correctly, what we did was reify the triples so that we could attach the TRIG graph metadata to the RDF and not lose any semantics, but everything from the TRIG file ends up in one RDF file.

Cheers,
David

Holger Knublauch

unread,
Apr 7, 2020, 9:19:27 PM4/7/20
to topbrai...@googlegroups.com
On 7/04/2020 12:01, Holger Knublauch wrote:

Hi Adam,

I am not aware of decent support for Trig within TBC. The issue is that each named graph that can be referenced by TB requires a file in the workspace. So even if we were to load the quads into a TDB, we'd still need to add code that produces TDB connector files (.xdb). Or, split it into multiple TTL files. In the latter case, I guess a 3rd party tool could be used too.

For the time being, I have filed an internal development ticket (reference: TBS-2841) to improve on that in the future.

BTW this is now implemented and will be part of TBC 6.4. It will take a TriG file and produce Turtle files for each sub-graph. From TBC you could then use project upload to get the data into EDG. This is for TBC only at this stage as it's common that some post-processing may be needed, e.g. to clean up the default graph.

Holger

Bohms, H.M. (Michel)

unread,
Apr 8, 2020, 3:50:34 AM4/8/20
to topbrai...@googlegroups.com

 

Great!

 

(I recently got from partners a large TriG file and asked them to split in turtles...)

 

Similar plans for TriX? (did not get questions for that but guess issue is similar...)

 

 

 

 

Dr. ir. H.M. (Michel) Böhms
Senior Data Scientist

+31888663107
+31630381220
michel...@tno.nl

Location

 

This message may contain information that is not intended for you. If you are not the addressee or if this message was sent to you by mistake, you are requested to inform the sender and delete the message. TNO accepts no liability for the content of this e-mail, for the manner in which you use it and for damage of any kind resulting from the risks inherent to the electronic transmission of messages.

 

 

 

ak

unread,
Apr 8, 2020, 8:56:37 AM4/8/20
to topbrai...@googlegroups.com
Wow, ask and you shall receive, indeed!  Thanks a ton!  

Adam

On Apr 8, 2020, at 1:50 AM, 'Bohms, H.M. (Michel)' via TopBraid Suite Users <topbrai...@googlegroups.com> wrote:

 
Great!
 
(I recently got from partners a large TriG file and asked them to split in turtles...)
 
Similar plans for TriX? (did not get questions for that but guess issue is similar...)
 
Dr. ir. H.M. (Michel) Böhms
Senior Data Scientist


-- 
You received this message because you are subscribed to a topic in the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/topbraid-users/wRcyks6Hp00/unsubscribe.
To unsubscribe from this group and all its topics, send an email to topbraid-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/topbraid-users/854c4505330b4e9fbe6c702cbda8c413%40tno.nl.

Holger Knublauch

unread,
Apr 8, 2020, 7:51:30 PM4/8/20
to topbrai...@googlegroups.com

Right, I forgot TriG is not the only Quads format so I have generalized the importer to include TriX and N-Quads too.

Holger

Bohms, H.M. (Michel)

unread,
May 7, 2020, 6:34:55 AM5/7/20
to topbrai...@googlegroups.com

 

 

Coming back to this one..

 

Isnt there any offcial w3c spec for trix like for trig?

dprice

unread,
May 7, 2020, 7:50:06 AM5/7/20
to topbrai...@googlegroups.com
On 7 May 2020, at 11:34, 'Bohms, H.M. (Michel)' via TopBraid Suite Users <topbrai...@googlegroups.com> wrote:

 
Coming back to this one..
 
Isnt there any offcial w3c spec for trix like for trig?

No, it was not worked through the W3C WGs - “by HP Labs and Nokia” and “Copyright Hewlett-Packard Company 2004” are the provenance.

Cheers,
David

 
 
 
Dr. ir. H.M. (Michel) Böhms
Senior Data Scientist

This message may contain information that is not intended for you. If you are not the addressee or if this message was sent to you by mistake, you are requested to inform the sender and delete the message. TNO accepts no liability for the content of this e-mail, for the manner in which you use it and for damage of any kind resulting from the risks inherent to the electronic transmission of messages.
 
Van: topbrai...@googlegroups.com <topbrai...@googlegroups.com> Namens Holger Knublauch
Verzonden: Thursday, April 9, 2020 1:51 AM
Aan: topbrai...@googlegroups.com
Onderwerp: Re: [topbraid-users] TRIG and TBC - any options?
 

Right, I forgot TriG is not the only Quads format so I have generalized the importer to include TriX and N-Quads too.

Holger

 

On 8/04/2020 17:50, 'Bohms, H.M. (Michel)' via TopBraid Suite Users wrote:
 
Great!
 
(I recently got from partners a large TriG file and asked them to split in turtles...)
 
Similar plans for TriX? (did not get questions for that but guess issue is similar...)
 
Dr. ir. H.M. (Michel) Böhms
Senior Data Scientist


Bohms, H.M. (Michel)

unread,
May 7, 2020, 8:05:57 AM5/7/20
to topbrai...@googlegroups.com

 

Indeed, quite some dead links there from w3c...

 

Will focus more on TriG in our specs .... (when multigraph serial. is needed)

 

 

 

 

 

 

Dr. ir. H.M. (Michel) Böhms
Senior Data Scientist

+31888663107
+31630381220
michel...@tno.nl

Location

 

dprice

unread,
May 7, 2020, 8:17:13 AM5/7/20
to topbrai...@googlegroups.com

On 7 May 2020, at 13:05, 'Bohms, H.M. (Michel)' via TopBraid Suite Users <topbrai...@googlegroups.com> wrote:

 
Indeed, quite some dead links there from w3c...
 
Will focus more on TriG in our specs .... (when multigraph serial. is needed)

Makes sense and FWIW we have other customers with recent interest in TriG. 

For example, one customer project provided large-ish test data via TriG giving me the chance to test the coming EDG 6.4 TriG importer- it worked well in that test/debug scenario.

Cheers,
David

Reply all
Reply to author
Forward
0 new messages