Giter VIP home page Giter VIP logo

hypergraphql's Introduction

HyperGraphQL HyperGraphQL

HyperGraphQL is a GraphQL interface for querying and serving linked data on the Web. It is designed to support federated querying and exposing data from multiple linked data services using GraphQL query language and schemas. The basic response format is JSON-LD, which extends the standard JSON with the JSON-LD context enabling semantic disambiguation of the contained data.

Please update to the latest versions to avoid the Log4Shell vulnerability

diagram

Release

This is v3.0.1, a fix to mitigate the Log4Shell vulnerability.

License note:

This software has been developed and is maintained by Epeirogenic AB. It is released under Apache License 2.0. See LICENSE.TXT for more infromation.

hypergraphql's People

Contributors

charlesivie avatar mirkodimartino avatar pc3356 avatar philcoates avatar sklarman avatar soblinger avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hypergraphql's Issues

@filter directive to include properties as query field

A very common use case is being able to filter using a property. For example:

{
  "query":"{ City_GET(limit:10) {  label(value: "paris") _id  } }"
}

Does hypergraphql provide a mechanism to configure something like this?

Would it be an idea to have another directive that adds this field automatically, like so:

type City @service(id:"dbpedia-sparql") {
    name: String @service(id:"dbpedia-sparql") 
    label: [String] @service(id:"dbpedia-sparql") @filter
}

Integration with Apollo2

From @jacobpdq on June 19, 2018 14:45

Hey guys,

This is a great library and I plan to use it with the SOLID framework. Do you have any experience using it with Apollo?

Copied from original issue: semantic-integration/hypergraphql#36

Custom scalar types

Hi,

Custom scalar types don’t appear to be supported.
Attempting to define ‘scalar anyURI’ results in a null pointer exception in HGQLSchema.getGraphQLOutputType line 305

Not a show stopper as can just use the built-in String, but certainly a nice-to-have

Thanks

Test automatically the building process

From @SkypLabs on May 31, 2018 15:50

Hi,

This issue follows up with #29.

