Skip to content

Use query function for Naigara4 nHaystack Server #116

Description

@MNupakorn

Problem

Example Code:

Code 1

  • Prompt
from pyhaystack.client.niagara import Niagara4HaystackSession
from pyhaystack.client.http.auth import BasicAuthenticationCredentials
import hszinc

URI  = "server endpoint"
USERNAME  = "username"
PASSWORD  = "password"

authenticator = BasicAuthenticationCredentials(
                                                    USERNAME, 
                                                    PASSWORD
                                                )

json = hszinc.MODE_JSON

session = Niagara4HaystackSession(  
                                            uri = URI,
                                            username = authenticator.username,
                                            password = authenticator.password,
                                            pint = True,
                                            grid_format= json
                                        )

session
  • Output
<pyhaystack.client.niagara.Niagara4HaystackSession at 0x12d8aa110>

Code 2

  • Prompt
session.sites

  • Output
HaystackError: java.lang.ClassCastException: org.projecthaystack.HStr cannot be cast to org.projecthaystack.HRef
Screenshot 2566-12-22 at 11 38 09

Code 3

  • Prompt
floor_2 = session.get_entity(
                                ids= "S.Floor_2"
                            )
floor_2.wait()
floor_2.result
  • Output
<@S.Floor_2: {area=0.0, axSlotPath='slot:/HS_Ontology/Floor_2', axType='nhaystack:HSite', dis='Floor_2', geoAddr='', geoCity='', geoCoord......, navName='Floor_2', site, tz='Bangkok'}>

Question

I can get entity by get_entity function but can not find_entity

  • Picture for tagging and ontology
Screenshot 2566-12-22 at 12 26 23 Screenshot 2566-12-22 at 12 26 16
  • Picture for Resource Unit
Screenshot 2566-12-22 at 12 25 25
  • Picture for number of entity
Screenshot 2566-12-22 at 12 23 01

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions