Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Underscores in property name prevents from getting the value #38

Open
matthieu-fesselier opened this issue Sep 20, 2019 · 1 comment
Open
Labels
bug Something isn't working

Comments

@matthieu-fesselier
Copy link

As you explain in the documentation, the semi-colon can be substituted by the underscores in property names.

In my example, I have a property name containing an underscore, and I get undefined when I try to fetch its value. Is it related?

const base_context = {
  '@vocab': 'http://happy-dev.fr/owl/#',
  rdf: 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
  rdfs: 'http://www.w3.org/2000/01/rdf-schema#',
  ldp: 'http://www.w3.org/ns/ldp#',
  foaf: 'http://xmlns.com/foaf/0.1/',
  name: 'rdfs:label',
  acl: 'http://www.w3.org/ns/auth/acl#',
  permissions: 'acl:accessControl',
  mode: 'acl:mode',
};

await solid.data.context.extend(base_context);
const resource = solid.data['https://api.coopstarter.happy-dev.fr/resources/1/'];
console.log(`${await resource.publication_year}`); // Prints undefined
@RubenVerborgh RubenVerborgh added the bug Something isn't working label Sep 20, 2019
@RubenVerborgh
Copy link
Member

RubenVerborgh commented Sep 20, 2019

Indeed, you are hitting a limitation of the underscore approach here; it tries to find publication:year.

As a workaround, you could define the hd prefix as http://happy-dev.fr/owl/# and then use hd_publication_year.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants