Skip to content

How to iterate over properties on the resource that are not supported properties #293

@lambdakris

Description

@lambdakris

Hey @tpluscode , is there a way to iterate over the properties on a resource if they are not listed as supported in the api doc? I did try resorting to using clownface, but I could only manage to get the property values and not the property names.

This is essentially what I tried with clownface

...
response.representation.root.pointer.out().forEach(x => {
  console.log(x)
})
...

And just in case...

Here is the resource I'm trying to consume

@base <http://localhost:8080/>.

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
@prefix : <http://localhost:8080/api-onto#>.
@prefix owl: <http://www.w3.org/2002/07/owl#>.
@prefix hydra: <http://www.w3.org/ns/hydra/core#>.

<http://localhost:8080/> <http://localhost:8080/api-doc#lexicalResultSet> <http://localhost:8080/lexical-result-set>;
                         <http://localhost:8080/api-doc#semanticResultSet> <http://localhost:8080/semantic-result-set>;
                         a <http://localhost:8080/api-doc#EntryPoint>.

Here is the documentation

@base <http://localhost:8080/>.

@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>.
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>.
@prefix xsd: <http://www.w3.org/2001/XMLSchema#>.
@prefix : <http://localhost:8080/api-onto#>.
@prefix owl: <http://www.w3.org/2002/07/owl#>.
@prefix hydra: <http://www.w3.org/ns/hydra/core#>.

<http://localhost:8080/api-doc> a hydra:ApiDocumentation;
                                hydra:entrypoint <http://localhost:8080/entry-point>;
                                hydra:supportedClass <http://localhost:8080/api-doc#EntryPoint>,
                                                     <http://localhost:8080/api-doc#LexicalResultSet>,
                                                     <http://localhost:8080/api-doc#SemanticResultSet>.
<http://localhost:8080/api-doc#EntryPoint> a hydra:Class;
                                           hydra:supportedProperty <http://localhost:8080/api-doc#lexicalResultSet>,
                                                                   <http://localhost:8080/api-doc#semanticResultSet>.
<http://localhost:8080/api-doc#LexicalResultSet> a hydra:Class;
                                                 hydra:supportedOperation <http://localhost:8080/api-doc#LexicalResultSetQuery>.
<http://localhost:8080/api-doc#LexicalResultSetQuery> a hydra:Operation;
                                                      hydra:expects owl:Nothing;
                                                      hydra:method "GET";
                                                      hydra:returns <http://localhost:8080/api-doc#LexicalResultSet>;
                                                      hydra:title "Perform a Lexical Result Set Query".
<http://localhost:8080/api-doc#SemanticResultSet> a hydra:Class;
                                                  hydra:supportedOperation <http://localhost:8080/api-doc#SemanticResultSetQuery>.
<http://localhost:8080/api-doc#SemanticResultSetQuery> a hydra:Operation;
                                                       hydra:expects owl:Nothing;
                                                       hydra:method "GET";
                                                       hydra:returns <http://localhost:8080/api-doc#LexicalResultSet>;
                                                       hydra:title "Perform a Semantic Result Set Query".
<http://localhost:8080/api-doc#lexicalResultSet> a hydra:Link;
                                                 rdfs:range <http://localhost:8080/lexical-result-set>;
                                                 hydra:property <http://localhost:8080/api-doc#lexicalResultSet>.
<http://localhost:8080/api-doc#semanticResultSet> a hydra:Link;
                                                  rdfs:range <http://localhost:8080/semantic-result-set>;
                                                  hydra:property <http://localhost:8080/api-doc#semanticResultSet>.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions