GithubHelp home page GithubHelp logo

Comments (12)

rubensworks avatar rubensworks commented on September 16, 2024

Your path is in fact correct, it's only the error message that incorrectly constructucts the path (this will be fixed soon in a Components.js rewrite).

What is the full error you are getting? That should show more information about what is going wrong.


Side-note, have you seen this? This is ported from code you wrote before.

from server.js.

mielvds avatar mielvds commented on September 16, 2024

Your path is in fact correct, it's only the error message that incorrectly constructucts the path (this will be fixed soon in a Components.js rewrite).

What is the full error you are getting? That should show more information about what is going wrong.

I get a second error indeed, which I thought was unrelated:

Error: Invalid components file "config.json":
Error: No valid parser was found, both N3 and JSON-LD failed:
[
  Error: Expected entity but got literal on line 2.
...
 jsonld.InvalidUrl: Dereferencing a URL did not result in a valid JSON-LD object. Possible causes are an inaccessible URL perhaps due to a same-origin policy (ensure the server uses CORS if you are using client-side JavaScript), too many redirects, a non-JSON response, or more than one HTTP Link Header was provided for a remote context.

...

details: 
{
      code: 'loading remote context failed',
      url: 'https://linkedsoftwaredependencies.org/bundles/npm/ldf-datasource-summary/^0.0.1/components/context.jsonld',
      cause: [JsonLdError]
    }

https://linkedsoftwaredependencies.org/bundles/npm/ldf-datasource-summary/0.0.1/components/context.jsonld returns a 500, but regardless, I thought Components.js checks the local filesystem first?

Side-note, have you seen this? This is ported from code you wrote before.

Jep! But that's a different thing, ie. publishing the summaries. This module is to use summaries as a datasource, more of a niche application.

from server.js.

rubensworks avatar rubensworks commented on September 16, 2024

I thought Components.js checks the local filesystem first?

Indeed, it should.
Your package.json, config file and components files look fine to me, so perhaps something is going wrong when starting the server.

I suspect your config is being loaded, but your ldf-datasource-summary was not detected by Components.js.
This could be because it is not part of the node_modules folder the main module path (usually location of the server package).

If you are using @ldf/server, then you'll have to add ldf-datasource-summary to its dependencies (npm link should be fine as well).
A better approach would be to fork @ldf/server into a dedicated npm package that you can optionally re-publish, and add the dependency there.

from server.js.

rubensworks avatar rubensworks commented on September 16, 2024

FYI, we just discovered that npx may also be a good tool for this: LinkedSoftwareDependencies/Components.js#29 (comment)

from server.js.

mielvds avatar mielvds commented on September 16, 2024

Thanks @rubensworks. The issue persists, even with npm link (or npx)... could you explain what you mean with fork? I have my own 'copy' of @ldf/server where I edited the package.json and config.json.
I've put the files here, maybe you can reproduce?

from server.js.

rubensworks avatar rubensworks commented on September 16, 2024

I may be missing something, but the server seems to be starting without issues for me when using your repos.

My steps:

  1. Clone and install the two repos
  2. Npm link ldf-datasource-summary into summary-server.
  3. Execute node bin/ldf-server config/config-example.json with the following config contents (original one does not seem to include the summary datasource):
{
  "@context": "https://linkedsoftwaredependencies.org/bundles/npm/@ldf/server/^3.0.0/components/context.jsonld",
  "@id": "urn:ldf-server:my",
  "import": "preset-qpf:config-defaults.json",

  "title": "My Linked Data Fragments server",

  "datasources": [
    {
      "@id": "ex:myHdtDatasource",
      "@type": "HdtDatasource",
      "datasourceTitle": "DBpedia 2014",
      "description": "DBpedia 2014 with an HDT back-end",
      "datasourcePath": "dbpedia",
      "hdtFile": "data/dbpedia2014.hdt"
    },
    {
      "@id": "ex:mySparqlDatasource",
      "@type": "SparqlDatasource",
      "datasourceTitle": "DBpedia (Virtuoso)",
      "description": "DBpedia with a Virtuoso back-end",
      "datasourcePath": "dbpedia-sparql",
      "sparqlEndpoint": "https://dbpedia.org/sparql"
    },
    {
      "@id": "ex:register",
      "@type": "SummaryDatasource",
      "datasourceTitle": "Summary register for source selection",
      "description": "My dataset with a Summaries back-end",
	  "datasourcePath": "summary",
      "dir": "/received-summaries"
    }
  ]
}

from server.js.

rubensworks avatar rubensworks commented on September 16, 2024

@mielvds FYI, I've justed updated the server (3.2.0) to Components.js v4, which may simplify things on your end.
Configs are fully backwards-compatible.

from server.js.

mielvds avatar mielvds commented on September 16, 2024

Thx @rubensworks , the error messages are much clearer now for debugging. I have update both repos. Can't get it to work though and i have no idea why it works for you.

Right now, I get:

2021-01-20T15:18:09.309Z [Components.js] warn: Detected remote context lookup for 'https://linkedsoftwaredependencies.org/bundles/npm/ldf-datasource-summary/^0.0.1/components/context.jsonld' in /Users/mielvandersande/Meemoo/NDE/demo/datasource-summary/components/components.jsonld. This may indicate a missing or invalid dependency, or an invalid context URL.

If I replace the link in ldf-datasource-summary/components/components.jsonld directly with the context

{
  "@context": [
    "https://linkedsoftwaredependencies.org/bundles/npm/componentsjs/^4.0.0/components/context.jsonld",
    {
      "npmd": "https://linkedsoftwaredependencies.org/bundles/npm/",
      "ldfdsm": "npmd:ldf-datasource-summary/",
      "files-ldfdsm": "ldfdsm:^0.0.1/",

      "SummaryDatasource": "ldfdsm:Datasource/Summary"
    }
  ],
  "@id": "npmd:ldf-datasource-summary",
  "@type": "Module",
  "requireName": "ldf-datasource-summary",
  "import": [
    "files-ldfdsm:components/Datasource/Summary.jsonld"
  ]
}

I get Component definition error: Error: Error while parsing file "https://linkedsoftwaredependencies.org/bundles/npm/ldf-datasource-summary/^0.0.1/components/Datasource/Summary.jsonld": Unexpected "T" at position 0 in state STOP Here I'm completely lost I'm afraid :)

from server.js.

rubensworks avatar rubensworks commented on September 16, 2024

This might be due to the usage of "lsd:module": true, which expands to a context URL that only includes the major version of your package (in your case ^0.0.0).

Could you try applying the following change in your components file?

- "files-ldfdsm": "ldfdsm:^0.0.1/",
+ "files-ldfdsm": "ldfdsm:^0.0.0/",

I can have another look at it tomorrow if things would still not work after this.

from server.js.

mielvds avatar mielvds commented on September 16, 2024

yes, that did it! Almost there ;)

Now it just needs to pick up the parameters:

Component definition error:
Error: Error while parsing file "config.json": Invalid predicate IRI: dir

With config.json:

{
  "@context": [
    "https://linkedsoftwaredependencies.org/bundles/npm/@ldf/server/^3.0.0/components/context.jsonld",
    "https://linkedsoftwaredependencies.org/bundles/npm/summary-server/^0.0.0/components/context.jsonld"],
  "@id": "urn:ldf-server:my",
  "import": "preset-qpf:config-defaults.json",

  "title": "My Linked Data Fragments server",

  "datasources": [
    {
      "@id": "ex:register",
      "@type": "SummaryDatasource",
      "datasourceTitle": "Summary register for source selection",
      "description": "My dataset with a Summaries back-end",
	    "datasourcePath": "summary",
      "dir": "/received-summaries"
    }
  ]
}

from server.js.

rubensworks avatar rubensworks commented on September 16, 2024

dir should probably be ldfdsm:Datasource/Summary#dir (unless you add an entry for it in your context).

from server.js.

mielvds avatar mielvds commented on September 16, 2024

ah yes, now I understand and it works. I wrongfully thought

      "constructorArguments": {
        "@id": "ldfdsm:Datasource/Summary#constructorArgumentsObject",
        "extends": "ldfc:Datasource#constructorArgumentsObject",
        "fields": [
          {
            "keyRaw": "dir",
            "value": "ldfdsm:Datasource/Summary#dir"
          }
        ]
      }

was taking care of that.

Thx @rubensworks !

from server.js.

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.