GithubHelp home page GithubHelp logo

Comments (6)

kzangeli avatar kzangeli commented on August 29, 2024

ok ...
So, "partial alias replacement" for:

  • Entity Type Value
  • Attribute Names

And (I assume):

  • ':' cannot be a part of the name of a prefix
  • only one pass

Anything else I need to know?

This doesn't seem too difficult to implement, but the broker will unfortunately be slower ...

And just to make sure I've understood ...
foaf:name in this example will be expanded to http://xmlns.com/foaf/0.1/name

from context.orion-ld.

jmcanterafonseca avatar jmcanterafonseca commented on August 29, 2024

also the object field has to be properly expanded

from context.orion-ld.

jmcanterafonseca avatar jmcanterafonseca commented on August 29, 2024

correct
foaf:name in this example will be expanded to http://xmlns.com/foaf/0.1/name

from context.orion-ld.

kzangeli avatar kzangeli commented on August 29, 2024

One more doubt here ...
What if I do a GET of an entity created with prefix expansion?

  1. GET without context
    What should be returned?
    1.1 Long names (http://xmlns.com/foaf/0.1/name)?
    1.2 Short names (foaf:name) and the context of the entity creation?

  2. GET with context (foaf set to http://xmlns.com/foaf/0.2/ inside the context)
    2.1 Long names (http://xmlns.com/foaf/0.2/name)?
    2.2 Short names (foaf:name)? I'd need to return TWO contexts for this ...

The response '2.1' is pretty complex. I'd need to first detect that http://xmlns.com/foaf/0.1/ corresponds to foaf from the context of the creation of the entity. After that I have to do prefix expansion foaf => http://xmlns.com/foaf/0.2/ from the context of the GET request.

from context.orion-ld.

jmcanterafonseca avatar jmcanterafonseca commented on August 29, 2024
  1. a GET without @context should return the URI (long names), as you don't have any @context to resolve against

  2. If the @context only contains the mapping "foaf": "http://xmlns.com/foaf/0.2/" , as you said you would need to check whether your long URIs contain that prefix, and as you say it can be tricky ... another option is to store for each attribute URI two component parts (prefix, name) or another option is to just return the long URIs and hope for the best that the JSON-LD processor later does the work ...

from context.orion-ld.

jason-fox avatar jason-fox commented on August 29, 2024

There is another valid case for prefix expansion which is not yet covered:

If I create an entity as shown, with an inline context:

{
    "id": "urn:ngsi-ld:Building:store001",
    "type": "Building",

    "@context": {
	    "type": "@type",
	    "id": "@id",
	    "fiware": "https://uri.fiware.org/ns/datamodels#",
	    "Building": "fiware:Building"
   }
}

I would expect to be able to retrieve it using the FQN https://uri.fiware.org/ns/datamodels#Building. This is a common practice already used within JSON-LD. For example the schema.org JSON-LD context defines the following:

"schema": "http://schema.org/",

"AboutPage": {"@id": "schema:AboutPage"},
"AcceptAction": {"@id": "schema:AcceptAction"},
"Accommodation": {"@id": "schema:Accommodation"},
..etc.

In other words every entity and attribute is defined using the shorthand notation, the FQN is used throughout to alias the shortname. It should just be a matter of preprocessing the context and replacing "xxx:..." if "xxx" has been defined as a FQN previously.

from context.orion-ld.

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.