Hello Kjetil,

The bug is fixed and the fix will appear in next version of Virtuoso
Open Source. The patch for the current version is attached.

Best Regards,

Ivan Mikhailov
OpenLink Software
http://virtuoso.openlinksw.com

On Tue, 2008-10-14 at 13:21 +0200, Kjetil Kjernsmo wrote:
> Hi all,
> 
> I've had a couple of problems parsing our Turtle files. Most importantly, 
> @base doesn't seem to work:
> 
> SQL> ttlp (file_to_string_output 
> ('/home/kkj/dev/sublima/blocks/sublima-app/src/main/resources/rdf-data/information-model.ttl'),
>  '', 'http://sublima.computas.com/', 
> 0);
> 
> *** Error 37000: [Virtuoso Driver][Virtuoso Server]SP029: TURTLE RDF loader, 
> line 10: syntax error
> at line 2 of Top-Level:
> 
> The line it doesn't like is this:
> @base <http://xmlns.computas.com/sublima-information-model> .
> 
> I would prefer setting that to setting the base parameter in the loader, even 
> though the latter is also useful. Am I missing something obvious?
> 
> Then it doesn't like things like 
> topic:topic0001611
>       rdf:type skos:Concept ;
>       skos:inScheme topic: ;
>       skos:broader topic:topic00090 .
> 
> (somewhat modified from the actual code for brevity). It is      
> skos:inScheme topic: ;
> that it claims is a syntax error. I can see why it might, and I see a 
> workaround, but Redland and Jena doesn't complain. I'm not a seasoned BNF 
> reader, but the latest spec says 
> 
> qname ::=     prefixName? ':' name?
> 
> so it looks like both are optional.
> 
> Likewise       
> dct:language : ;
> which is quite nonsensical, but it passes the other parsers, and 
> :    rdf:type owl:Ontology ;
> 
> Well, you get the idea? Perhaps this is something that entered the spec with 
> the Team Submission?
> 
> 
> Kind regards 
> 
> Kjetil Kjernsmo
Index: libsrc/Wi/turtle_l.l
===================================================================
RCS file: /home/staff/us-cvs/virtuoso/libsrc/Wi/turtle_l.l,v
retrieving revision 1.22
diff -U 10 -r1.22 turtle_l.l
--- libsrc/Wi/turtle_l.l	18 Aug 2008 22:36:42 -0000	1.22
+++ libsrc/Wi/turtle_l.l	14 Oct 2008 22:40:47 -0000
@@ -148,20 +148,21 @@
 <INITIAL>"."[^0-9]	{ ttlyyerror ("Whitespace is required after dot if dot is not inside decimal number, string or IRI"); }
 <INITIAL>"."		{ return _DOT_WS; }
 <INITIAL>":"		{ return _COLON; }
 <INITIAL>";"		{ return _SEMI; }
 <INITIAL>"="		{ return _EQ; }
 <INITIAL>"=>"		{ return _EQ_GT; }
 <INITIAL>"<="		{ return _LT_EQ; }
 <INITIAL>"!"		{ return _BANG; }
 
 <INITIAL>"@a"				{ return _AT_a_L; }
+<INITIAL>"@base"			{ return _AT_base_L; }
 <INITIAL>"@has"				{ return _AT_has_L; }
 <INITIAL>"@is"				{ return _AT_is_L; }
 <INITIAL>"@of"				{ return _AT_of_L; }
 <INITIAL>"@this"			{ return _AT_this_L; }
 <INITIAL>"@keywords"			{ return _AT_keywords_L; }
 <INITIAL>"@prefix"			{ return _AT_prefix_L; }
 <INITIAL>"@forAll"			{ ttlyyerror ("Current version of Virtuoso does not support @forAll keyword"); }
 <INITIAL>"@forSome"			{ ttlyyerror ("Current version of Virtuoso does not support @forSome keyword"); }
 <INITIAL>"false"			{ return false_L; }
 <INITIAL>"true"				{ return true_L; }
Index: libsrc/Wi/turtle_p.y
===================================================================
RCS file: /home/staff/us-cvs/virtuoso/libsrc/Wi/turtle_p.y,v
retrieving revision 1.23
retrieving revision 1.25
diff -U 10 -r1.23 -r1.25
--- libsrc/Wi/turtle_p.y	10 Aug 2008 20:44:46 -0000	1.23
+++ libsrc/Wi/turtle_p.y	14 Oct 2008 22:51:10 -0000	1.25
@@ -78,20 +78,21 @@
 %token _RBRA		/*:: PUNCT_TTL_LAST("{ }") ::*/
 %token _RPAR		/*:: PUNCT_TTL_LAST("( )") ::*/
 %token _RSQBRA		/*:: PUNCT_TTL_LAST("[ ]") ::*/
 %token _SEMI		/*:: PUNCT_TTL_LAST(";") ::*/
 %token _EQ		/*:: PUNCT_TTL_LAST("=") ::*/
 %token _EQ_GT		/*:: PUNCT_TTL_LAST("=>") ::*/
 %token _LT_EQ		/*:: PUNCT_TTL_LAST("<=") ::*/
 %token _BANG		/*:: PUNCT_TTL_LAST("!") ::*/
 
 %token _AT_a_L		/*:: PUNCT_TTL_LAST("@a") ::*/
+%token _AT_base_L	/*:: PUNCT_TTL_LAST("@base") ::*/
 %token _AT_has_L	/*:: PUNCT_TTL_LAST("@has") ::*/
 %token _AT_is_L		/*:: PUNCT_TTL_LAST("@is") ::*/
 %token _AT_keywords_L	/*:: PUNCT_TTL_LAST("@keywords") ::*/
 %token _AT_of_L		/*:: PUNCT_TTL_LAST("@of") ::*/
 %token _AT_prefix_L	/*:: PUNCT_TTL_LAST("@prefix") ::*/
 %token _AT_this_L	/*:: PUNCT_TTL_LAST("@this") ::*/
 %token false_L		/*:: PUNCT_TTL_LAST("false") ::*/
 %token true_L		/*:: PUNCT_TTL_LAST("true") ::*/
 
 %token __TTL_PUNCT_END	/* Delimiting value for syntax highlighting */
@@ -124,20 +125,21 @@
 %type<token_type> keyword
 %%
 
 turtledoc
         : /* empty */
 	| turtledoc clause
 	;
 
 clause
         : _AT_keywords_L { ttlp_arg->ttlp_special_qnames = ~0; } keyword_list dot_opt
+	| _AT_base_L Q_IRI_REF dot_opt { dk_free_box (ttlp_arg->ttlp_base_uri); ttlp_arg->ttlp_base_uri = $2; }
         | _AT_prefix_L QNAME_NS Q_IRI_REF dot_opt {
 		dk_set_push (&(ttlp_arg->ttlp_namespaces), $3);
 		dk_set_push (&(ttlp_arg->ttlp_namespaces), $2); }
 	| _AT_prefix_L _COLON Q_IRI_REF dot_opt	{
 		dk_free_box (ttlp_arg->ttlp_default_ns_uri);
 		ttlp_arg->ttlp_default_ns_uri = $3; }
 	| q_complete { dk_free_tree (ttlp_arg->ttlp_subj_uri);
 		ttlp_arg->ttlp_subj_uri = ttlp_arg->ttlp_last_complete_uri;
 		ttlp_arg->ttlp_last_complete_uri = NULL; }
 		trig_block_or_predicate_object_list
@@ -463,12 +465,20 @@
 		  TTLP_URI_RESOLVE_IF_NEEDED(ttlp_arg->ttlp_last_complete_uri);
 		 }
 	| QNAME
 		{
                   if (NULL != ttlp_arg->ttlp_last_complete_uri)
 		    ttlyyerror_action ("Internal error: proven memory leak");
 		  ttlp_arg->ttlp_last_complete_uri = $1;
 		  ttlp_arg->ttlp_last_complete_uri = ttlp_expand_qname_prefix (ttlp_arg, ttlp_arg->ttlp_last_complete_uri);
 		  TTLP_URI_RESOLVE_IF_NEEDED(ttlp_arg->ttlp_last_complete_uri);
 		}
+	| QNAME_NS
+		{
+                  if (NULL != ttlp_arg->ttlp_last_complete_uri)
+		    ttlyyerror_action ("Internal error: proven memory leak");
+		  ttlp_arg->ttlp_last_complete_uri = $1;
+		  ttlp_arg->ttlp_last_complete_uri = ttlp_expand_qname_prefix (ttlp_arg, ttlp_arg->ttlp_last_complete_uri);
+		  TTLP_URI_RESOLVE_IF_NEEDED(ttlp_arg->ttlp_last_complete_uri);
+		}
 	;
 

Reply via email to