I suggest to add a way to test automatically the building process and, if any, to execute all the unit tests in order to track issues in terms of misconfiguration, dependency problem or regression (see #19).

The pull request #29 suggests using Travis CI to carry out this task. Travis CI is a free, open-source and easy-to-use hosted continuous integration and deployment system. It perfectly fits the needs of an open-source project such as HyperGraphQL.

If you have any questions about Travis CI or the continuous integration and deployment systems in general, I would be happy to answer you.

Thanks.

Copied from original issue: semantic-integration/hypergraphql#32

Consider using extensions key for context

From @kbrandwijk on January 28, 2018 15:8

I love the idea of this project, but I don't like the fact that it returns a non-standard response (with the @context key). The graphql spec offers a standard way to implement this, using the extensions key.

Copied from original issue: semantic-integration/hypergraphql#23

Why is Person_GET not Person?

I was wondering why the queries (in case of Person type) are called Person_GET & Person_GET_BY_ID and not something like

{
  person(_id: 1) {
    name
  }
}

Mutations

Hi, Thanks for the awesome repo.

Can you point me to any docs around how to do mutations with this package?

Property paths

Hi, I'd like to ask the following:

I have this database

 @prefix o: <http://ontology.com/> .
 
 o:Game o:hasName o:Name .
 o:Name o:hasValue "Yu-Gi-Oh!" .

I want to query

{
  Game {
    name
  }
}

to get

...
"data": {
  "Game_GET": [
    {
      "name": "Yu-Gi-Oh!"
    }
  ]
}
...

But now, the schema I have is:

type __Context {
  Game:     _@href(iri: "http://ontology.com/Game")
  Name:     _@href(iri: "http://ontology.com/Name")
  hasName:  _@href(iri: "http://ontology.com/hasName")
  hasValue: _@href(iri: "http://ontology.com/hasValue")
}

type Game @service(id: "ontology") {
  hasName: Name @service(id: "ontology")
}

type Name @service(id: "ontology") {
  hasValue: String @service(id: "ontology")
}

I would have to query

{
  Game {
    hasName {
      hasValue
    }
  }
}

to get

...
"data": {
  "Game_GET": [
    {
      "hasName": {
        "hasValue": "Yu-Gi-Oh!"
      }
    }
  ]
}
...

My question is, how to define the schema.graphql so that it make the first GraphQL query possible? Meaning how to chain "hasName"and "hasValue" so it would be reduced to only "name".

I tried

type __Context {
  Game:     _@href(iri: "http://ontology.com/Game")
  name:     _@href(iri: "http://ontology.com/hasName" / "http://ontology.com/hasValue")
}
type Game @service(id: "ontology") {
  name: String @service(id: "ontology")
}

but no luck.

Thanks for your help

GraphQL types

From @yoooooooooooooooooooooooo on October 6, 2018 10:0

Hi, just a general questions about the software. In order to use hypergraphql with a sparql backend, do I have to define my own graphql types/classes? Or can I simply link hypergraphql with the endpoint and it will pick up rdf types/classes automatically?

For example if I have a node of class http://schema.org/Book does hypergraphql recognize this automatically if I query for, say, schema:Book or do I have to create a GraphQL types?

Copied from original issue: semantic-integration/hypergraphql#39

Problems with nested fragments

I'm trying to use nested fragments in a query to map onto a SKOS-XL schema, but get a 500 error because a FragmentDefinition cannot be cast onto an OperationDefinition. The query works fine without the fragments.

The query is:

fragment ConceptAttrs on Concept {
  preflabel {
    literalform
  }
  altlabel{
    literalform
  }
}

fragment ConceptRecursive on Concept {
	...ConceptAttrs
  broader {
    ...ConceptAttrs
    broader{
      ...ConceptAttrs
      broader {
        ...ConceptAttrs
        broader {
          ...ConceptAttrs
        }
      }
    }
  }
  narrower {
    ...ConceptAttrs
  }
}

{
  Concept_GET(limit: 1) { 
    _id
    ...ConceptRecursive
  }
}

The error trace is:

2018-11-05 09:11:17 ERROR GeneralError:54 -
java.lang.ClassCastException: graphql.language.FragmentDefinition cannot be cast to graphql.language.OperationDefinition
	at org.hypergraphql.datafetching.ExecutionForestFactory.getExecutionForest(ExecutionForestFactory.java:15)
	at org.hypergraphql.services.HGQLQueryService.results(HGQLQueryService.java:66)
	at org.hypergraphql.Controller.lambda$start$3(Controller.java:117)
	at spark.RouteImpl$1.handle(RouteImpl.java:61)
	at spark.http.matching.Routes.execute(Routes.java:61)
	at spark.http.matching.MatcherFilter.doFilter(MatcherFilter.java:130)
	at spark.embeddedserver.jetty.JettyHandler.doHandle(JettyHandler.java:50)
	at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1568)
	at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
	at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
	at org.eclipse.jetty.server.Server.handle(Server.java:561)
	at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:334)
	at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251)
	at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
	at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:104)
	at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:247)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:140)
	at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:131)
	at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:243)
	at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:679)
	at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:597)
	at java.lang.Thread.run(Thread.java:748)

The schema:

type __Context {
    Concept:      _@href(iri: "http://www.w3.org/2004/02/skos/core#Concept")
    Label:        _@href(iri: "http://www.w3.org/2008/05/skos-xl#Label")
    Scheme:       _@href(iri: "http://www.w3.org/2004/02/skos/core#Scheme")
    Collection:   _@href(iri: "http://www.w3.org/2004/02/skos/core#Collection")
    preflabel:    _@href(iri: "http://www.w3.org/2008/05/skos-xl#prefLabel")
    altlabel:     _@href(iri: "http://www.w3.org/2008/05/skos-xl#altLabel")
    literalform:     _@href(iri: "http://www.w3.org/2008/05/skos-xl#literalForm")
    broader:      _@href(iri: "http://www.w3.org/2004/02/skos/core#broader")
    narrower:     _@href(iri: "http://www.w3.org/2004/02/skos/core#narrower")
    inscheme:     _@href(iri: "http://www.w3.org/2004/02/skos/core#inScheme")
    label:        _@href(iri: "http://www.w3.org/2000/01/rdf-schema#")
}

type Concept @service(id:"dkp-sparql") {
    preflabel: [Label!] @service(id:"dkp-sparql")
    altlabel: [Label] @service(id:"dkp-sparql")
    broader: [Concept] @service(id:"dkp-sparql")
    narrower: [Concept] @service(id:"dkp-sparql")
    inscheme: Scheme! @service(id:"dkp-sparql")
}

type Label @service(id:"dkp-sparql") {
    literalform: String! @service(id:"dkp-sparql")
}

type Scheme @service(id:"dkp-sparql") {
    label: String @service(id:"dkp-sparql")
}

type Collection @service(id:"dkp-sparql") {
    label: String @service(id:"dkp-sparql")
}

Roadmap?

Hi @pc3356 and others,

I'm interested in incorporating this work into my organization and contributing, but as an outsider, it's hard to tell where hypergraphql is going and whether it's a safe bet. Contributing is difficult because it's unclear what the original developers have in mind.

Some questions to take this forward:

  • are there new features planned? What do they look like? What will they do?
  • when is the development (by the hypergraphql people or by contributers) planned?
  • how can you contribute?
  • is there a versioning strategy and release cycle? (website mentions 1.0.3, github is at 1.0.1)

URIs is null when the field is typed as `String` or `[String]`

Hello! HyperGraphQL seems to handle URIs as nulls when the field is typed as String or [String]?

A case where you might needs this, is when you have URIs that are only present as object, but never as subject.
Someone's homepage is a concrete example:

ex:Me a schema:Person;
      foaf:homepage <http://me.org> .

In the schema, I could have (although this might also fail):

type __Context {
    Person:                 _@href(iri: "https://schema.org/Person")
    homepage:               _@href(iri: "http://xmlns.com/foaf/0.1/homepage")
}

type Person @service(id:"endpoint") {
    homepage: Homepage @service(id:"endpoint")
}

type Homepage @service(id:"endpoint") {
}

In order to use:

{
  Person {
   homepage {
      _id
    }
  }
}

Or I could have

type Person @service(id:"endpoint") {
    homepage: String @service(id:"endpoint")
}

In order to use:

{
  Person {
    homepage
  }
}

Although option 1 might be more 'correct', I think at least allowing a string representation of the URI is desired behaviour. HypergraphQL seems to return null in case of option 2, which is unexpected and distorts search results.

Federating the SPARQL across multiple services

I am unable to get the federation working, i have posted my issue in stack-overflow here

can someone help me understand if its possible to construct the shape by linking to entities outside in another SPARQL endpoint. and why do I get the following error:

