- From: Vladimir Alexiev <vladimir.alexiev@ontotext.com>
- Date: Thu, 17 Nov 2022 15:27:16 +0200
- To: Paul Tyson <phtyson@sbcglobal.net>
- Cc: public-json-ld@w3.org
- Message-ID: <CAMv+wg6M_M3YH-spHV5=xNCjvN95RDbOwwbJAuFyQHq5JjVhRw@mail.gmail.com>
There's no way to do this in JSON-LD.
- The first value is a JSON integer, which I think will come out as
xsd:int. But a very large one will probably be cast to xsd:float
- All other values are strings: JSON has no datatypes for URL or
datetime.
You're asking to leverage regexes to attach appropriate datatypes to
literals. I've only seen this in Perl:
- https://metacpan.org/pod/RDF::TrineX::Parser::Pretdsl
- https://metacpan.org/pod/RDF::Trine::Parser::ShorthandRDF
- https://lists.w3.org/Archives/Public/semantic-web/2012Aug/0053.html
We're discussing similar stuff for YAML-LD, see
https://github.com/json-ld/yaml-ld/issues/83
On Thu, Nov 17, 2022 at 5:24 AM Paul Tyson <phtyson@sbcglobal.net> wrote:
> I have a property that can take any type of RDF term as a value.
>
> {
> "@context": {
> "ex": "http://example.org/ns/",
> },
> "ex:thing1": {"ex:foo": 1},
> "ex:thing2": {"ex:foo": "a string"},
> "ex:thing3": {"ex:foo": "http://example.org/yugo"}
> "ex:thing4": {"ex:foo": "2022-11-16T21:04:41"}
> }
>
> Is there any way to construct the context to make this come out in RDF
> like:
>
> _:b0 <http://example.org/ns/thing1> _:b1 .
> _:b0 <http://example.org/ns/thing2> _:b2 .
> _:b0 <http://example.org/ns/thing3> _:b3 .
> _:b0 <http://example.org/ns/thing4> _:b4 .
> _:b1 <http://example.org/ns/foo>
> "1"^^<http://www.w3.org/2001/XMLSchema#integer> .
> _:b2 <http://example.org/ns/foo> "a string" .
> _:b3 <http://example.org/ns/foo> <http://example.org/yugo> .
> _:b4 <http://example.org/ns/foo>
> "2022-11-16T21:04:41"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
>
> Thanks and regards,
> --Paul
>
>
>
Received on Thursday, 17 November 2022 13:27:40 UTC