GeezerVison is showing github.com — Embedded integer doesn't get represented simply? · Issue #313 · jsonld-java/jsonld-java
Embedded integer doesn't get represented simply? #313DescriptionI have the following rdf
{
<http://pk1> a <http://cambridgesemantics.com/ontologies/2018/06/MetadataDictionary#KeySet> , <http://cambridgesemantics.com/ontologies/2018/06/MetadataDictionary#PrimaryKey> ;
<http://cambridgesemantics.com/ontologies/2018/06/MetadataDictionary#priority> "6"^^<http://www.w3.org/2001/XMLSchema#int> .
<http://pk2> a <http://cambridgesemantics.com/ontologies/2018/06/MetadataDictionary#KeySet> , <http://cambridgesemantics.com/ontologies/2018/06/MetadataDictionary#PrimaryKey> ;
<http://cambridgesemantics.com/ontologies/2018/06/MetadataDictionary#priority> "6"^^<http://www.w3.org/2001/XMLSchema#int> .
<http://testc1> a <http://cambridgesemantics.com/ontologies/2018/06/MetadataDictionary#ClassConcept> , <http://cambridgesemantics.com/ontologies/2018/06/MetadataDictionary#MetadataConcept> , <http://www.w3.org/2004/02/skos/core#Concept> ;
<http://cambridgesemantics.com/ontologies/2018/06/MetadataDictionary#primaryKey> <http://pk1> , <http://pk2> .
}
When I run it through json ld via frame I get
{
"@context" : "http://cambridgesemantics.com/ontologies/2018/06/MetadataDictionary/ClassConcept",
"uri" : "http://testc1",
"type" : [ "metaframe:ClassConcept", "metaframe:MetadataConcept", "skos:Concept" ],
"primaryKey" : [ {
"uri" : "http://pk1",
"type" : [ "metaframe:KeySet", "metaframe:PrimaryKey" ],
"metaframe:priority" : {
"type" : "http://www.w3.org/2001/XMLSchema#int",
"@value" : "5"
}
}, {
"uri" : "http://pk2",
"type" : [ "metaframe:KeySet", "metaframe:PrimaryKey" ],
"metaframe:priority" : {
"type" : "http://www.w3.org/2001/XMLSchema#int",
"@value" : "6"
}
} ]
}
Which does reflect the rdf above... But although metaframe is defined in the @context somehow it remains in the property where the property name should be simply "priority". In addition I would expect it to be instead
instead of the type/value object..
Is this a bug? Activitychanged the title [-]Why do I need to supply the full hierarchy to the frame instead of it being automated?[/-] [+]Embedded integer doesn't get represented simply?[/+] on Apr 12, 2021afs commented on Apr 12, 2021
instead of the type/value object..
The input is xsd:int. To use a native JSON number, abbreviation it has to be xsd:integer.
(The input RDF does not correspond to the output shown. No http://pk2, and the integer is 5.) garpinc commented on Apr 12, 2021
- yes.. I added the pk2 in a later iteration. I updated the rdf to reflect matching rdf
- Changing it to xsd:integer worked... So awesome but why wouldn't xsd:int work the same way?
- "metaframe:priority" is still an issue. Is there a way to resolve that?
afs commented on Apr 12, 2021 garpinc commented on Apr 13, 2021 I'm not fully understanding 3.. Is it a bug in jsonld or in my context?
{
"@context": {
"owl" : "http://www.w3.org/2002/07/owl#",
"xsd" : "http://www.w3.org/2001/XMLSchema#",
"rdfs" : "http://www.w3.org/2000/01/rdf-schema#",
"metaframe" : "http://cambridgesemantics.com/ontologies/2018/06/MetadataDictionary#",
"uri" : "@id",
"type" : "@type",
"allTypes" : {
"@id" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"@type" : "@id",
},
"hasKey": {
"@id": "owl:hasKey",
"@type": "rdfs:Resource"
},
"definedLocation": {
"@id": "metaframe:definedLocation",
"@type": "metaframe:Location"
},
"priority": {
"@id": "metaframe:priority",
"@type": "xsd:integer"
}
}
}
gkellogg commented on Apr 13, 2021 The spec defines a useNativeTypes option to the FromRDF algorithm, which will use native numbers for xs:integer and xs:double literals. gkellogg commented on Apr 13, 2021 The “priority” term will be used only when the resulting string (or native) value matches the term definition.
it’s useful to take the expanded json and play with it in json-ld.org/playground. garpinc commented on Apr 13, 2021 I fixed above so that
{
<http://pk1> a <http://cambridgesemantics.com/ontologies/2018/06/MetadataDictionary#KeySet> , <http://cambridgesemantics.com/ontologies/2018/06/MetadataDictionary#PrimaryKey> ;
<http://cambridgesemantics.com/ontologies/2018/06/MetadataDictionary#priority> "6"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://pk2> a <http://cambridgesemantics.com/ontologies/2018/06/MetadataDictionary#KeySet> , <http://cambridgesemantics.com/ontologies/2018/06/MetadataDictionary#PrimaryKey> ;
<http://cambridgesemantics.com/ontologies/2018/06/MetadataDictionary#priority> "6"^^<http://www.w3.org/2001/XMLSchema#integer> .
<http://testc1> a <http://cambridgesemantics.com/ontologies/2018/06/MetadataDictionary#ClassConcept> , <http://cambridgesemantics.com/ontologies/2018/06/MetadataDictionary#MetadataConcept> , <http://www.w3.org/2004/02/skos/core#Concept> ;
<http://cambridgesemantics.com/ontologies/2018/06/MetadataDictionary#primaryKey> <http://pk1> , <http://pk2> .
}
now gives
{
"@context" : "http://cambridgesemantics.com/ontologies/2018/06/MetadataDictionary/ClassConcept",
"uri" : "http://testc1",
"type" : [ "metaframe:ClassConcept", "metaframe:MetadataConcept", "skos:Concept" ],
"primaryKey" : [ {
"uri" : "http://pk1",
"type" : [ "metaframe:KeySet", "metaframe:PrimaryKey" ],
"metaframe:priority" : 6
}, {
"uri" : "http://pk2",
"type" : [ "metaframe:KeySet", "metaframe:PrimaryKey" ],
"metaframe:priority" : 6
} ]
}
That classconcept context is
{
"@context": {
"skos" : "http://www.w3.org/2004/02/skos/core#",
"rdfs" : "http://www.w3.org/2000/01/rdf-schema#",
"metaframe" : "http://cambridgesemantics.com/ontologies/2018/06/MetadataDictionary#",
"uri" : "@id",
"type" : "@type",
"allTypes" : {
"@id" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"@type" : "@id"
},
"altLabel": {
"@id": "skos:altLabel",
"@type": "rdfs:Resource"
},
"prefLabel": {
"@id": "skos:prefLabel",
"@type": "rdfs:Resource"
},
"primaryKey": {
"@id": "metaframe:primaryKey"
},
"hiddenLabel": {
"@id": "skos:hiddenLabel",
"@type": "rdfs:Resource"
},
"broader": {
"@id": "skos:broader",
"@type": "rdfs:Resource"
},
"narrower": {
"@id": "skos:narrower",
"@type": "rdfs:Resource"
},
"inScheme": {
"@id": "skos:inScheme",
"@type": "rdfs:Resource"
},
"definition": {
"@id": "skos:definition",
"@type": "rdfs:Resource"
},
"matchReference": {
"@id": "metaframe:matchReference",
"@type": "metaframe:MatchResult"
},
"location": {
"@id": "metaframe:location",
"@type": "metaframe:Location"
},
"related": {
"@id": "skos:related",
"@type": "rdfs:Resource"
}
}
}
But the primary key has a type that actually has a different context
{
"@context": {
"owl" : "http://www.w3.org/2002/07/owl#",
"xsd" : "http://www.w3.org/2001/XMLSchema#",
"rdfs" : "http://www.w3.org/2000/01/rdf-schema#",
"metaframe" : "http://cambridgesemantics.com/ontologies/2018/06/MetadataDictionary#",
"uri" : "@id",
"type" : "@type",
"allTypes" : {
"@id" : "http://www.w3.org/1999/02/22-rdf-syntax-ns#type",
"@type" : "@id",
},
"hasKey": {
"@id": "owl:hasKey",
"@type": "rdfs:Resource"
},
"definedLocation": {
"@id": "metaframe:definedLocation",
"@type": "metaframe:Location"
},
"priority": {
"@id": "metaframe:priority",
"@type": "xsd:integer"
}
}
}
if I take the priority field from that context an move it to the classconcept context then it works and i get priority properly..
So I guess my problem is how to I pass the contexts that I need rather than just the one remote context.. I tried to pass a frame with the property that has the sub context
{
"@context" : "http://cambridgesemantics.com/ontologies/2018/06/MetadataDictionary/ClassConcept",
"@type" : "http://cambridgesemantics.com/ontologies/2018/06/MetadataDictionary#ClassConcept",
"primaryKey" : {
"@context" : "http://cambridgesemantics.com/ontologies/2018/06/MetadataDictionary/PrimaryKey",
"@type" : "http://cambridgesemantics.com/ontologies/2018/06/MetadataDictionary#PrimaryKey"
}
}
But that didn't work..
I also tried
"@context" : [ "http://cambridgesemantics.com/ontologies/2018/06/MetadataDictionary/ClassConcept", "http://cambridgesemantics.com/ontologies/2018/06/MetadataDictionary/PrimaryKey" ]
but that also didn't work
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|