java.util.concurrent.ExecutionException: HttpException: 400 HTTP 400 error making the query:
 Parse error:  SELECT  * WHERE   { VALUES ?x_2 { <http://localhost:7002/resource/CUSTOMERS/11> }     OPTIONAL       { ?x_2    <http://localhost:7002/resource/vocab/CUSTOMERS_SUPPORTREPID>  ?x_2_1 .         ?x_2_1  a                     <http://localhost:7003/resource/vocab/EMPLOYEES>         OPTIONAL           { ?x_2_1  <http://localhost:7003/resource/vocab/EMPLOYEES_FIRSTNAME>  ?x_2_1_1 }       }   }   
Lexical error at line 3, column 11.  Encountered: " " (32), after : "VALUES"
            at java.util.concurrent.FutureTask.report(Unknown Source)
            at java.util.concurrent.FutureTask.get(Unknown Source)
            at org.hypergraphql.datafetching.services.SPARQLEndpointService.iterateFutureResults(SPARQLEndpointService.java:86)
            at org.hypergraphql.datafetching.services.SPARQLEndpointService.executeQuery(SPARQLEndpointService.java:69)
            at org.hypergraphql.datafetching.ExecutionTreeNode.generateTreeModel(ExecutionTreeNode.java:357)
            at org.hypergraphql.datafetching.FetchingExecution.call(FetchingExecution.java:21)
            at org.hypergraphql.datafetching.FetchingExecution.call(FetchingExecution.java:8)]

Issue trying to get an example working with connected nodes

Hi. I am trying to get a basic example. I am trying to run your example with dbpedia with Country and City. When I query a city using the GraphiQL, I get the city Id but if I try to get the city and country, I get the following error:
Exception while fetching data (/City_GET[0]/country/_id) : class java.util.ArrayList cannot be cast to class org.apache.jena.rdf.model.RDFNode (java.util.ArrayList is in module java.base of loader 'bootstrap'; org.apache.jena.rdf.model.RDFNode is in unnamed module of loader 'app')

I am using the pre-built jar located at: https://www.hypergraphql.org/resources/hypergraphql-3.0.1-exe.jar
My query is:
{ City_GET(limit: 5) { _id _type country { _id _type } } }
Config: https://github.com/hypergraphql/hypergraphql/blob/master/src/test/resources/test_configurations/config1.json
Schema: https://github.com/hypergraphql/hypergraphql/blob/master/src/test/resources/test_configurations/schema1.graphql

Let me know what I am missing.

Allow a JSON-LD context outside of the schema?

Would it be possible to add an option to replace the type __Context {} with an actual context.json that you supply at startup time? Or are there some technical limitations to such approach?

GraphQL types

From @yoooooooooooooooooooooooo on October 6, 2018 10:0

Hi, just a general questions about the software. In order to use hypergraphql with a sparql backend, do I have to define my own graphql types/classes? Or can I simply link hypergraphql with the endpoint and it will pick up rdf types/classes automatically?

For example if I have a node of class http://schema.org/Book does hypergraphql recognize this automatically if I query for, say, schema:Book or do I have to create a GraphQL types?

Copied from original issue: semantic-integration/hypergraphql#39

GraphQL types

From @yoooooooooooooooooooooooo on October 6, 2018 10:0

Hi, just a general questions about the software. In order to use hypergraphql with a sparql backend, do I have to define my own graphql types/classes? Or can I simply link hypergraphql with the endpoint and it will pick up rdf types/classes automatically?

For example if I have a node of class http://schema.org/Book does hypergraphql recognize this automatically if I query for, say, schema:Book or do I have to create a GraphQL types?

Copied from original issue: semantic-integration/hypergraphql#39

Property paths

Hi!

This product looks wonderful! However I wonder if there is a possiblity, already implemented or as an added feature to add property path features of sparql in some way:
https://www.w3.org/TR/sparql11-property-paths/

What I'd really need is inverse properties but I thought that maybe the tool would benefit from all of these.

From what I understand it would mean extending the GraphQL language in some way.

queries that return results based on specific predicate values

From @jeffreycwitt on January 20, 2018 17:33

Beyond, non null values, can we support queries where fields must have specific values?

I write SPARQL queries like this all time.

SELECT ?x_1 ?title WHERE { 
?x_1 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://scta.info/resource/expression> .  
?x_1 <http://scta.info/property/structureType> <http://scta.info/resource/structureItem> .  
?x_1 <http://purl.org/dc/elements/1.1/title> ?title
} 
LIMIT 100 

I expect that I'd like to write my graphQL query where the structureType property has an additional argument

{
  Expression_GET(limit:100)
  {
    structureType(predicate: structureItem) 
    title
    _id
  }
}

Copied from original issue: semantic-integration/hypergraphql#22

Hotloading graphql schema / config

When the config or schema needs updating, you have to restart the entire application. Is there a way to make updates while running possible?

Integration with ApolloClient

Hello
Bravo for that project. I will be very interested for some support of filters.
But for now, I have a problem. I've deployed an hypergraphql server linked to a fuseki rdf dataset.
On http://localhost:8080/graphiql, the query

{
  Takeoff_GET(limit:10) {
    label
    latitude
    longitude
  
     }
}

```give me what I expect.
But using the same query from an ApolloClient, I get the following error in hypergraphql

2021-09-12 16:26:01 WARN SimpleDataFetcherExceptionHandler:26 - Exception while fetching data (/Takeoff_GET) : class graphql.GraphQLContext cannot be cast to class org.hypergraphql.datamodel.ModelContainer (graphql.GraphQLContext and org.hypergraphql.datamodel.ModelContainer are in unnamed module of loader 'app')
java.lang.ClassCastException: class graphql.GraphQLContext cannot be cast to class org.hypergraphql.datamodel.ModelContainer (graphql.GraphQLContext and org.hypergraphql.datamodel.ModelContainer are in unnamed module of loader 'app')
at org.hypergraphql.datamodel.FetcherFactory.lambda$instancesOfTypeFetcher$2(FetcherFactory.java:44)
at graphql.execution.ExecutionStrategy.fetchField(ExecutionStrategy.java:277)
at graphql.execution.ExecutionStrategy.resolveFieldWithInfo(ExecutionStrategy.java:202)
at graphql.execution.AsyncExecutionStrategy.execute(AsyncExecutionStrategy.java:74)
at graphql.execution.Execution.executeOperation(Execution.java:167)
at graphql.execution.Execution.execute(Execution.java:108)
at graphql.GraphQL.execute(GraphQL.java:598)
at graphql.GraphQL.parseValidateAndExecute(GraphQL.java:529)
at graphql.GraphQL.executeAsync(GraphQL.java:493)
at graphql.GraphQL.execute(GraphQL.java:426)
at graphql.GraphQL.execute(GraphQL.java:308)
at org.hypergraphql.services.HGQLQueryService.results(HGQLQueryService.java:58)
at org.hypergraphql.Controller.lambda$start$3(Controller.java:139)
at spark.RouteImpl$1.handle(RouteImpl.java:72)
at spark.http.matching.Routes.execute(Routes.java:61)
at spark.http.matching.MatcherFilter.doFilter(MatcherFilter.java:134)
at spark.embeddedserver.jetty.JettyHandler.doHandle(JettyHandler.java:50)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1584)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:127)
at org.eclipse.jetty.server.Server.handle(Server.java:501)
at org.eclipse.jetty.server.HttpChannel.lambda$handle$1(HttpChannel.java:383)
at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:556)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:375)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:272)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:311)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:103)
at org.eclipse.jetty.io.ChannelEndPoint$1.run(ChannelEndPoint.java:104)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.runTask(EatWhatYouKill.java:336)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:313)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.tryProduce(EatWhatYouKill.java:171)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.run(EatWhatYouKill.java:129)
at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:375)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:806)
at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:938)
at java.base/java.lang.Thread.run(Thread.java:831)

Inspecting the request, I can see the payload

query: "{\n Takeoff_GET(limit: 10) {\n label\n latitude\n longitude\n __typename\n }\n}\n"
variables: {}

ApolloClient seems to add the __typename field, which is not in my submited query. If I try my query with the __typename, I get the same error from graphqli.  For now, I doesn't find how to inhibit ApolloClent from adding __typename or to enable Hypergraphql to manage __typename. 

Any help will be welcome.

error with gradle 7.5


SystemTest > integration_test() SKIPPED

> Task :test FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':test'.
> Process 'Gradle Test Executor 3' finished with non-zero exit value 100
  This problem might be caused by incorrect test process configuration.
  Please refer to the test execution section in the User Manual at https://docs.gradle.org/7.5/userguide/java_testing.html#sec:test_execution

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

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.