Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

empty string in Agent.js #13

Closed
bshambaugh opened this issue Mar 13, 2015 · 6 comments
Closed

empty string in Agent.js #13

bshambaugh opened this issue Mar 13, 2015 · 6 comments

Comments

@bshambaugh
Copy link

@ahdinosaur What does the empty string in line 5 mean? i.e: "": "http://schema.org/",

@ahdinosaur
Copy link
Member

@bshambaugh the prefix property is part of my extension to json-schema with the purpose of specifying linked data prefixes that can be used within other context properties. a library i wrote that parses this information into a jsonld @context object is schema-jsonld-context. an empty string as a prefix means that is the default vocabulary for any unprefixed context properties, which in jsonld terms is done by specifying @vocab in the @context object.

> var Agent =  require('./vocab/Agent')
undefined
> var schemaToJsonldContext = require('schema-jsonld-context')
undefined
> schemaToJsonldContext(Agent)
RangeError: Maximum call stack size exceeded
> delete Agent.dependencies
true
> schemaToJsonldContext(Agent)
schema-is-schema: invalid schema
> Agent.id = "http://ovn.vocab.is/Agent"
'http://ovn.vocab.is/Agent'
> schemaToJsonldContext(Agent)
{ '@vocab': 'http://schema.org/',
  foaf: 'http://xmlns.com/foaf/0.1/',
  Agent: 'foaf:Agent',
  relationships: 'ovn:hasRelationship' }

then there's vocab-jsonld-context which handles the dependencies and such to combine them into a single @context, but this is all a work in progress that i hope to improve upon by starting to use it in holodex.

does that help?

@fosterlynn
Copy link
Contributor

@ahdinosaur @elf-pavlik Ha one mystery explained I think. This is probably why your "json-ld" looked funny to people - it gets further processed into the real stuff.....

@fosterlynn
Copy link
Contributor

@ahdinosaur I know you are trying to focus on your implementation, but I have a request if it doesn't take long. Can you blow out your @context using your ovn inputs and the library you wrote? Or whichever parts you think are in OK enough shape to be useful? It would save me time in coding up a proposed draft @context for the relationships and relationship types. If not, no worries, I can get where you were going from what you have on ovn.

@ahdinosaur
Copy link
Member

@fosterlynn

> var vocab = require('./vocab')
> var vocabToJsonldContext = require('vocab-jsonld-context')
> var extend = require('xtend/mutable')
// id's must be absolute, do normalization
> Object.keys(vocab).forEach(function (id) { vocab[id].id = "http://vocab.ovn.is/" + id })
> vocabToJsonldContext(vocab.Person)
schema-is-schema: invalid schema
> vocab.Person.allOf[1].id = "http://vocab.ovn.is/Person"
'http://vocab.ovn.is/Person'
> vocab.Group.allOf[1].id = "http://vocab.ovn.is/Person"
'http://vocab.ovn.is/Person'
// end id normalization
// get context from each entity description and merge into a single context object
> var context = {}
> Object.keys(vocab).forEach(function (id) { extend(context, vocabToJsonldContext(vocab[id])) })
> context
{ '@vocab': 'http://schema.org/',
  foaf: 'http://xmlns.com/foaf/0.1/',
  Agent: 'foaf:Agent',
  relationships: 'ovn:hasRelationship',
  ovn: 'http://vocab.ovn.is/',
  Relationship: 'org:Membership',
  relationshipType: 'ovn:relationshipType',
  is: 'ovn:isRelated',
  has: 'ovn:hasRelated',
  status: 'ovn:status',
  symmetric: 'ovn:symmetric',
  RelationshipType: 'ovn:RelationshipType',
  label: 'skos:prefLabel',
  pluralLabel: 'skos:altLabel',
  org: 'http://www.w3.org/TR/vocab-org#',
  Person: 'org:Organization',
  members: 'member',
  qudt: 'http://qudt.org/1.1/schema/qudt',
  Kind: 'qudt:QuantityKind',
  description: 'qudt:description',
  abbreviation: 'qudt:abbreviation',
  symbol: 'qudt:symbol',
  generalization: 'qudt:quantityKind',
  Location: 'Place',
  handle: 'foaf:nick',
  location: 'foaf:based_near',
  groups: 'memberOf',
  Quantity: 'qudt:QuantityValue',
  value: 'qudt:numericValue',
  relativeStandardUncertainty: 'qudt:relativeStandardUncertainty',
  standardUncertainty: 'qudt:standardUncertainty',
  unit: 'qudt:unit',
  Unit: 'qudt:Unit',
  kind: 'qudt:quantityKind',
  conversionMultiplier: 'qudt:conversionMultiplier',
  conversionOffset: 'qudt:conversionOffset',
  skos: 'http://www.w3.org/2004/02/skos/core#',
  Role: 'org:Role',
  related: 'skos:related',
  broader: 'skos:broader',
  narrower: 'skos:narrower' }

not sure how useful this is though, i reckon its more useful to understand the prefixes and contexts i chose for each entity and see if those match with what you're looking for. as far as the relationship stuff goes, we're charting new territory with our own terms, which i prefer to trying to force our data model into existing (in my opinion kinda lacking) linked data terms.

@fosterlynn
Copy link
Contributor

@ahdinosaur Thanks much! It is helpful in my education and confidence in actually writing some json-ld. :) But yes, the hard part is choosing the mapping to existing vocab. I'm hoping @elf-pavlik will help in this area.

There is for sure a balancing act in using existing vocab, but I basically agree with you to use our new terms rather than forcing into existing terms when they aren't really right for us. For example, I am thinking to move away from org:Membership - too specific a name and doesn't support person to person relationships.

@elf-pavlik
Copy link
Member

we should handle it through #35

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants