0

I'm pushing the following data (blank nodes) to Virtuoso:

@prefix ns0:   <http://linked.opendata.cz/ontology/chord/> .
@prefix ns1:   <http://linked.opendata.cz/resource/business-entity/> .

[ ns0:source  ns1:CZ00006947 ;
  ns0:target  <http://linked.opendata.cz/resource/domain/seznam.gov.cz/rejstriky/business-entity/28175492>
] .

[ ns0:source  ns1:CZ00241610 ;
  ns0:target  <http://linked.opendata.cz/resource/domain/seznam.gov.cz/rejstriky/business-entity/60437359>
] .

This is the exact data that's being pushed to Virtuoso via POST request (only truncated; the actual submitted data is longer).

I get the following error message:

SP029: TURTLE RDF loader, line 8: Missing predicate and object between top-level blank node subject and a dot processed pending to here.

It doesn't make much sense to me. Any idea what's wrong?

Stanislav Kralin
  • 11,070
  • 4
  • 35
  • 58
tobik
  • 7,098
  • 7
  • 41
  • 53

2 Answers2

0

Your data (which appeared at first glance to be Turtle, and this is how Virtuoso was parsing it) is just a list of subjects (entities) -- the unidentified a/k/a blank nodes -- with no predicates (attributes) or objects (values). This may help you visualize what I mean --

[ … ]  .

This revision of your sample would work, but you may have a better statement to make about each of your unnamed subjects --

@prefix  ns0:  <http://linked.opendata.cz/ontology/chord/> .
@prefix  ns1:  <http://linked.opendata.cz/resource/business-entity/> .
@prefix  owl:  <http://www.w3.org/2002/07/owl#> .

[ ns0:source  ns1:CZ00006947 ;
  ns0:target  <http://linked.opendata.cz/resource/domain/seznam.gov.cz/rejstriky/business-entity/28175492>
]  a  owl:Thing  .

[ ns0:source  ns1:CZ00241610 ;
  ns0:target  <http://linked.opendata.cz/resource/domain/seznam.gov.cz/rejstriky/business-entity/60437359>
]  a  owl:Thing  .

Alternatively, you could do this, without adding any statements --

@prefix  ns0:  <http://linked.opendata.cz/ontology/chord/> .
@prefix  ns1:  <http://linked.opendata.cz/resource/business-entity/> .
@prefix  owl:  <http://www.w3.org/2002/07/owl#> .

[]  ns0:source  ns1:CZ00006947 ;
    ns0:target  <http://linked.opendata.cz/resource/domain/seznam.gov.cz/rejstriky/business-entity/28175492>
.

[]  ns0:source  ns1:CZ00241610 ;
    ns0:target  <http://linked.opendata.cz/resource/domain/seznam.gov.cz/rejstriky/business-entity/60437359>
.

As you have provided additional details -- that your data is N3, not Turtle -- it seems likely that your POST is not properly identifying your submission as N3, which leads to Virtuoso's parsing error.

TallTed
  • 9,069
  • 2
  • 22
  • 37
  • Thank you but I'm not really sure I understand. The point is that the syntax is wrong. But what's interesting is that some online parses are able to properly extract triplets from that data and convert it to other formats. It's just Virtuoso that's fails to do that. – tobik Mar 31 '16 at 18:52
0

It appears that the syntax is actually correct, or perhaps correct enough so that some online RDF translators (like this one) are able to correctly extract the triplets and translate it to other formats. Apparently, Virtuoso is not capable of doing that. As suggested in another answer, this syntax works:

@prefix  ns0:  <http://linked.opendata.cz/ontology/chord/> .
@prefix  ns1:  <http://linked.opendata.cz/resource/business-entity/> .

[]  ns0:source  ns1:CZ00006947 ;
    ns0:target  <http://linked.opendata.cz/resource/domain/seznam.gov.cz/rejstriky/business-entity/28175492>
.

[]  ns0:source  ns1:CZ00241610 ;
    ns0:target  <http://linked.opendata.cz/resource/domain/seznam.gov.cz/rejstriky/business-entity/60437359>
.

But the problem in my case is that I generate the output programmatically using Apache Jena. The data in my question is how Apache Jena represents blank nodes in N3 (that's the name of this format) which is apparently incompatible with how Virtuoso understands blank nodes in N3.

Unfortunately, Apache Jena API won't allow me to change the way blank nodes are represented in N3. But it does allow me to use different output format. So I switched to RDF/XML and that works. The exactly same data represented in RDF/XML instead of N3 is now possible to push to Virtuoso.

tobik
  • 7,098
  • 7
  • 41
  • 53
  • 1
    Are you sure Virtuoso knows it's getting [Notation3](https://www.w3.org/TeamSubmission/n3/) (`text/n3`, `.n3`), rather than [Turtle](https://www.w3.org/TR/turtle/) (`text/turtle`, `.ttl`), which I thought was in your post, or [N-triples](https://www.w3.org/TR/n-triples/) (`application/n-triples`, `.nt`)? I think Virtuoso does not recognize your N3 (which may be true for many reasons), given that the error says `TURTLE RDF loader`… I'm not intimate with Jena, but I'd suggest testing some other output serializations, as RDF/XML will typically be *MUCH* larger than Turtle, N3, and many others. – TallTed Apr 01 '16 at 04:23
  • I have to admit that those formats are a bit confusing to me (the difference between them). First fact is that if I ask Jena to give me the data in N3 format, this is what I get. The second fact is that once I updated the syntax the way you suggested, ie by moving the closing square bracket up front, it started working. Virtuoso did recognize that. – tobik Apr 01 '16 at 07:56
  • 1
    The question is less what you're asking Jena to give you, and more what you're telling Virtuoso you're submitting. There are missing details about your `POST`; particularly, what MIME type is associated with the data? Virtuoso apparently *sees* Turtle coming, and your N3 is not correct Turtle syntax, so the reported error is appropriate. I suggest following up to the [Virtuoso Users mailing list](https://lists.sourceforge.net/lists/listinfo/virtuoso-users/) or [OpenLink Support Forums](http://boards.openlinksw.com/support/). – TallTed Apr 01 '16 at 14:07
  • This sounds like a plausible explanation. Nevertheless, this exact way of pushing triplets in N3 to virtuoso worked before, it only failed when I tried to push blank nodes in there. And that submitted N3 is not correct Turtle syntax is actually Jena's fault. So adding a MIME type won't fix anything. Btw. is the syntaxt **really** incorrect? [This translator](http://rdf-translator.appspot.com/) is able to extract the triples correctly if told that it's N3... – tobik Apr 03 '16 at 12:33
  • 1
    I'll try to be clearer. You have correct N3. But if Virtuoso isn't *told* it's N3, or if Virtuoso is being told it's *Turtle,* then that would explain the current error. Using the right MIME type on the POST is a good way to tell Virtuoso it's N3. N3 with URIs (not blank nodes) as subjects, is more like (if not identical to) Turtle, which could explain why your previous attempts succeeded. – TallTed Apr 04 '16 at 01:10
  • Okay, now it makes complete sense :) I was still confused by those formats and the difference between them. I'll try to send the correct header. – tobik Apr 04 '16 at 08:17
  • Well, I tried to explicitly tell Virtuoso that I'm sending Notation3 using the Content-Type header (`Content-Type: text/n3`) but Virtuoso seems to ignore that, the error message remains the same. As the app itself and virtuoso run on the same machine, the RDF/XML size overhead is not a big deal and I might just stick to it since it works. – tobik Apr 04 '16 at 12:48
  • 1
    I see. OK, that appears to be a bug, which I've raised internally. You might raise it yourself via the [github project](https://github.com/openlink/virtuoso-opensource/issues), the [Virtuoso Users mailing list](https://lists.sourceforge.net/lists/listinfo/virtuoso-users/) or a [Support Case](http://support.openlinksw.com/support/online-support.vsp), if you care to receive updates. – TallTed Apr 04 '16 at 13:57