virtuoso-opensource icon indicating copy to clipboard operation
virtuoso-opensource copied to clipboard

Options datatype and language are ignored by Literal classes

Open galgonek opened this issue 3 years ago • 7 comments
trafficstars

It seems that Virtuoso ignores datatype and language options in create Literal class statements.

If I create the table —

create table "TEST"."TEST"."EXAMPLE"(
  id integer primary key,
  name VARCHAR(100)
);

insert soft "TEST"."TEST"."EXAMPLE" values (1, 'Virtuoso');

— and define the mapping —

sparql
prefix virtrdf: <http://www.openlinksw.com/schemas/virtrdf#>
create IRI class <class:id> "http://example.com/entity/%d" (in id integer) .
create Literal class <class:lang> "%s" (in name varchar) option (lang "en") .
create Literal class <class:type> "%s" (in name varchar) option (datatype <http://example.com/mystring> ) .
create quad storage virtrdf:Example from "TEST"."TEST"."EXAMPLE" as tbl {
  create <http://temp/example> as graph <http://example.com/> {
    <class:id> (tbl."id")
      <http://example.com/test1> <class:lang> (tbl."name") ;
      <http://example.com/test2> <class:type> (tbl."name") .
  }
};

— then the SPARQL query —

sparql define input:storage virtrdf:Example
select ?P ?O (datatype(?O) as ?datatype) (lang(?O) as ?lang) where { ?S ?P ?O };

--- returns the result ---

P
LONG VARCHAR
O
LONG VARCHAR
datatype
LONG VARCHAR
lang
LONG VARCHAR
http://example.com/test1 Virtuoso http://www.w3.org/2001/XMLSchema#string BLOB 0 chars
http://example.com/test2 Virtuoso http://www.w3.org/2001/XMLSchema#string BLOB 0 chars

However, the result ---

P
LONG VARCHAR
O
LONG VARCHAR
datatype
LONG VARCHAR
lang
LONG VARCHAR
http://example.com/test1 Virtuoso http://www.w3.org/1999/02/22-rdf-syntax-ns#langString en
http://example.com/test2 Virtuoso http://example.com/mystring

--- should be returned.

galgonek avatar Jan 21 '22 13:01 galgonek

@galgonek -- Please confirm the exact version of Virtuoso in use for this test, with the first stanza of output from the command-line virtuoso-t -? or virtuoso-odbc -? (or otherwise adjusted to match the Virtuoso executable name in your environment).

@pvk @HughWilliams @imitko @IvanMikhailov @openlink -- Please look into this issue with User-defined Custom Data Types.

TallTed avatar Jan 21 '22 18:01 TallTed

@TallTed -- I have tested the last stable version —

Virtuoso Open Source Edition (Column Store) (multi threaded)
Version 7.2.6.3233-pthreads as of Jan 21 2022 (000000)
Compiled for Linux (x86_64-pc-linux-gnu)

— and the last devel version —

Virtuoso Open Source Edition (Column Store) (multi threaded)
Version 7.2.7-dev.3233-pthreads as of Jan 21 2022 (000000)
Compiled for Linux (x86_64-pc-linux-gnu)

galgonek avatar Jan 21 '22 19:01 galgonek

@galgonek -- It appears you have built from a packaged download of source from GitHub, which leaves out a key snippet, which you can get with a proper clone -- which changes the (000000) seen in the strings above, to a GitHead value (such as (1963b2bb52), which I got from the current DBpedia backend via SPARQL query). You may be able to manually glean the "latest commit ID" from the two source trees you built from, which will help us be sure we're looking at the same things.

TallTed avatar Jan 21 '22 19:01 TallTed

@TallTed

Virtuoso Open Source Edition (Column Store) (multi threaded)
Version 7.2.6.3233-pthreads as of Jan 21 2022 (64663f91c)
Compiled for Linux (x86_64-pc-linux-gnu)

— and —

Virtuoso Open Source Edition (Column Store) (multi threaded)
Version 7.2.7-dev.3233-pthreads as of Jan 21 2022 (5f9a2ffdf)
Compiled for Linux (x86_64-pc-linux-gnu)

galgonek avatar Jan 21 '22 20:01 galgonek

I have been able to recreate this problem and reported to development to look into and fix ...

HughWilliams avatar Jan 23 '22 22:01 HughWilliams

Might #428 and #946 be related to this?

jmkeil avatar Feb 01 '22 13:02 jmkeil

Might #428 and #946 be related to this?

@jmkeil -- Good question. I've noted this possibility internally, where we're tracking #1003 as bug#19162, and #428 as bug#17168. (#946 has no internal bug# at this time.)

TallTed avatar Feb 01 '22 16:02 TallTed