Coder Social home page Coder Social logo

Comments (6)

sebastiankb avatar sebastiankb commented on July 20, 2024

the prefix name should actually be independent. The actual namespace behind the prefix (= http://www.w3.org/2011/http#) is important. We need a generic processing of this.

from node-wot.

danielpeintner avatar danielpeintner commented on July 20, 2024

The TD (per default) has now htv bind to http://www.w3.org/2011/http#.

Hence I think

  1. htv:methodName can be used without an additional @context definition
  2. An additional @context definition such as "abc": "http://www.w3.org/2011/http#" should be still possible/allowed and needs to be processed properly by node-wot

from node-wot.

danielpeintner avatar danielpeintner commented on July 20, 2024

I wonder which is the better solution.

  1. the simpler approach of adding a JSON-LD library to node-wot that parses initially the provided TD and rewrites prefixes according to our understanding (e.g., http://www.w3.org/2011/http# to to htv).
    This means no big change in the rest of the code

  2. an actual rewrite with passing "@context" array or the entire TD everywhere
    (makes it also safer/better for possible future updates/changes)

from node-wot.

egekorkan avatar egekorkan commented on July 20, 2024

I am not sure if I understand the first one since how could you know where to look at? What if I have a TD like the following:

{
    "@context": [
        "https://www.w3.org/2019/wot/td/v1",
        { "wow": http://www.w3.org/2011/http#" }
    ],
    ...
    "properties": {
        "weather": {
            "forms": [{
              "href" : "http://example.org/weather",
              "wow:methodName": "GET"
            }]
        },
        ...
    },
    ...
}

I think the reason I am confused is because we don't necessarily need JSON-LD support here since we need to find where we have http://www.w3.org/2011/http# and replace wow with htv no?

from node-wot.

danielpeintner avatar danielpeintner commented on July 20, 2024

I think the reason I am confused is because we don't necessarily need JSON-LD support here since we need to find where we have http://www.w3.org/2011/http# and replace wow with htv no?

You are right. We can walk over all JSON keys and replace any "wow:" with "htv:". I was just thinking that this rewrite is better than with a library. I am not sure if there are (or can be) some corner cases that make it more difficult like

Shall we go with this simple rewrite solution?

from node-wot.

relu91 avatar relu91 commented on July 20, 2024

Currently, in the spec, we force the prefix to be the one specified (e.g. for HTTP is htv, for modbus modv). This ensures the support for non-JSON-LD parsers. Closing the issue.

from node-wot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.