Re: JsonLD @vocab

2018-01-08 Thread Andy Seaborne

https://github.com/jsonld-java/jsonld-java/issues

or for general JSON-LD:

public-linked-j...@w3.org

Andy

On 08/01/18 01:17, Adam Jacobs wrote:

Do you know where jsonld discussions are at?
I'm having trouble finding a mailing list.



From: Andy Seaborne <a...@apache.org>
Sent: Thursday, January 4, 2018 2:34 PM
To: dev@jena.apache.org
Subject: Re: JsonLD @vocab

Adam,

In the first instance, this seems like something to raise with the
jsonld-java team to find out if that is intentional. Could you open a
discussion issue there?

IIRC empty prefix and the base are mixed up in JSON-LD.

  Andy

On 04/01/18 03:34, Adam Jacobs wrote:

The @vocab prefix is dropped by Jena when parsing JsonLD.
An empty prefix is correctly translated into @vocab during serialization, but 
is lost during deserialization.
Below code demonstrates the point.

  public static void main(String... args) {
  String base = "http://www.ns.com/base/;;
  String prefix = "http://www.ns.com/prefix/;;

  Model m = ModelFactory.createDefaultModel();
  m.setNsPrefix("", base);
  m.setNsPrefix("prefix", prefix);

  m.add(m.createResource(base + "foo"), m.createProperty(prefix + "bar"), 
m.createResource(base + "baz"));
  String jsonLD = serializeJsonLD(m);
  System.out.println(jsonLD);

  InputStream in = new ByteArrayInputStream(jsonLD.getBytes());
  Model m2 = ModelFactory.createDefaultModel().read(in, null, "jsonld");
  System.out.println(serializeJsonLD(m2));
  }

  public static String serializeJsonLD(Model m) {
  OutputStream out = new ByteArrayOutputStream();
  m.write(out, "jsonld");
  return out.toString();
  }

  From what I can see, jsonld-java is intentionally ignoring the @vocab key at 
line 277 of Context.java.
  
https://github.com/jsonld-java/jsonld-java/blob/master/core/src/main/java/com/github/jsonldjava/core/Context.java

I'm not sure if this is a bug in jsonld-java, or intentional behavior from a 
jsonld perspective that Jena should work around e.g. in JsonLDReader?



Re: JsonLD @vocab

2018-01-07 Thread Adam Jacobs
Do you know where jsonld discussions are at?
I'm having trouble finding a mailing list.



From: Andy Seaborne <a...@apache.org>
Sent: Thursday, January 4, 2018 2:34 PM
To: dev@jena.apache.org
Subject: Re: JsonLD @vocab

Adam,

In the first instance, this seems like something to raise with the
jsonld-java team to find out if that is intentional. Could you open a
discussion issue there?

IIRC empty prefix and the base are mixed up in JSON-LD.

 Andy

On 04/01/18 03:34, Adam Jacobs wrote:
> The @vocab prefix is dropped by Jena when parsing JsonLD.
> An empty prefix is correctly translated into @vocab during serialization, but 
> is lost during deserialization.
> Below code demonstrates the point.
>
>  public static void main(String... args) {
>  String base = "http://www.ns.com/base/;;
>  String prefix = "http://www.ns.com/prefix/;;
>
>  Model m = ModelFactory.createDefaultModel();
>  m.setNsPrefix("", base);
>  m.setNsPrefix("prefix", prefix);
>
>  m.add(m.createResource(base + "foo"), m.createProperty(prefix + 
> "bar"), m.createResource(base + "baz"));
>  String jsonLD = serializeJsonLD(m);
>  System.out.println(jsonLD);
>
>  InputStream in = new ByteArrayInputStream(jsonLD.getBytes());
>  Model m2 = ModelFactory.createDefaultModel().read(in, null, 
> "jsonld");
>  System.out.println(serializeJsonLD(m2));
>  }
>
>  public static String serializeJsonLD(Model m) {
>  OutputStream out = new ByteArrayOutputStream();
>  m.write(out, "jsonld");
>  return out.toString();
>  }
>
>  From what I can see, jsonld-java is intentionally ignoring the @vocab key at 
> line 277 of Context.java.
>  
> https://github.com/jsonld-java/jsonld-java/blob/master/core/src/main/java/com/github/jsonldjava/core/Context.java
>
> I'm not sure if this is a bug in jsonld-java, or intentional behavior from a 
> jsonld perspective that Jena should work around e.g. in JsonLDReader?
>


Re: JsonLD @vocab

2018-01-04 Thread Andy Seaborne

Adam,

In the first instance, this seems like something to raise with the 
jsonld-java team to find out if that is intentional. Could you open a 
discussion issue there?


IIRC empty prefix and the base are mixed up in JSON-LD.

Andy

On 04/01/18 03:34, Adam Jacobs wrote:

The @vocab prefix is dropped by Jena when parsing JsonLD.
An empty prefix is correctly translated into @vocab during serialization, but 
is lost during deserialization.
Below code demonstrates the point.

 public static void main(String... args) {
 String base = "http://www.ns.com/base/;;
 String prefix = "http://www.ns.com/prefix/;;

 Model m = ModelFactory.createDefaultModel();
 m.setNsPrefix("", base);
 m.setNsPrefix("prefix", prefix);

 m.add(m.createResource(base + "foo"), m.createProperty(prefix + "bar"), 
m.createResource(base + "baz"));
 String jsonLD = serializeJsonLD(m);
 System.out.println(jsonLD);

 InputStream in = new ByteArrayInputStream(jsonLD.getBytes());
 Model m2 = ModelFactory.createDefaultModel().read(in, null, "jsonld");
 System.out.println(serializeJsonLD(m2));
 }

 public static String serializeJsonLD(Model m) {
 OutputStream out = new ByteArrayOutputStream();
 m.write(out, "jsonld");
 return out.toString();
 }

 From what I can see, jsonld-java is intentionally ignoring the @vocab key at 
line 277 of Context.java.
 
https://github.com/jsonld-java/jsonld-java/blob/master/core/src/main/java/com/github/jsonldjava/core/Context.java

I'm not sure if this is a bug in jsonld-java, or intentional behavior from a 
jsonld perspective that Jena should work around e.g. in JsonLDReader?



JsonLD @vocab

2018-01-03 Thread Adam Jacobs
The @vocab prefix is dropped by Jena when parsing JsonLD.
An empty prefix is correctly translated into @vocab during serialization, but 
is lost during deserialization.
Below code demonstrates the point.

public static void main(String... args) {
String base = "http://www.ns.com/base/;;
String prefix = "http://www.ns.com/prefix/;;

Model m = ModelFactory.createDefaultModel();
m.setNsPrefix("", base);
m.setNsPrefix("prefix", prefix);

m.add(m.createResource(base + "foo"), m.createProperty(prefix + "bar"), 
m.createResource(base + "baz"));
String jsonLD = serializeJsonLD(m);
System.out.println(jsonLD);

InputStream in = new ByteArrayInputStream(jsonLD.getBytes());
Model m2 = ModelFactory.createDefaultModel().read(in, null, "jsonld");
System.out.println(serializeJsonLD(m2));
}

public static String serializeJsonLD(Model m) {
OutputStream out = new ByteArrayOutputStream();
m.write(out, "jsonld");
return out.toString();
}

>From what I can see, jsonld-java is intentionally ignoring the @vocab key at 
>line 277 of Context.java.

https://github.com/jsonld-java/jsonld-java/blob/master/core/src/main/java/com/github/jsonldjava/core/Context.java

I'm not sure if this is a bug in jsonld-java, or intentional behavior from a 
jsonld perspective that Jena should work around e.g. in JsonLDReader?


[GitHub] jena pull request #235: jsonld: @vocab in @context for "" ns prefix

2017-04-11 Thread asfgit
Github user asfgit closed the pull request at:

https://github.com/apache/jena/pull/235


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] jena issue #235: jsonld: @vocab in @context for "" ns prefix

2017-04-09 Thread fpservant
Github user fpservant commented on the issue:

https://github.com/apache/jena/pull/235
  
> Does this complete JENA-1292?

yes.

In JENA-1292's discussion I had suggested a way to automatically remove 
from the @context the properties that belong to the @vocab, but it is not a 
good idea. It adds unnecessary complexity, as same result can be achieved by a 
user with a few lines of code, and existing features (possibility to replace 
the @context by a given value in the jsonld output)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] jena issue #235: jsonld: @vocab in @context for "" ns prefix

2017-04-09 Thread afs
Github user afs commented on the issue:

https://github.com/apache/jena/pull/235
  
I've pulled this into the work general cleaning up RIOT (PR#234). It'll get 
included when that is merged. 

Does this complete JENA-1292?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---


[GitHub] jena pull request #235: jsonld: @vocab in @context for "" ns prefix

2017-04-09 Thread fpservant
GitHub user fpservant opened a pull request:

https://github.com/apache/jena/pull/235

jsonld: @vocab in @context for "" ns prefix

"" prefix are not allowed in jsonld's @context. "" ns prefix defined in a 
model were therefore ignored. This pull request proposes to define @vocab with 
the ns corresponding to such an "" prefix. Everything else remained unchanged.

cf. JENA-1292



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/fpservant/jena atvocabNEW2

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/jena/pull/235.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #235


commit d81a0f0e35aba7b86b979574b2e3a33c4e4a1f78
Author: François-Paul Servant <f...@semanlink.net>
Date:   2017-04-08T19:49:42Z

jsonld: @vocab in @context for "" ns prefix




---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---